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/3-custom-instructions.md
+17-10Lines changed: 17 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,8 +53,8 @@ To see the impact of custom instructions, we will start by sending a prompt with
53
53
1. Return to your codespace.
54
54
2. Close any open files in your codespace from the previous exercises. This will ensure Copilot has the context we want it to have.
55
55
3. Open `server/routes/publishers.py`, an empty file.
56
-
4.Open**Copilot chat** by selecting the Copilot icon towards the top of your codespace.
57
-
5. Create a new chat session by selecting the **New Chat** button, represented by a **+**, which will remove any previous context.
56
+
4.If**Copilot chat** is not already open, open it by selecting the Copilot icon towards the top of your codespace.
57
+
5. Create a new chat session by typing `/clear` into the chat window and selecting <kbd>Enter</kbd> (or <kbd>return</kbd> on a Mac).
58
58
6. Select **Ask** from the modes dropdown.
59
59
7. Send the following prompt to create a new endpoint to return all publishers:
60
60
@@ -87,7 +87,7 @@ As highlighted previously, `copilot-instructions.md` is designed to provide proj
87
87
6. Close **copilot-instructions.md**.
88
88
7. Select **New Chat** in Copilot chat to clear the buffer and start a new conversation.
89
89
8. Return to **server/routes/publishers.py** to ensure focus is set correctly.
90
-
9.Send the same prompt as before to create the endpoint.
90
+
9. Send the same prompt as before to create the endpoint.
91
91
92
92
```plaintext
93
93
Create a new endpoint to return a list of all publishers. It should return the name and id for all publishers.
@@ -114,9 +114,11 @@ As highlighted previously, `copilot-instructions.md` is designed to provide proj
114
114
```
115
115
116
116
12. Also note how the existing code isn't updated, but of course we could ask Copilot to perform that operation if we so desired!
117
-
118
117
13.**Don't implement the suggested changes**, as we will be doing that in the next section.
119
118
119
+
> [!NOTE]
120
+
> If you accepted the changes, you can always select the **Undo** button towards the top right of the Copilot chat window.
121
+
120
122
From this section, you explored how the custom instructions file has provided Copilot with the context it needs to generate code that follows the established guidelines.
121
123
122
124
## Instruction files for tasks
@@ -169,20 +171,25 @@ We want to create a new endpoint to list all publishers, and to follow the same
169
171
> Note that the code generated may diverge from some of the standards we set. AI tools like Copilot are non-deterministic, and may not always provide the same result. The other files in our codebase do not contain docstrings or comment headers, which could lead Copilot in another direction. Consistency is key, so making sure that your code follows the established patterns is important. You can always follow-up in chat and ask Copilot to follow your coding standards, which will help guide it in the right direction.
170
172
171
173
16. After reviewing the code, select **Keep** in Copilot Chat to accept the changes.
172
-
17. Open a terminal window by selecting <kbd>Ctl</kbd> + <kbd>\`</kbd>.
173
-
18. Run the tests by running the script with the following command:
174
+
17. If you are prompted to run tests select **Cancel**; we'll perform this task later.
175
+
18. Open a terminal window by selecting <kbd>Ctl</kbd> + <kbd>\`</kbd>.
176
+
19. Run the tests by running the script with the following command:
174
177
175
178
```sh
176
179
./scripts/run-server-tests.sh
177
180
```
178
181
179
-
19. Once the code is correct, and all tests pass, open the **Source Control** panel on the left of the Codespace and review the changes made by Copilot.
180
-
20. Stage the changes by selecting the **+** icon in the **Source Control** panel.
181
-
21. Generate a commit message using the **Sparkle** button.
182
+
20. Once the code is correct, and all tests pass, open the **Source Control** panel on the left of the Codespace and review the changes made by Copilot.
183
+
184
+
> [!NOTE]
185
+
> If any tests fail, ask Copilot to suggest a fix. You can use `@terminal /explain` to give Copilot the context of your terminal window.
186
+
187
+
21. Stage the changes by selecting the **+** icon in the **Source Control** panel.
188
+
22. Generate a commit message using the **Sparkle** button.
182
189
183
190

184
191
185
-
22. Commit the changes to your repository by selecting **Commit**.
192
+
23. Commit the changes to your repository by selecting **Commit**.
0 commit comments