Github Copilot 备忘清单 & github-copilot cheatsheet & 速查表
完整配置参考
// settings.json
{
// ...
"github.copilot.chat.welcomeMessage": "always",
"github.copilot.chat.localeOverride": "zh-CN",
"github.copilot.editor.enableCodeActions": true,
"github.copilot.editor.iterativeFixing": true,
"github.copilot.editor.enableAutoCompletions": true,
"github.copilot.enable": {
"plaintext": false,
"ini": false,
"markdown": true,
"*": true
},
"github.copilot.advanced": {
"length": 4000,
"inlineSuggestCount": 5,
"top_p": 1,
"temperature": "0.8",
"listCount": 10,
"stops": {
"*": [
"\n\n\n"
],
"python": [
"\ndef ",
"\nclass ",
"\nif ",
"\n\n#"
]
},
"debug.showScores": true,
"indentationMode": {
"python": false,
"javascript": false,
"javascriptreact": false,
"jsx": false,
"typescript": false,
"typescriptreact": false,
"go": false,
"ruby": false,
"*": true
}
}
// ...
}
参数说明
代理参数
| 设置参数 | 值类型 | 说明 |
|---|---|---|
"http.proxy" | string | 配置网络代理地址 |
Copilot Chat 参数
| 设置参数 | 值类型 | 说明 |
|---|---|---|
"github.copilot.chat.localeOverride" | string | 设置Copilot本地语言 |
"github.copilot.chat.welcomeMessage" | string | Copilot Chat 是否显示欢迎语first: 仅第一次启动时, always: 总是, never: 从不 |
Copilot 基本参数
| 设置参数 | 值类型 | 说明 |
|---|---|---|
"editor.inlineSuggest.enabled" | boolean | 启用内联建议 |
"github.copilot.editor.iterativeFixing" | boolean | 允许 Copilot 提供迭代修复建议 |
"github.copilot.editor.enableAutoCompletions" | boolean | 允许 Copilot 提供自动补全 |
"github.copilot.editor.enableCodeActions" | boolean | 允许 Copilot 提供代码操作建议,包括重构和优化代码结构、修复错误等 |
设置 Copilot 生效的文件类型
| 设置参数 | 值类型 | 说明 |
|---|---|---|
"github.copilot.enable" | json | 请将 "*": true 放到末尾 语言后设置 false 表示禁用copilot, 设置 true 表示启用 |
Copilot 高级参数
github.copilot.advanced 可以控制模型参数,最终影响到代码生成。其值为json
| 设置参数 | 值类型 | 说明 |
|---|---|---|
"length" | 整数 integer | 生成代码的字数,默认为 500 |
"top_p" | 数字 number | 控制模型候选范围,默认值为 1,范围为 0.0~1.0 |
"temperature" | 字符串 string | 控制模型创造性,默认值为空,值越大越不可预测,范围为 0.0~1.0 |
"inlineSuggestCount" | 整数 integer | 内联提示的个数,默认为 3 |
"listCount" | 整数 integer | Completions Panel 中建议的个数,默认为 10 |
"stops" | JSON | 控制模型代码生成时的停止标志,可按语言控制 |
"indentationMode" | JSON | 指定语言是否使用该语言的缩进模式,可能与 stops 冲突 |
"debug.showScores" | 布尔值 boolean | 在代码建议列表中显示每个建议的分数 |