Skip to content

Commit 1f56032

Browse files
committed
Refresh Copilot tutorials
1 parent 714cde7 commit 1f56032

26 files changed

+94
-74
lines changed

docs/copilot/getting-started-chat.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ In this tutorial, you'll be creating a simple Node.js web application. So, let's
5252

5353
![Screenshot of VS Code Copilot Chat view, showing the chat response with code blocks in the response.](./images/getting-started-chat/copilot-chat-view-express-app.png)
5454

55-
You can interact with these code blocks by copying the content in the editor or inserting it in the terminal.
55+
When Copilot returns a code block, you can select the **Apply in Editor** button to let Copilot insert the code in the active editor for you at the appropriate location. Alternatively, you can also insert the code at the cursor position, or copy the code to the clipboard.
5656

5757
![Screenshot of VS Code Copilot Chat view, showing the context menu for code blocks.](./images/getting-started-chat/copilot-chat-view-code-block-actions.png)
5858

59+
When the chat response contains links to a file, you can drag and drop that file from the Chat view to the editor to open it.
60+
5961
> **Tip**: Experiment with different questions and see how Copilot responds. For example, you can ask for only code samples ("give me 3 code samples to create an express app"), or ask how to add basic authentication to an Express app ("how to create an express app with basic auth"), and much more!
6062
6163
## Generate a new workspace
@@ -70,13 +72,13 @@ Let's ask Copilot to generate a workspace for an Express.js and Pug application.
7072

7173
* `@workspace` is a *chat participant*, which are domain experts that can perform tasks or answer questions in a specific domain. In this case, `@workspace` knows about VS Code workspaces and your codebase.
7274

73-
* `/new` is a *slash command* that tells the `@workspace` participant that you want to create a new workspace. Slash commmands are a shorthand for commonly used instructions. You can enter the `/` symbol in the chat input to get the list of supported commands.
75+
* `/new` is a *slash command* that tells the `@workspace` participant that you want to create a new workspace. Slash commands are a shorthand for commonly used instructions. You can enter the `/` symbol in the chat input to get the list of supported commands.
7476

7577
1. Copilot returns a file tree that represents the new workspace files, and a button to create the workspace.
7678

7779
![Screenshot of VS Code Copilot Chat view, showing a file tree for a new workspace and a 'Create workspace' button.](./images/getting-started-chat/copilot-chat-view-workspace-file-tree.png)
7880

79-
You can select any file in the file tree to preview its content.
81+
You can select any file in the file tree to preview the content before it's actually created. If you're not happy with the generated files, or want something different, you can ask follow-up questions, like `@workspace use ejs` to use EJS instead of Pug.
8082

8183
1. Select **Create workspace** to create a new workspace and select a folder on disk where the workspace should be created.
8284

@@ -88,7 +90,9 @@ Congratulations! You've just created a workspace with Copilot Chat by using natu
8890

8991
## Use chat participants
9092

91-
Previously, you used `@workspace` to generate a new workspace, but you can also use it to ask questions about the actual code in the workspace.
93+
Previously, you already used the `@workspace` chat participant to generate a new workspace, but you can also use it to ask questions about the actual code in the workspace.
94+
95+
Let's iterate on our generated Express app and add a new page to it.
9296

9397
1. In the Chat view, enter the *@workspace how to add a new page?*
9498

@@ -100,11 +104,11 @@ Previously, you used `@workspace` to generate a new workspace, but you can also
100104

101105
> **Tip**: You can add more details about the type of page you want to add, such as a home page, a contact page, or a product page.
102106
103-
1. There are more chat participants that you can use. Start typing `@` in the chat window to get the list of available chat participants.
107+
1. There are more chat participants that you can use, each with its own domain-specific expertise. Select the <i class="codicon codicon-mention"></i> icon or just type `@` in the Chat view to get the list of available chat participants.
104108

105109
![Screenshot of VS Code Copilot Chat view, showing the list of chat participants.](./images/getting-started-chat/copilot-chat-view-participants.png)
106110

107-
> **Note**: The list of participants might vary based on the extensions you have installed in VS Code.
111+
> **Note**: Extensions can also contribute chat participants, so the list might vary based on the extensions you have installed in VS Code.
108112
109113
1. Let's use `@vscode` to ask about VS Code. Enter `@vscode how to debug node.js app` in the chat input field.
110114

@@ -136,9 +140,9 @@ Let's look at how to use chat for code refactoring.
136140

137141
![Screenshot of VS Code editor with the suggested code change.](./images/getting-started-chat/copilot-inline-chat-configurable-port.png)
138142

139-
You can view the applied changes by selecting the **Toggle Changes** control.
143+
You can view the applied changes by selecting **More Actions** > **Toggle Changes**.
140144

141-
![Screenshot of VS Code inline chat, highlighting the 'Show changes' button and diff editor.](./images/getting-started-chat/copilot-inline-chat-show-changes.png)
145+
![Screenshot of VS Code inline chat, highlighting the 'More Actions' control and diff editor.](./images/getting-started-chat/copilot-inline-chat-show-changes.png)
142146

143147
1. Select **Accept** or **Discard** to apply or ignore the changes.
144148

@@ -166,11 +170,11 @@ Let's see how to use smart actions to fix a coding error.
166170

167171
Notice how Copilot uses the `/fix` slash command, followed by the error message. You can also use the `/fix` command directly in the chat input field to get help with fixing coding errors.
168172

169-
In addition to **Fix This**, Copilot provides more smart code actions, such as **Explain This**, **Generate Docs** (`/doc`), and **Generate Tests** (`/tests`). You can access these actions via the editor context menu and then selecting **Copilot**.
173+
In addition to **Fix**, Copilot provides more smart code actions, such as **Explain** (/explain), **Generate Docs** (`/doc`), and **Generate Tests** (`/tests`). You can access these actions via the editor context menu and then selecting **Copilot**.
170174

171175
![Screenshot of VS Code Copilot smart action context menu.](./images/getting-started-chat/copilot-smart-action-menu.png)
172176

173-
And if you come across some block of code that's unclear, use `/explain` to get Copilot to give you an explanation and help improve your code understanding.
177+
And if you come across some block of code that's unclear, just select it and use `/explain` to get Copilot to give you an explanation and help improve your code understanding.
174178

175179
## Add chat context
176180

@@ -198,9 +202,11 @@ Let's ask Copilot about what the purpose of a specific file in the workspace is.
198202

199203
Copilot now returns an explanation about the purpose of the code in the selected file.
200204

201-
1. Instead of using the **Attach Context** control, you can also reference different types of context by `#` in the chat input field.
205+
1. Instead of using the **Attach Context** control, you can also directly reference the different types of context by typing `#` in the chat input field.
206+
207+
To quickly attach a file as context for your chat prompt, you can drag and drop a file from the Explorer view onto the Chat view. If the file is open in the editor, you can also drag and drop the editor tab onto the Chat view to attach the file.
202208

203-
![Screenshot of VS Code Copilot Chat view, showing the list of chat variables.](./images/getting-started-chat/copilot-chat-view-variables.png)
209+
![Screenshot of VS Code Copilot Chat view, showing it as a drag and drop target for attaching a file as context.](./images/getting-started-chat/copilot-chat-view-attach-with-drop.png)
204210

205211
## Congratulations
206212

docs/copilot/getting-started.md

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -62,57 +62,65 @@ To get started with GitHub Copilot in VS Code, you don't have to do anything spe
6262

6363
AI-powered code completions can help you with generating boilerplate or repetitive code, letting you stay in the developer flow and focus on more complex coding tasks.
6464

65-
## Refactor your code through AI chat
65+
## Generate a simple web server with Copilot Chat
6666

67-
As you work on an existing codebase, you often need to refactor or improve existing code. With the [Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) extension, you can use AI-driven chat conversations in VS Code to ask specific tasks about your code.
67+
With the [Copilot Chat](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat) extension, you can start a chat conversations with Copilot in VS Code to ask specific tasks about your code by using natural language.
6868

69-
Let's use Copilot Chat to help us with generating and refactoring code.
69+
Let's use Copilot Chat to help us generate a simple Express web server.
7070

7171
1. First, add a new TypeScript file `server.ts` to your workspace.
7272

73-
Let's use the Copilot inline chat in the editor to generate a simple Express web server.
73+
Let's use the Copilot Inline Chat in the editor to generate a simple Express web server.
7474

75-
1. Now, press `kb(inlinechat.start)` on your keyboard to bring up Copilot inline chat.
75+
1. Now, press `kb(inlinechat.start)` on your keyboard to bring up Copilot Inline Chat.
7676

77-
With Copilot inline chat you get a chat interface that lets you ask questions about your code by using natural language.
77+
With Copilot Inline Chat you get a chat interface that lets you ask questions about your code by using natural language.
7878

79-
![Screenshot of VS Code editor, showing the Copilot inline chat control.](./images/getting-started/copilot-inline-chat.png)
79+
![Screenshot of VS Code editor, showing the Copilot Inline Chat control.](./images/getting-started/copilot-inline-chat.png)
8080

8181
1. Type *"add a simple express web server"* in the chat input field, and press `kbstyle(Enter)` to send the chat request or prompt to Copilot.
8282

8383
Notice that Copilot returns a streaming response into the editor. The response is an implementation for a simple Node.js Express web server.
8484

85-
![Screenshot of VS Code editor, showing the Copilot inline chat response for adding an Express web server.](./images/getting-started/copilot-inline-chat-express-server.png)
85+
![Screenshot of VS Code editor, showing the Copilot Inline Chat response for adding an Express web server.](./images/getting-started/copilot-inline-chat-express-server.png)
8686

8787
1. Select **Accept** or press `kb(inlineChat.acceptChanges)` to apply the proposed code changes.
8888

8989
Congratulations! You've used Copilot Chat for generating code using chat and natural language.
9090

91-
Now, let's use Copilot Chat to help us refactor the code to return a static HTML file as the home page, instead of "Hello, World!".
91+
Now, let's use Copilot Chat to help us refactor our code and return a static HTML file when users navigate to the home page.
92+
93+
## Refactor your code through AI chat
94+
95+
As you work on an existing codebase, you often need to refactor or improve existing code. You'll use Copilot Chat to refactor and iterate over your code.
96+
97+
Let's update the `/` route to return a static HTML page.
9298

93-
1. In the editor, select the `app.get('/'`, req, res) method, and then press `kb(inlinechat.start)` to start inline chat.
99+
1. In the editor, select the `app.get('/', req, res)` method, and then press `kb(inlinechat.start)` to start Inline Chat.
94100

95101
By selecting a range of text in the editor, you provide more context to Copilot about your request.
96102

97103
1. Type *"return a static index.html file"* in the chat input field, and press `kbstyle(Enter)` to send the chat request or prompt.
98104

99-
Notice how Copilot updates the existing method implementation to return an `index.html` file. Optionally, select the **Show changes** button to view a diff view and compare the changes.
105+
Notice how Copilot updates the existing method implementation to return an `index.html` file.
100106

101-
![Screenshot of VS Code editor, showing the Copilot inline chat suggested changes, highlighting the `Show changes` button.](./images/getting-started/copilot-inline-chat-refactor.png)
107+
![Screenshot of VS Code editor, showing the Copilot Inline Chat suggested changes, highlighting the `Show changes` button.](./images/getting-started/copilot-inline-chat-refactor.png)
102108

103109
1. Select **Accept** or press `kb(inlineChat.acceptChanges)` to apply the proposed code changes.
104110

105-
Experiment further with Copilot Chat, for example to add more routes to your web server, or ask Copilot Chat to add error handling, and more.
111+
Experiment further with Copilot Chat, for example to use an environment variable for the port number, to add more routes to your web server, or ask Copilot Chat to add error handling, and more.
112+
113+
![Screenshot of VS Code editor, showing the Copilot Inline Chat to use an environment variable for the port number.](./images/getting-started/copilot-inline-chat-refactor-port.png)
106114

107-
With Copilot Chat you can use a chat conversation and natural language to direct Copilot to perform specific tasks on your codebase. With inline chat, you can stay in the flow of coding, and ask for AI assistance in the moment, when you need it, without switching context.
115+
With Copilot Chat you can use a chat conversation and natural language to direct Copilot to perform specific tasks on your codebase. With Inline Chat, you can stay in the flow of coding, and ask for AI assistance in the moment, when you need it, without switching context.
108116

109117
## Use Copilot Chat for general programming questions
110118

111-
As you're working in a new codebase, or exploring a new programming language, you might have more general questions come up. Copilot Chat lets you open a chat conversation on the side, and which keeps track of the history of your questions.
119+
As you're working in a new codebase, or exploring a new programming language, you might have more general coding questions come up. Copilot Chat lets you open a chat conversation on the side, and which keeps track of the history of your questions.
112120

113121
1. Open the Chat view from the Activity Bar or press `kb(workbench.action.chat.open)`.
114122

115-
![Screenshot of VS Code editor, showing the Copilot Chat view, highlighting the chat control in the Activity bar.](./images/getting-started/copilot-chat-view.png)
123+
![Screenshot of VS Code editor, showing the Copilot Chat view, highlighting the chat control in the Activity Bar.](./images/getting-started/copilot-chat-view.png)
116124

117125
1. Type "what is recursion?" in the chat input field and press `kb(workbench.action.chat.submit)` to send the request to Copilot.
118126

@@ -142,9 +150,9 @@ One such place is the Copilot coding actions in the editor, whenever there you h
142150

143151
![Screenshot of VS Code editor, showing the Copilot code actions, hihglighting `Fix using Copilot`.](./images/getting-started/copilot-code-action-fix.png)
144152

145-
1. Notice that the Copilot inline chat comes up, prepopulated with the error message, and a solution to fix the problem.
153+
1. Notice that the Copilot Inline Chat comes up, prepopulated with the error message, and a solution to fix the problem.
146154

147-
![Screenshot of VS Code editor, showing the Copilot inline chat proposing to install the express npm package to solve the problem.](./images/getting-started/copilot-code-action-fix-result.png)
155+
![Screenshot of VS Code editor, showing the Copilot Inline Chat proposing to install the express npm package to solve the problem.](./images/getting-started/copilot-code-action-fix-result.png)
148156

149157
Directly from the chat response, you can optionally select the **Insert into Terminal** button to copy the proposed command in your terminal.
150158

Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)