在 IntelliJ IDEA 中集成 GitHub Copilot 非常简单,只需以下步骤即可实现。
步骤 1:安装 GitHub Copilot 插件
打开 IntelliJ IDEA,进入插件市场,搜索 GitHub Copilot:


安装完成后,重启 IntelliJ IDEA。
步骤 2:登录 GitHub 账号
- 重启 IDEA 后,右下角会弹出 GitHub Copilot 的提示,点击 Sign in to GitHub。
- 按照提示,使用浏览器登录你的 GitHub 账号,并授权 Copilot 访问。



授权完成后,IDEA 会显示 Copilot 已成功连接。

步骤 3:启用 GitHub Copilot
- 安装并登录后,Copilot 默认是启用的。
- 如果需要手动启用或禁用:进入 File > Settings(或 Preferences)。选择 Tools > GitHub Copilot。勾选或取消勾选 Enable GitHub Copilot。
步骤 4:使用 GitHub Copilot
-
代码补全 在编写代码时,Copilot 会根据上下文自动生成代码建议。按下 Tab 键接受建议,或按下 Esc 键忽略。




