プロジェクトに関 Copilot Chat 具体的な質問や、ソフトウェアに関する一般的な質問をすることができます。 また、コードの記述、エラーの修正、テストの記述、コードの文書化を Copilot Chat に依頼することもできます。
上記のタブを使用して、 Copilot Chatを使用している環境を選択します。
<a href="vscode://GitHub.Copilot-Chat?ref_product=copilot&ref_type=engagement&ref_style=button" target="_blank" class="btn btn-primary mt-3 mr-3 mb-3 no-underline">
<span>
Visual Studio CodeでCopilot Chatを開く</span><svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-link-external" aria-label="link external icon" role="img"><path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path></svg>
次のプロンプト例の中には、チャット参加者 (前に @ が付く)、スラッシュ コマンド (前に / が付く)、またはチャット変数 (前に # が付く) を使用する場合があります。 プロンプトのキーワードの詳細については、「GitHub CopilotにIDEで質問を行う」を参照してください。
ソフトウェアに関する一般的な質問を行う
一般的なソフトウェアの質問をすることができます。 例えば次が挙げられます。
tell me about nodejs web server frameworkshow can I create an Express app@terminal how to update an npm package
あなたのプロジェクトについて質問してください
プロジェクトについて Copilot Chat 質問することができます。
-
what sorting algorithm does this function use -
@workspace how are notifications scheduled -
#file:gameReducer.js #file:gameInit.js how are these files relatedCopilot正しいコンテキストを提供するには、次の方法をいくつか試してください。 -
関連するコード行をハイライトする。
-
`#selection`、`#file`、`#editor`、`#codebase`、`#git` などのチャット変数を使います。 -
`@workspace` のチャット参加者を利用してください。
コードの記述
Copilotにコードの記述を依頼できます。 例えば次が挙げられます。
-
write a function to sum all numbers in a list -
add error handling to this function -
@workspace add form validation, similar to the newsletter pageCopilotがコード ブロックを返すと、応答には、コードをコピーしたり、カーソルにコードを挿入したり、新しいファイルに挿入したり、ターミナルに挿入したりするオプションが含まれます。
GitHub Advanced Security機能からのアラートについて質問する
Copilotに、GitHub Advanced Security機能 (code scanning、secret scanning、およびDependabot alerts) を使用して、組織内のリポジトリにおけるセキュリティアラートについて質問できます。 例えば次が挙げられます。
How would I fix this alert?How many alerts do I have on this pull request?Which line of code is this code scanning alert referencing?What library is affected by this Dependabot alert?
新しいプロジェクトを設定する
`/new` スラッシュ コマンドを使用して、新しいプロジェクトを設定します。 例えば次が挙げられます。
/new react app with typescript/new python django web application/new node.js express server
Copilotは、ディレクトリ構造を提案し、提案されたファイルと内容を作成するためのボタンを提供します。 提案されたファイルをプレビューするには、提案されたディレクトリ構造でファイル名を選択します。
`/newNotebook` スラッシュ コマンドを使用して、新しい Jupyter ノートブックを設定します。 例えば次が挙げられます。
/newNotebook retrieve the titanic dataset and use Seaborn to plot the data
コードの修正、改善、リファクタリング
作業中のファイルにエラーが含まれている場合は、 /fix スラッシュ コマンドを使用して、エラーを修正するように Copilot に依頼します。
コードを改善またはリファクタリングするための一般的な要求を行うこともできます。
how would you improve this code?translate this code to C#add error handling to this function
テストを記述する
`/tests`スラッシュ コマンドを使用して、アクティブなファイルまたは選択したコードのテストを記述するようにCopilotに依頼します。 例えば次が挙げられます。
/tests/tests using the Jest framework/tests ensure the function rejects an empty list
スラッシュ コマンド/testsは、既存のコードのテストを記述します。 コードを書き込む前にテストを記述する (テスト駆動開発) 場合は、/tests コマンドを省略します。 例えば次が挙げられます。
Add tests for a JavaScript function that should sum a list of integers
について質問する Visual Studio Code
`@vscode` チャット参加者を使用して、Visual Studio Codeに関する特定の質問をします。 例えば次が挙げられます。
@vscode tell me how to debug a node.js app@vscode how do I change my Visual Studio Code colors@vscode how can I change key bindings
コマンド ラインについて質問する
`@terminal` チャット参加者を使用して、コマンド ラインに関する具体的な質問をします。 例えば次が挙げられます。
@terminal find the largest file in the src directory- 最後のコマンドとエラーを説明する
@terminal #terminalLastCommand
ソフトウェアに関する一般的な質問を行う
ソフトウェアに関する一般的な質問をすることができます。 例えば次が挙げられます。
tell me about nodejs web server frameworkshow can I create an Express appwhat's the process for updating an npm package
あなたのプロジェクトについて質問してください
プロジェクトについて Copilot Chat 質問することができます。 Copilot正しいコンテキストを提供するには、次の方法をいくつか試してください。
- 関連するコード行をハイライトする。
- 関連するファイルを開く。
-
`#file`を使用して、特定のファイルを参照するようにCopilotに指示します。 -
`#solution`を使用して、アクティブなファイルを参照するようにCopilotに指示します。
例えば次が挙げられます。
what sorting algorithm does this function use#file:gameReducer.js what happens when a new game is requested
コードの記述
Copilotにコードの記述を依頼できます。 例えば次が挙げられます。
-
write a function to sum all numbers in a list -
add error handling to this functionCopilotがコード ブロックを返すと、応答には、コードのコピー、新しいファイルへのコードの挿入、またはコード出力のプレビューを行うオプションが含まれます。
GitHub Advanced Security機能からのアラートについて質問する
Copilotに、組織内のリポジトリでのセキュリティアラートについて、GitHub Advanced Security機能 (code scanning、secret scanning、Dependabot alerts) に関する質問をすることができます。 例えば次が挙げられます。
How would I fix this alert?How many alerts do I have on this pull request?Which line of code is this code scanning alert referencing?What library is affected by this Dependabot alert?
コードの修正、改善、リファクタリング
作業中のファイルにエラーが含まれている場合は、 /fix スラッシュ コマンドを使用して、エラーを修正するように Copilot に依頼します。
コードを改善またはリファクタリングするための一般的な要求を行うこともできます。
how would you improve this code?translate this code to C#add error handling to this function
テストを記述する
`/tests`スラッシュ コマンドを使用して、アクティブなファイルまたは選択したコードのテストを記述するようにCopilotに依頼します。 例えば次が挙げられます。
/tests/tests using the Jest framework/tests ensure the function rejects an empty list
スラッシュ コマンド/testsは、既存のコードのテストを記述します。 コードを書き込む前にテストを記述する (テスト駆動開発) 場合は、/tests コマンドを省略します。 例えば次が挙げられます。
Add tests for a JavaScript function that should sum a list of integers
ソフトウェアに関する一般的な質問を行う
一般的なソフトウェアの質問をCopilot Chatすることができます。 例えば次が挙げられます。
tell me about nodejs web server frameworkshow can I create an Express appwhat's the process for updating an npm package
あなたのプロジェクトについて質問してください
プロジェクトについて Copilot Chat 質問することができます。 Copilot正しいコンテキストを提供するには、次の方法をいくつか試してください。
- 関連するコード行をハイライトする。
- 関連するファイルを開く。
- 参照としてファイルを追加する。 ファイル参照の使用方法については、「GitHub CopilotにIDEで質問を行う」を参照してください。
-
`@project` のチャット参加者を利用してください。
例えば次が挙げられます。
what sorting algorithm does this function use-
`how are these files related` (質問内のファイルへの参照を含む) @project how are notifications scheduled
コードの記述
Copilotにコードの記述を依頼できます。 例えば次が挙げられます。
-
write a function to sum all numbers in a list -
add error handling to this functionCopilotがコード ブロックを返すと、応答には、コードをコピーしたり、カーソルにコードを挿入したりするオプションが含まれます。
コードの修正、改善、リファクタリング
作業中のファイルにエラーが含まれている場合は、 /fix スラッシュ コマンドを使用して、エラーを修正するように Copilot に依頼します。
コードを改善またはリファクタリングするための一般的な要求を行うこともできます。
how would you improve this code?translate this code to C#add error handling to this function
テストを記述する
`/tests`スラッシュ コマンドを使用して、アクティブなファイルまたは選択したコードのテストを記述するようにCopilotに依頼します。 例えば次が挙げられます。
/tests/tests using the Jest framework/tests ensure the function rejects an empty list
スラッシュ コマンド/testsは、既存のコードのテストを記述します。 コードを書き込む前にテストを記述する (テスト駆動開発) 場合は、/tests コマンドを省略します。 例えば次が挙げられます。
Add tests for a JavaScript function that should sum a list of integers
ソフトウェアに関する一般的な質問を行う
Copilot Chat に関する一般的なソフトウェアの質問をすることができます。 例えば次が挙げられます。
tell me about nodejs web server frameworkshow can I create an Express appwhat's the process for updating an npm package
プロジェクトのファイルについての質問をする
現在エディターに表示されているファイルや、会話に添付したファイルに関する Copilot Chat 質問を Copilot Chat パネルで確認できます。 Copilot正しいコンテキストを提供するには:
- 関連するファイルをエディターで開きます。
-
Copilot Chat パネルでクリップ アイコンをクリックし、会話に添付するファイルを検索して選択します。
例えば次が挙げられます。
how can I make this file run faster-
`how are these files related` (複数のファイルが添付されている場合) explain the getSearchReplaceRules function
コードの記述
Copilotにコードの記述を依頼できます。 例えば次が挙げられます。
-
write a TypeScript function to sum all numbers in a list -
using the comments in this file, create appropriate Node JavaScriptCopilotがコード ブロックを返すと、応答にはコードをコピーするためのオプションが含まれます。
コードの修正、改善、リファクタリング
作業中のファイルにエラーが含まれている場合は、 /fix スラッシュ コマンドを使用して、エラーを修正するように Copilot に依頼します。
コードを改善またはリファクタリングするための一般的な要求を行うこともできます。
how would you improve the code in this filetranslate this code to C#add error handling to the main function
テストを記述する
`/tests`スラッシュ コマンドを使用して、アクティブなファイルまたは選択したコードのテストを記述するようにCopilotに依頼します。 例えば次が挙げられます。
/tests/tests using the Jest framework/tests ensure the function rejects an empty list
スラッシュ コマンド/testsは、既存のコードのテストを記述します。 コードを書き込む前にテストを記述する (テスト駆動開発) 場合は、/tests コマンドを省略します。 例えば次が挙げられます。
Add tests for a JavaScript function that should sum a list of integers