Copilot 卡顿原因分析
Copilot 卡顿主要是网络和内存占用原因。
VSCode 内存优化
在 VSCode 中打开 setting.json 文件,打开方法 ctrl+shift+p,输入 Preferences: Open User Settings (JSON),然后添加如下代码:
{
"search.followSymlinks": false,
"git.autorefresh": false,
"editor.formatOnSave": false
}
网络代理配置
配置代理的话两种方法,推荐结合起来用(不冲突)。
还是在 setting.json 文件中,添加如下代码:
{
"http.proxy": "http://127.0.0.1:7890",
"http.proxyStrictSSL": false
}
扩展主机设置
调整 extension host 设置,将 Copilot 相关插件设置为 UI 端运行。
下面是推荐的完整 setting.json 配置,可以直接使用:
{
"python.linting.flake8Enabled": true,
"python.formatting.provider": "yapf",
"python.linting.flake8Args": ["--max-line-length=248"],
"python.linting.pylintEnabled": false,
"search.followSymlinks": false,
"git.autorefresh": false,
"editor.formatOnSave": false,
"remote.extensionKind": {
"GitHub.copilot": ["ui"],
"GitHub.copilot-chat": ["ui"]
},
"http.proxy": "http://127.0.0.1:7890",
"http.proxyStrictSSL": false,
"github.copilot.nextEditSuggestions.enabled": true,
"explorer.confirmDelete": false
}
其他建议
如果上述方法都不行,建议删除 VSCode 和 Copilot 插件,重新安装,然后再按照上面的步骤来一遍,基本可以解决绝大多数问题。
此外,还可能是插件冲突,需要注意一下。

