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
Enhance exercise instructions for using GitHub Copilot, including additional notes on Flask routes and terminal commands, and add resource links for better guidance.
Copy file name to clipboardExpand all lines: content/guided-workshop/exercises/6-code.md
+13-4Lines changed: 13 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,6 +45,9 @@ Let's build our new route in our Flask backend with the help of code completion.
45
45
5. Select <kbd>Tab</kbd> to accept the code suggestion.
46
46
6. Navigate to [http://localhost:5100/api/breeds](http://localhost:5100/api/breeds) to validate the route.
47
47
48
+
> [!NOTE]
49
+
> As with the prior exercise, we don't provide specific prompts to use with Copilot, as part of the learning experience is to discover how to interact with Copilot. If you are unfamiliar with Flask or how to add routes, you can look at the routes defined above for inspiration, or ask Copilot chat for guidance!
50
+
48
51
## Generate the unit tests
49
52
50
53
With the route created, we want to now add the tests to ensure the code is correct. We can use GitHub Copilot chat's slash command **/tests** to create the test for us!
@@ -58,7 +61,7 @@ With the route created, we want to now add the tests to ensure the code is corre
58
61
7. Review and validate the code, making any necessary changes. Select **Keep** once you're satisfied.
59
62
> [!IMPORTANT]
60
63
> GitHub Copilot, like any generative AI solution, can make mistakes. Always review the generated code, making any necessary changes to ensure it's accurate and performs as expected.
61
-
8. Open a terminal window in your codespace orVS Code by selecting <kbd>Ctl</kbd><kbd>`</kbd>
64
+
8. Open a terminal window in your codespace orVS Code by selecting <kbd>Ctl</kbd>+<kbd>Shift</kbd>+<kbd>`</kbd>
62
65
9. Ensure the virtual server is activated by running the terminal command `source ./venv/bin/activate`
63
66
10. Navigate to the **server** folder by running the terminal command `cd server`
64
67
11. Run the tests by running the terminal command `python -m unittest`
@@ -68,7 +71,7 @@ With the route created, we want to now add the tests to ensure the code is corre
68
71
69
72
Adding the filters to the page will require updating a minimum of three files - the Flask backend, the unit tests for our Flask backend, and the Svelte frontend. Fortunately, Copilot Edits can update multiple files! Let's get our page updated with the help of Copilot Edits.
70
73
71
-
1. Open the following files to help Copilot Chat understand the context we need to use:
74
+
1. Open the following files in your IDE (which we'll point Copilot chat to for context):
72
75
-**server/app.py**
73
76
-**server/test_app.py**
74
77
-**client/src/components/DogList.svelte**
@@ -82,12 +85,18 @@ Adding the filters to the page will require updating a minimum of three files -
82
85
- Tests should be updated forany changes to the endpoint.
83
86
6. Review the code suggestions to ensure they behave the way you expect them to, making any necessary changes. Once you're satisfied, you can select **Keep** on the files individually or in Copilot Chat to accept all changes.
84
87
7. Open the page at [http://localhost:4321](http://localhost:4321) to see the updates!
85
-
8. Run the Python tests by using `python -m unittest`as you did previously.
88
+
8. Run the Python tests by using `python -m unittest`in the terminal as you did previously.
86
89
9. If any changes are needed, explain the required updates to GitHub Copilot and allow it to generate the new code.
87
90
88
91
> [!IMPORTANT]
89
92
> Working iteratively a normal aspect of coding with an AI pair programmer. You can always provide more context to ensure Copilot understands, make additional requests, or rephrase your original prompts.
90
93
91
94
## Summary and next steps
92
95
93
-
Congratulations! You've worked with GitHub Copilot to add new features to the website - the ability to filter the list of dogs. Let's close out by [creating a pull request with our new functionality](./7-git-flow.md)!
96
+
Congratulations! You've worked with GitHub Copilot to add new features to the website - the ability to filter the list of dogs. Let's close out by [creating a pull request with our new functionality](./7-git-flow.md)!
97
+
98
+
## Resources
99
+
100
+
- [Asking GitHub Copilot questions in your IDE](https://docs.github.com/en/copilot/using-github-copilot/copilot-chat/asking-github-copilot-questions-in-your-ide)
0 commit comments