← Copilot Instructions | Next: README and Extensions → |
---|
So far, we've been using Copilot Chat in the chat pane. But you can also use inline chat to stay in the flow by having access to chat directly in the editor.
Note
When you're in the editor pane, you can use the shortcut:
- macOS: CMD + I
- Windows / Linux: CTRL + I
You can even perform common tasks using slash commands. Think of slash commands as convenient shortcuts for tasks that developers frequently complete.
Tip
You can use slash commands in the Copilot Chat pane too! We'll see that in a moment. Be aware that the available slash commands differ between the inline chat and the chat pane.
Scroll to the countNeighbors
method (or any method which is a little hard to
understand). In our countNeighbors
example, the code isn't immediately
clear as there are several single letter variables and a few nested loops.
Use the shortcut to open inline chat.
Enter the following prompt:
/doc Please update this method's description. The logic is unclear to me.
Copilot should suggest an updated JSDoc comment for the method, with a more detailed description of the logic. It might include some new terms, such as a Torus or a Toroidal Array/Grid. Review the suggested JSDoc comment and accept it if it makes sense.
Select the entire method, including the new JSDoc comment that you just
accepted. Navigate to the chat pane (you may need to switch from Copilot
Edits) and use /explain
to get a detailed explanation of the code in
plain English.
Tip
You can run the /explain
slash command in the inline chat or in the
Copilot Chat pane, so we'll leave this as an exercise for you to try!
In this section we learned about inline chat and slash commands. Take some time to explore these commands and see how they can help improve your development workflow.
Next, we'll create a README and explore Copilot Extensions.
← Copilot Instructions | Next: README and Extensions → |
---|