VS Code 中的 GitHub Copilot 設定參考
本文件列出了 Visual Studio Code 中 GitHub Copilot 的配置設定。有關在 VS Code 中使用設定的常規資訊,請參閱 使用者和工作區設定。
開發團隊正在持續改進 VS Code 中的 Copilot 並新增新功能。其中一些功能仍處於實驗階段。請嘗試使用它們,並在 我們的 issues 中分享您的反饋。有關 VS Code 中的功能生命週期 的更多資訊。
提示
如果您還沒有 Copilot 訂閱,您可以透過註冊 Copilot 免費計劃來免費使用 Copilot,每月可獲得有限數量的行內建議和聊天互動。
通用設定
| 設定和描述 | 預設值 |
|---|---|
| chat.commandCenter.enabled 控制是否在 VS Code 標題欄中顯示聊天選單。 |
true |
| workbench.settings.showAISearchToggle 在設定編輯器中啟用使用 AI 搜尋設定。 |
true |
| workbench.commandPalette.experimental.askChatLocation (實驗性) 控制命令面板應在何處詢問聊天問題。 |
"chatView" |
| search.searchView.semanticSearchBehavior (預覽版) 配置在搜尋檢視中執行語義搜尋的時間:手動(預設)、未找到文字搜尋結果時,或始終。 |
"manual" |
| search.searchView.keywordSuggestions (預覽版) 控制是否在搜尋檢視中顯示關鍵字建議。 |
false |
程式碼編輯設定
| 設定和描述 | 預設值 |
|---|---|
| github.copilot.editor.enableCodeActions 控制在可用時是否將 Copilot 命令顯示為程式碼操作。 |
true |
| github.copilot.renameSuggestions.triggerAutomatically 生成符號重新命名建議。 |
true |
| github.copilot.enable 為指定的 語言 啟用或停用行內建議。 |
{ "*": true, "plaintext": false, "markdown": false, "scminput": false } |
| github.copilot.nextEditSuggestions.enabled 啟用 下一編輯建議 (NES)。 |
true |
| editor.inlineSuggest.edits.allowCodeShifting 配置 NES 是否能夠移動程式碼以顯示建議。 |
"always" |
| editor.inlineSuggest.edits.renderSideBySide 配置 NES 是否可以儘可能並排顯示更大的建議,或者 Copilot NES 是否應始終在相關程式碼下方顯示更大的建議。 |
"auto" |
| github.copilot.nextEditSuggestions.fixes 根據診斷(波浪線)啟用下一編輯建議。例如,缺少匯入。 |
true |
| editor.inlineSuggest.minShowDelay 顯示行內建議之前等待的毫秒數。 |
0 |
聊天設定
| 設定和描述 | 預設值 |
|---|---|
| github.copilot.chat.localeOverride 為聊天響應指定區域設定,例如 en 或 fr。 |
"auto" |
| github.copilot.chat.useProjectTemplates 使用相關的 GitHub 專案作為使用 /new 時的起始專案。 |
true |
| github.copilot.chat.scopeSelection 當您使用 /explain 且活動編輯器沒有選擇時,是否提示選擇特定的符號範圍。 |
false |
| github.copilot.chat.terminalChatLocation 控制從終端發起的聊天查詢應在何處開啟。 |
"chatView" |
| chat.detectParticipant.enabled 在聊天檢視中啟用聊天參與者檢測。 |
true |
| chat.checkpoints.enabled 啟用或停用聊天中的 檢查點。 |
true |
| chat.checkpoints.showFileChanges 在每次聊天請求結束時顯示檔案更改摘要。 |
false |
| chat.editRequests 啟用或停用 編輯之前的聊天請求。 |
"inline" |
| chat.editor.fontFamily 聊天程式碼塊中的字體系列。 |
"default" |
| chat.editor.fontSize 聊天程式碼塊中的字型大小(以畫素為單位)。 |
14 |
| chat.editor.fontWeight 聊天程式碼塊中的字型粗細。 |
"default" |
| chat.editor.lineHeight 聊天程式碼塊中的行高(以畫素為單位)。 |
0 |
| chat.editor.wordWrap 切換聊天程式碼塊中的換行。 |
"off" |
| chat.editing.confirmEditRequestRemoval 撤銷編輯前請求確認。 |
true |
| chat.editing.confirmEditRequestRetry 重做上次編輯前請求確認。 |
true |
| chat.editing.autoAcceptDelay 配置建議的編輯自動接受的延遲,使用零停用自動接受。 |
0 |
| chat.fontFamily 聊天中 Markdown 內容的字體系列。 |
"default" |
| chat.fontSize 聊天中 Markdown 內容的字型大小(以畫素為單位)。 |
13 |
| chat.notifyWindowOnConfirmation 當需要使用者輸入時,啟用或停用顯示作業系統通知視窗。 |
true |
| chat.notifyWindowOnResponseReceived 收到聊天響應時,啟用或停用顯示作業系統通知視窗。 |
true |
| chat.tools.terminal.autoReplyToPrompts 自動回覆終端提示,提供預設答案。 |
false |
| chat.tools.terminal.terminalProfile.<platform> 為每個平臺配置用於聊天終端命令的終端配置檔案。 |
"" |
| chat.useAgentsMdFile 啟用或停用使用 AGENTS.md 檔案作為聊天請求的上下文。 |
true |
| chat.math.enabled (預覽版) 在聊天中啟用或停用使用 KaTeX 進行數學渲染。 |
false |
| chat.viewTitle.enabled (預覽版) 在聊天頭部顯示當前聊天會話的標題。 |
true |
| github.copilot.chat.codesearch.enabled (預覽版) 當提示中使用 #codebase 時,Copilot 會自動發現要編輯的相關檔案。 |
false |
| chat.emptyState.history.enabled (實驗性) 在聊天檢視的空狀態下顯示最近的聊天曆史記錄。 |
false |
| chat.sendElementsToChat.enabled (實驗性) 啟用將簡單瀏覽器中的元素作為上下文傳送到聊天檢視。 |
true |
| chat.useNestedAgentsMdFiles (實驗性) 啟用或停用使用工作區子資料夾中的 AGENTS.md 檔案作為聊天請求的上下文。 |
false |
| github.copilot.chat.customOAIModels (實驗性) 為聊天配置自定義 OpenAI 相容模型。 |
[] |
| github.copilot.chat.edits.suggestRelatedFilesFromGitHistory (實驗性) 在聊天上下文中建議來自 git 歷史的相關檔案。 |
true |
代理設定
| 設定和描述 | 預設值 |
|---|---|
| chat.agent.enabled 啟用或停用代理(需要 VS Code 1.99 或更高版本)。 |
true |
| chat.agent.maxRequests Copilot 使用代理可以發出的最大請求數。 |
25 |
| github.copilot.chat.agent.autoFix 自動診斷並修復生成的程式碼更改中的問題。 |
true |
| chat.mcp.access 管理可以在 VS Code 中使用的模型上下文協議 (MCP) 伺服器。 |
true |
| chat.mcp.discovery.enabled 配置從其他應用程式自動發現 MCP 伺服器配置。 |
false |
| chat.tools.terminal.autoApprove 控制在 使用代理時自動批准哪些終端命令。命令可以設定為 true(自動批准)或 false(需要批准)。可以透過將模式括在 / 字元中來使用正則表示式。 |
{ "rm": false, "rmdir": false, "del": false, "kill": false, "curl": false, "wget": false, "eval": false, "chmod": false, "chown": false, "/^Remove-Item\\b/i": false } |
| chat.tools.terminal.enableAutoApprove 啟用或停用終端命令的自動批准。 |
true |
| chat.tools.terminal.ignoreDefaultAutoApproveRules 忽略終端命令的預設自動批准規則。 |
false |
| chat.tools.global.autoApprove 自動批准所有工具 - 此設定 停用關鍵安全保護。 |
false |
| chat.tools.urls.autoApprove 控制 哪些 URL 請求和響應被自動批准。 |
[] |
| chat.agent.thinking.collapsedTools (實驗性) 配置工具呼叫詳情在聊天對話中預設是摺疊還是展開。 |
always |
| chat.agent.thinkingStyle (實驗性) 配置思考標記在聊天中顯示的方式。 |
fixedScrolling |
| chat.customAgentInSubagent.enabled (實驗性) 啟用使用自定義代理和 子代理。 |
false |
| chat.mcp.autoStart (實驗性) 檢測到 MCP 配置更改時自動啟動 MCP 伺服器。 |
newAndOutdated |
| chat.tools.eligibleForAutoApproval (實驗性) 配置哪些工具在代理可以使用它們之前需要手動批准。 |
[] |
| chat.tools.terminal.blockDetectedFileWrites (實驗性) 需要使用者批准執行檔案寫入的終端命令。 |
outsideWorkspace |
| chat.useClaudeSkills (實驗性) 在 VS Code 中啟用對 Claude 技能的支援。 |
false |
| github.copilot.chat.newWorkspaceCreation.enabled (實驗性) 啟用用於在聊天中構建新工作區的工具。 |
true |
| github.copilot.chat.agent.thinkingTool (實驗性) 使用代理時啟用思考工具。 |
false |
| github.copilot.chat.cli.customAgents.enabled (實驗性) 啟用從 GitHub 後臺代理會話使用自定義代理。 |
false |
| github.copilot.chat.summarizeAgentConversationHistory.enabled (實驗性) 當上下文視窗已滿時,自動總結代理對話歷史。 |
true |
| github.copilot.chat.virtualTools.threshold (實驗性) 使用虛擬工具的工具計數閾值。虛擬工具將相似的工具集分組,並允許模型按需啟用它們。允許您為聊天請求超過 128 個工具的限制。 |
128 |
代理會話
代理檢視 提供了一個集中位置,用於管理本地聊天對話和遠端編碼代理會話。此檢視使您能夠同時處理多個 AI 會話,跟蹤其進度,並高效地管理長期任務。
| 設定和描述 | 預設值 |
|---|---|
| chat.viewSessions.orientation 配置代理會話列表在聊天檢視中的顯示方式。 |
auto |
| chat.agentSessionsViewLocation (預覽版) 啟用或停用專用的代理檢視。 |
disabled |
行內聊天設定
| 設定和描述 | 預設值 |
|---|---|
| inlineChat.finishOnType 在鍵入更改區域外的內容時結束編輯器內聯聊天會話。 |
false |
| inlineChat.holdToSpeech 按住編輯器內聯聊天鍵盤快捷鍵(⌘I (Windows, Linux Ctrl+I))會自動啟用語音識別。 |
true |
| editor.inlineSuggest.syntaxHighlightingEnabled 顯示行內建議的語法高亮。 |
true |
| inlineChat.lineEmptyHint (實驗性) 在空行上顯示編輯器內聯聊天的提示。 |
false |
| inlineChat.lineNaturalLanguageHint (實驗性) 只要一行主要由單片語成,就立即觸發編輯器內聯聊天。 |
true |
| github.copilot.chat.editor.temporalContext.enabled (實驗性) 將最近檢視和編輯的檔案包含在編輯器內聯聊天的上下文中。 |
false |
程式碼審查設定
| 設定和描述 | 預設值 |
|---|---|
| github.copilot.chat.reviewSelection.enabled (預覽版) 為編輯器文字選擇啟用使用 AI 進行程式碼審查。 |
true |
| github.copilot.chat.reviewSelection.instructions (預覽版) 自定義指令,新增到用於使用 AI 審查當前編輯器選擇的請求中。 |
[] |
自定義指令設定
| 設定和描述 | 預設值 |
|---|---|
| chat.instructionsFilesLocations 搜尋自定義指令檔案的位置。相對路徑從工作區的根資料夾解析。支援檔案路徑的 glob 模式。 |
{ ".github/instructions": true } |
| github.copilot.chat.codeGeneration.useInstructionFiles 自動將 .github/copilot-instructions.md 中的自定義指令新增到聊天請求中。 |
true |
| github.copilot.chat.commitMessageGeneration.instructions (實驗性) 使用 AI 生成提交訊息的自定義指令。 |
[] |
| github.copilot.chat.pullRequestDescriptionGeneration.instructions (實驗性) 使用 AI 生成拉取請求標題和描述的自定義指令。 |
[] |
可重用提示檔案設定
| 設定和描述 | 預設值 |
|---|---|
| chat.promptFilesLocations 搜尋提示檔案的位置。相對路徑從工作區的根資料夾解析。支援檔案路徑的 glob 模式。 |
{ ".github/prompts": true } |
| chat.promptFilesRecommendations 在開啟新聊天會話時,啟用或停用提示檔案推薦。提示檔名和布林值或 when 子句的鍵值對列表。 |
[] |
除錯設定
| 設定和描述 | 預設值 |
|---|---|
| github.copilot.chat.startDebugging.enabled (預覽版) 啟用聊天檢視中實驗性的 /startDebugging 意圖以生成除錯配置。 |
true |
| github.copilot.chat.copilotDebugCommand.enabled (預覽版) 啟用 copilot-debug 終端命令。 |
true |
測試設定
| 設定和描述 | 預設值 |
|---|---|
| github.copilot.chat.generateTests.codeLens (實驗性) 為未被當前測試覆蓋率資訊覆蓋的符號顯示生成測試程式碼鏡頭。 |
false |
| github.copilot.chat.setupTests.enabled (實驗性) 啟用實驗性的 /setupTests 意圖和 /tests 生成中的提示。 |
true |
筆記本設定
| 設定和描述 | 預設值 |
|---|---|
| notebook.experimental.generate (實驗性) 啟用生成操作,透過筆記本內聯聊天建立程式碼單元格。 |
true |
| github.copilot.chat.edits.newNotebook.enabled (實驗性) 在編輯模式下啟用筆記本工具以建立新的筆記本檔案。 |
true |
| github.copilot.chat.notebook.followCellExecution.enabled (實驗性) 在編輯器中顯示當前正在執行的單元格。 |
false |
輔助功能設定
| 設定和描述 | 預設值 |
|---|---|
| inlineChat.accessibleDiffView 內聯聊天是否也為更改渲染可訪問的 diff 檢視器。 |
"auto" |
| accessibility.signals.chatRequestSent 傳送聊天請求時播放訊號 - 聲音(音訊提示)和/或公告(警報)。 |
{ "sound": "auto", "announcement": "auto" } |
| accessibility.signals.chatResponseReceived 收到響應時播放聲音 / 音訊提示。 |
{ "sound": "auto" } |
| accessibility.signals.chatEditModifiedFile 當檔案被聊天編輯修改時播放聲音 / 音訊提示。 |
{ "sound": "auto" } |
| accessibility.signals.chatUserActionRequired 當用戶需要在聊天中執行操作時播放聲音 / 音訊提示。 |
{ "sound": "auto", "announcement": "auto" } |
| accessibility.signals.lineHasInlineSuggestion 當游標位於有行內建議的行上時播放聲音 / 音訊提示。 |
{ "sound": "auto" } |
| accessibility.signals.nextEditSuggestion 當下一編輯建議可用時播放聲音 / 音訊提示。 |
{ "sound": "auto", "announcement": "auto" } |
| accessibility.verboseChatProgressUpdates 提供關於聊天活動的詳細更新。 |
true |
| accessibility.verbosity.inlineChat 提供關於如何訪問行內編輯器聊天輔助功能選單的資訊,並在輸入框獲得焦點時發出提示,描述如何使用該功能。 |
true |
| accessibility.verbosity.inlineCompletions 提供關於如何訪問行內建議懸停和可訪問檢視的資訊。 |
true |
| accessibility.verbosity.panelChat 當聊天輸入框獲得焦點時,提供關於如何訪問聊天幫助選單的資訊。 |
true |
| accessibility.voice.keywordActivation 控制是否識別關鍵詞短語“嘿 Code”來啟動語音聊天會話。 |
"off" |
| accessibility.voice.autoSynthesize 當語音被用作輸入時,控制是否自動朗讀文字響應。 |
"off" |
| accessibility.voice.speechTimeout 停止說話後語音識別保持啟用的持續時間(以毫秒為單位)。 |
1200 |