Skip to content

Commit e2de7e3

Browse files
authored
Merge pull request #102 from tspascoal/add-doc-slash-add-endpoint
Add step to use doc slash command to document the newly added function in add endpoint module
2 parents 6c702b4 + 06c23eb commit e2de7e3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

content/1-hour/1-add-endpoint.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ Let's build our new route in our Flask backend with the help of code completion.
6868
> [!IMPORTANT]
6969
> Because LLMs are probabilistic, not deterministic, the exact code generated can vary. The above is a representative example. If your code is different, that's just fine as long as it works!
7070

71-
8. **Save** the file.
71+
8. Add a comment to the newly created function. To do this, place your cursor inside the function (anywhere between the lines `def get_breeds...` and `return jsonify...`). Then, press <kbd>Ctl</kbd>+<kbd>I</kbd> (or <kbd>cmd</kbd>+<kbd>I</kbd> on a Mac) to open the editor inline chat. In the input box, type `/doc`. (You can optionally provide additional details, but it's not required). This will prompt GitHub Copilot to generate a documentation comment for the function. The suggested comment will appear inline in the code (highlighted in green). Click **Accept** to apply the comment to your code, or click **Close** to discard the suggestion. You just used a slash command, a shortcut to streamline a task, these commands eliminate the need for verbose prompts.
72+
73+
9. **Save** the file.
7274

7375
## Validate the endpoint
7476

@@ -85,6 +87,7 @@ You've added a new endpoint with the help of GitHub Copilot! You saw how Copilot
8587
- [Code suggestions in your IDE with GitHub Copilot][copilot-suggestions]
8688
- [Code completions with GitHub Copilot in VS Code][vscode-copilot]
8789
- [Prompt crafting][prompt-crafting]
90+
- [Inline chat][inline-chat]
8891

8992

9093
| [← Workshop setup][walkthrough-previous] | [Next: Helping GitHub Copilot understand context →][walkthrough-next] |
@@ -96,6 +99,7 @@ You've added a new endpoint with the help of GitHub Copilot! You saw how Copilot
9699
[flask-routing]: https://flask.palletsprojects.com/en/stable/quickstart/#routing
97100
[http-methods]: https://www.w3schools.com/tags/ref_httpmethods.asp
98101
[prompt-crafting]: https://code.visualstudio.com/docs/copilot/prompt-crafting
102+
[inline-chat]: https://code.visualstudio.com/docs/copilot/chat/inline-chat
99103
[server-code]: /server/
100104
[vscode-copilot]: https://code.visualstudio.com/docs/copilot/ai-powered-suggestions
101105
[walkthrough-previous]: ./0-setup.md

0 commit comments

Comments
 (0)