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"stringCopilot 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"整数 integerCompletions Panel 中建议的个数,默认为 10
"stops"JSON控制模型代码生成时的停止标志,可按语言控制
"indentationMode"JSON指定语言是否使用该语言的缩进模式,可能与 stops 冲突
"debug.showScores"布尔值 boolean在代码建议列表中显示每个建议的分数