VS Code 中的 GitHub Copilot 設定參考
本文列出 Visual Studio Code 中 GitHub Copilot 的組態設定。如需在 VS Code 中使用設定的一般資訊,請參閱使用者和工作區設定,以及變數參考,以取得有關預先定義變數支援的資訊。
提示
如果您還沒有 Copilot 訂閱,您可以註冊 Copilot 免費方案,即可免費使用 Copilot,並獲得每月完成次數和聊天互動的限制。
團隊持續致力於改進 VS Code 中的 Copilot 並新增功能。某些功能仍處於實驗階段。請試用這些功能並在我們的問題追蹤器中分享您的意見反應。取得更多關於 VS Code 中功能生命週期的資訊。
一般設定
- github.copilot.editor.enableAutoCompletions:自動顯示內嵌完成建議。
- github.copilot.enable:針對指定的語言啟用或停用 Copilot 完成建議。
- github.copilot.editor.enableCodeActions:控制 Copilot 命令在可用時是否顯示為程式碼動作。
- github.copilot.renameSuggestions.triggerAutomatically:控制 Copilot 是否產生重新命名的建議。
- chat.commandCenter.enabled (實驗性):控制命令中心是否顯示聊天動作的選單。
- workbench.commandPalette.experimental.askChatLocation (實驗性):控制命令面板應在哪裡詢問聊天問題。
- github.copilot.chat.search.semanticTextResults (實驗性):在搜尋檢視中啟用語意搜尋結果。
- github.copilot.nextEditSuggestions.enabled (預覽版):啟用 Copilot Next Edit Suggestions (Copilot NES) (預覽版)。
- editor.inlineSuggest.edits.codeShifting:設定 Copilot NES 是否能夠移動您的程式碼以顯示建議。
- editor.inlineSuggest.edits.renderSideBySide:設定 Copilot NES 是否可以在可能的情況下並排顯示較大的建議,或者 Copilot NES 是否應始終在相關程式碼下方顯示較大的建議。
聊天設定
- github.copilot.chat.followUps:控制 Copilot 是否應在聊天中建議後續問題。
- github.copilot.chat.localeOverride:指定 Copilot 應回應的地區設定,例如
en
或fr
。 - github.copilot.chat.runCommand.enabled:在聊天檢視中啟用
/runCommand
意圖以執行 VS Code 命令。 - github.copilot.chat.useProjectTemplates:使用
/new
時,使用相關的 GitHub 專案作為入門專案。 - github.copilot.chat.scopeSelection:如果您使用
/explain
且活動編輯器沒有選取範圍,是否提示輸入特定的符號範圍。 - github.copilot.chat.terminalChatLocation:控制應在哪裡開啟來自終端機的聊天查詢。
- chat.experimental.detectParticipant.enabled (實驗性):在聊天檢視中啟用聊天參與者偵測。
- chat.editor.fontFamily:聊天程式碼區塊中的字型系列。
- chat.editor.fontSize:聊天程式碼區塊中的字型大小 (像素)。
- chat.editor.fontWeight:聊天程式碼區塊中的字型粗細。
- chat.editor.lineHeight:聊天程式碼區塊中的行高 (像素)。
- chat.editor.wordWrap:切換聊天程式碼區塊中的自動換行。
Copilot 編輯設定
- chat.editing.confirmEditRequestRemoval - 在還原編輯前要求確認 (預設值:
true
) - chat.editing.confirmEditRequestRetry - 在執行上次編輯的重做前要求確認 (預設值:
true
) - github.copilot.chat.edits.temporalContext.enabled (實驗性):是否在 Copilot 編輯中的請求中包含最近檢視和編輯的檔案。
- github.copilot.chat.edits.codesearch.enabled (實驗性):在提示中使用
#codebase
時,Copilot 編輯會自動探索要編輯的相關檔案。 - chat.editing.alwaysSaveWithGeneratedChanges - 自動將 Copilot 編輯產生的變更儲存到磁碟 (預設值:
false
) - chat.agent.enabled (實驗性) - 在 Copilot 編輯中啟用或停用代理人模式 (預設值:
false
) - chat.editing.autoAcceptDelay - 設定延遲時間,在此時間之後會自動接受建議的編輯,使用零停用自動接受 (預設值:0)
- github.copilot.chat.edits.codesearch.enabled (預覽版) - 讓 Copilot 透過將
#codebase
新增至您的提示來尋找正確的檔案,類似於代理人模式的運作方式 (預設值:false
) - chat.agent.maxRequests - Copilot 編輯在代理人模式下可以發出的最大請求數 (預設值:15)
內嵌聊天設定
- inlineChat.acceptedOrDiscardBeforeSave:控制編輯器中擱置的內嵌聊天工作階段是否會阻止儲存檔案。
- inlineChat.finishOnType:在變更區域外輸入時是否結束內嵌聊天工作階段。
- inlineChat.holdToSpeech:按住內嵌聊天鍵盤快速鍵是否會自動啟用語音辨識。
- inlineChat.inlineChat.lineEmptyHint (實驗性):控制是否在空行上顯示內嵌聊天的提示。
- inlineChat.lineNaturalLanguageHint (實驗性):實驗性建議,一旦某行主要由單字組成,就會觸發內嵌聊天。
- github.copilot.chat.editor.temporalContext.enabled (實驗性):是否在內嵌聊天中的 Copilot 請求中包含最近檢視和編輯的檔案。
自訂 Copilot 提示
- github.copilot.chat.codeGeneration.instructions (實驗性):一組將新增至產生程式碼的 Copilot 請求的指示。
- github.copilot.chat.codeGeneration.useInstructionFiles (預覽版):控制是否將來自
.github/copilot-instructions.md
的程式碼指示新增至 Copilot 請求。 - github.copilot.chat.testGeneration.instructions (實驗性):一組將新增至產生測試的 Copilot 請求的指示。
- github.copilot.chat.reviewSelection.instructions (預覽版):一組將新增至用於檢閱目前編輯器選取範圍的 Copilot 請求的指示。
- github.copilot.chat.commitMessageGeneration.instructions (實驗性):一組將新增至產生提交訊息的 Copilot 請求的指示。
- chat.promptFiles (實驗性):啟用提示檔案並指定提示檔案資料夾。設定為
true
以使用預設位置 (.github/prompts
),或使用{ "/path/to/folder": boolean }
標記法來指定不同的路徑。相對路徑會從您工作區的根資料夾解析。
偵錯設定
測試設定
- github.copilot.chat.generateTests.codeLens (實驗性):針對目前測試涵蓋率資訊未涵蓋的符號顯示產生測試程式碼鏡頭。
- github.copilot.chat.setupTests.enabled (實驗性):在
/tests
產生中啟用實驗性的/setupTests
意圖和提示。 - github.copilot.chat.fixTestFailure.enabled:在聊天中啟用預覽版的
/fixTestFailure
意圖,如果找不到任何測試設定,則自動委派某些/fix
叫用。 - github.copilot.chat.testGeneration.instructions (實驗性):一組將新增至產生測試的 Copilot 請求的指示。
Notebook 設定
協助工具設定
- inlineChat.accessibleDiffView:內嵌聊天是否也為其變更呈現可存取的差異檢視器。
- accessibility.signals.chatRequestSent:在發出聊天請求時播放訊號 - 聲音 (音訊提示) 和/或公告 (警示)。
- accessibility.signals.chatResponseReceived:在收到回應時播放聲音/音訊提示。
- accessibility.verbosity.inlineChat:提供有關如何存取內嵌編輯器聊天協助工具說明選單的資訊,並在輸入焦點在輸入上時以提示警示,說明如何使用此功能。
- accessibility.verbosity.inlineCompletions:提供有關如何存取內嵌完成建議懸停和協助工具檢視的資訊。
- accessibility.verbosity.panelChat:提供有關在聊天輸入焦點在輸入上時如何存取聊天說明選單的資訊。
- accessibility.voice.keywordActivation:控制是否辨識關鍵字詞組「Hey Code」以開始語音聊天工作階段。
- accessibility.voice.autoSynthesize:控制在使用語音作為輸入時,是否應自動大聲朗讀文字回應。
- accessibility.voice.speechTimeout:在您停止說話後,語音辨識保持活動狀態的持續時間 (毫秒)。