You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/copilot/copilot-chat.md
+52-54Lines changed: 52 additions & 54 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,9 @@ Copilot Chat integrates in your developer flow and gives you assistance where yo
18
18
*[**Chat view**](#chat-view): have an AI assistant on the side to help with your questions and to provide code suggestions
19
19
*[**Quick Chat**](#quick-chat): ask a quick question and get back into what you're doing
20
20
21
+
> [!TIP]
22
+
> If you intend to make edits across multiple files in your project, you might consider using [Copilot Edits](/docs/copilot/copilot-edits.md). You can easily [move an existing chat conversation to Copilot Edits](/docs/copilot/copilot-edits.md#send-a-chat-request-to-copilot-edits).
23
+
21
24
## Copilot Chat use cases
22
25
23
26
You can use Copilot Chat in various developer scenarios, such as:
@@ -37,7 +40,7 @@ You can use Copilot Chat in various developer scenarios, such as:
37
40
38
41
Follow these steps to [set up GitHub Copilot in VS Code](/docs/copilot/setup.md) by signing up for a subscription and installing the Copilot extension in VS Code.
39
42
40
-
## Getting started
43
+
## Getting started with Copilot Chat
41
44
42
45
### Open chat
43
46
@@ -57,24 +60,35 @@ Or use one of the keyboard shortcuts to start a chat conversation with Copilot.
57
60
58
61
Copilot tries to determine the intent and scope of your question based on your natural language chat prompt. To help Copilot give you the best and most relevant answers, add context to your chat prompt. For example, attach specific files or even the full contents of your workspace, the current editor selection, and more.
59
62
60
-
You can add context to your chat message by using the <iclass="codicon codicon-attach"></i> button (`kb(workbench.action.chat.attachContext)`) in any of the chat experiences. You can then select the specific type of context from a Quick Pick, such as the current selection, one or more files from the workspace, or one or more symbols from your source code.
63
+
VS Code automatically adds the currently active editor as context to your chat prompt in the Chat view. If you have a block of code selected in the editor, only that selection is added as context. You can disable adding the active editor by selecting the disable icon on the context item.
61
64
62
-

65
+

63
66
64
-
> [!TIP]
65
-
> To quickly add multiple items from the attachment Quick Pick, use the `kbstyle(Up)` and `kbstyle(Down)` keys to navigate the list, use the `kbstyle(Right)` key to add the item as context, and then repeat this for other items.
67
+
There are several ways to add context to your chat prompt:
66
68
67
-
Another quick way to add specific files to your chat prompt is to drag and drop files from the Explorer or Search view onto the chat input field. You can also drag and drop an editor tab onto the chat input field to add the file as context.
69
+
* Use the <iclass="codicon codicon-attach"></i> button (`kb(workbench.action.chat.attachContext)`) in any of the chat experiences.
68
70
69
-
<videosrc="images/copilot-chat/copilot-attach-dnd.mp4"title="Dragging files and editors into chat"autoplayloopcontrolsmuted></video>
71
+
You can then select the specific type of context from a Quick Pick, such as the current selection, one or more files from the workspace, or one or more symbols from your source code.
70
72
71
-
VS Code automatically adds the currently active editor as context to your chat prompt in the Chat view. If you have a block of code selected in the editor, only that selection is added as context. You can disable adding the active editor by selecting the disable icon on the context item.
73
+

72
74
73
-

75
+
> [!TIP]
76
+
> To quickly add multiple items from the attachment Quick Pick, use the `kbstyle(Up)` and `kbstyle(Down)` keys to navigate the list, use the `kbstyle(Right)` key to add the item as context, and then repeat this for other items.
74
77
75
-
You can also reference context by using chat variables. Type the `#` character and you'll see a list of available chat variables. For example, you can use `#selection` to add the current editor selection to your chat prompt, or `#file` to add a specific file from the workspace.
78
+
* Drag and drop editor tabs, or files or folders from the Explorer view, Search view, or editor breadcrumb onto the Chat view.
76
79
77
-

80
+
<videosrc="images/copilot-chat/copilot-attach-dnd.mp4"title="Dragging files and editors into chat"autoplayloopcontrolsmuted></video>
81
+
82
+
* Use chat variables by typing the `#` character and you'll see a list of available chat variables.
83
+
84
+
For example, you can use `#selection` to add the current editor selection to your chat prompt, `#file` to add a specific file from the workspace, or `#sym` to add a symbol from the workspace.
85
+
86
+

87
+
88
+
> [!TIP]
89
+
> Type `#` and use it as an IntelliSense trigger for file or symbol suggestions.
90
+
91
+
* Use the context menu **Copilot** > **Add File to Chat** (or **Add Selection to Chat** for a text selection) on a file in the Explorer or Search view.
78
92
79
93
> [!NOTE]
80
94
> If possible, the full contents of the file will be included when you attach a file. If that is too large to fit into the context window, an outline of the file will be included that includes functions and their descriptions without implementations. If the outline is also too large, then the file won't be part of the prompt.
@@ -219,22 +233,26 @@ Once a command is suggested, use **Run** (`kb(workbench.action.terminal.chat.run
219
233
220
234
Optionally, you can edit the command directly in the Copilot response before running it by placing the cursor in the response or by pressing `kbstyle(Ctrl+down)`, `kbstyle(Tab)`, `kbstyle(Tab)` on Windows & Linux, or `kbstyle(Cmd+down)`, `kbstyle(Tab)`, `kbstyle(Tab)` on macOS.
221
235
222
-
## Chat smart actions
236
+
## Smart actions
237
+
238
+
Copilot Chat lets you use natural language to get help from Copilot. For several common scenarios, you can use *smart actions* to get help from Copilot without having to write a prompt. Examples of these smart actions are for tasks, such as generating commit messages, generating documentation, fixing code, explaining code, or reviewing code changes.
223
239
224
-
To make it easier to use Copilot Chat features, smart actions are integrated in your VS Code flow and they do not require you to write any prompt at all. For example, you can access Copilot smart actions from the editor context menu or through Quick Fix actions.
240
+
These smart actions are available throughout the VS Code UI. For example, you can access Copilot smart actions from the editor context menu or through Quick Fix actions.
225
241
226
-
Access the smart actions by selecting a block of code, right-clicking, and choosing **Copilot**. The smart actions are context-aware and can help you with common tasks, such as generating documentation, fixing code, or explaining code.
242
+
In the editor, you can access smart actions by selecting a block of code, right-clicking, and then choosing **Copilot**.
227
243
228
244

229
245
230
-
The most powerful smart action is `/fix`. Here is a relatively simple TypeScript calculator with an error noting that "Argument of type 'string' is not assignable to parameter of type 'number'". Select the *sparkle* icon, and then choose **Fix using Copilot**.
246
+
The most powerful smart action is the **Fix** action. Here is a relatively simple TypeScript calculator with an error noting that "Argument of type 'string' is not assignable to parameter of type 'number'". Select the *sparkle* icon, and then choose **Fix**.
231
247
232
248

233
249
234
-
Similar to `/fix`, the `/doc` smart action is popular with users. To use `/doc`, select a block of code, right-click, and choose **Copilot** > **Generate Docs**. Copilot will generate a documentation comment for your code.
250
+
Similar to `/fix`, the `/doc` smart action is a popular action. To use `/doc`, select a block of code, right-click, and choose **Copilot** > **Generate Docs**. Copilot will generate a documentation comment for your code.
235
251
236
252

237
253
254
+
You can also invoke some of these smart actions by using their equivalent [slash command](#slash-commands) in chat. For example, you can use `/fix` to fix the problems in the selected code, or `/doc` to generate documentation for the selected code.
255
+
238
256
## Chat participants
239
257
240
258
*Chat participants* are like experts who have a specialty that they can help you with. You can invoke a chat participant by typing '@' in the chat input field, followed by the participant name. There are several built-in chat participants:
@@ -328,21 +346,7 @@ Some examples of built-in slash commands are:
328
346
329
347
To view the list of build-in participants and their commands, type `@` in the chat input field or select the <iclass="codicon codicon-mention"></i> icon.
330
348
331
-
## Improve the performance of Copilot Chat
332
-
333
-
Copilot works best when it has sufficient context to know what you're doing and what you want help with. Just as you would provide a colleague with the context when asking for help with a specific programming task, you can do the same with Copilot.
334
-
335
-
You can help Copilot provide better answers by upvoting or downvoting responses with the thumbs up and down icons in the upper right of its response. This provides Copilot feedback on how much it helped with your scenario so that it can help you even better in the future.
336
-
337
-
### Use chat variables
338
-
339
-
By using a chat variable in your chat prompt, you can be more specific about the context that you provide to Copilot. For example, the prompt _"which sorting algo is used #selection"_ focuses the chat request on the selected code snippet.
340
-
341
-
### Use chat participants and commands
342
-
343
-
Chat participants, such as `@workspace`, might have context associated within them. For example, `@vscode` is aware of VS Code settings and its APIs. When you include a chat participant in the chat prompt, you inherently add context to the prompt. Similarly, by using slash commands, you can further focus the intent of the chat request.
344
-
345
-
### Conversation history
349
+
## Conversation history
346
350
347
351
Copilot keeps track of the history of your conversation in the Chat view. Copilot can use this information as context in subsequent prompts, for example when you have a [multi-turn conversation](#multi-turn-conversations).
348
352
@@ -356,14 +360,6 @@ You can delete a prompt and the corresponding response from the conversation his
356
360
357
361
You can export all prompts and responses for a chat session in a JSON file with the **Chat: Export Chat...** command in the Command Palette.
358
362
359
-
### Context in Inline Chat
360
-
361
-
If you're using Inline Chat, and you have code selected in the editor, Copilot scopes your question to the selection.
362
-
363
-
### Ignore files
364
-
365
-
When you're using `@workspace` to ask questions related to your VS Code workspace, you can explicitly ignore specific files from the workspace by using a `.gitignore` file. `@workspace` respects `.gitignore` when deciding which files from the workspace to index.
366
-
367
363
## Use voice interactions
368
364
369
365
With the voice control capabilities in VS Code, provided by the [VS Code Speech](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-speech) extension, you can initiate a chat conversation by using your voice:
@@ -390,30 +386,32 @@ Learn more about security, privacy, and transparency in the [GitHub Copilot Trus
390
386
391
387
## Frequently asked questions
392
388
393
-
### How do I choose between Inline Chat, Chat view, and Quick Chat?
389
+
### How do I choose between Copilot Edits, Inline Chat, Chat view, and Quick Chat?
394
390
395
391
The following table provides a comparison of the capabilities of each interface.
\*_only a limited set of commands is available in Inline Chat_
405
+
\*_code blocks are included in the chat conversation and need to be applied to the right file manually_
410
406
411
407
## Additional resources
412
408
413
409
You can read more about [GitHub Copilot](https://github.com/features/copilot) and how to use it in VS Code in the [GitHub Copilot documentation](https://docs.github.com/copilot/getting-started-with-github-copilot?tool=vscode).
414
410
415
411
Or check out the [VS Code Copilot Series](https://www.youtube.com/playlist?list=PLj6YeMhvp2S5_hvBl2SE-7YCHYlLQ0bPt) on YouTube, where you can find more introductory content and programming-specific videos for using Copilot with [Python](https://www.youtube.com/watch?v=DSHfHT5qnGc), [C#](https://www.youtube.com/watch?v=VsUQlSyQn1E), [Java](https://www.youtube.com/watch?v=zhCB95cE0HY), [PowerShell](https://www.youtube.com/watch?v=EwtRzAFiXEM), [C++](https://www.youtube.com/watch?v=ZfT2CXY5-Dc), and more.
416
412
417
-
## Next step
413
+
## Next steps
414
+
415
+
* Get started with the introductory [Copilot Chat tutorial](/docs/copilot/getting-started-chat.md).
418
416
419
-
Get started with the introductory [Copilot Chat tutorial](/docs/copilot/getting-started-chat.md).
417
+
* Make edits across multiple files with [Copilot Edits](/docs/copilot/copilot-edits.md).
0 commit comments