This tour showcases essential Copilot features by leveraging a small React Calculator App.
Note: Make sure you installed the NPM components and started the App
- Situation: The React App does not use the
calculator
component!-
Remember to start the App:
npm install npm start
-
Open Browser (use port 3000)
-
- After starting the App, you may not see the
calculator
component. Let's try to add it. - Based on the file context, Copilot might already suggest the right thing.
- Click
Tab
to accept the suggestion.
- Give Copilot time to present you with a suggestion.
- Optional: If Copilot does not produce satisfying results, try using Copilot Chat.
- With the correct suggestion
(<Calculator />)
, you should now see the calculator in the App.
- Situation: The calculator does not calculate.
(Control^
+ Enter
)
- Note: Try not to use the 'Inline suggestions' (as they are still showing up).
- Give Copilot time to present you with suggestions.
- Choose one of the suggestions by clicking the
'Accept Solution'
link. - Optional: If Copilot does not produce satisfying results, try using Copilot Chat.
- Test the calculator in the browser (http://localhost:3000).
- Situation: Try to add an 'About' link to the header
-
Sample
<a href="#" className="Header-link"> About <a>
Note: this code is broken, we will use Copilot to fix it.
-
You should see the IDE giving you a syntax error.
-
Situation: Use Copilot to fix the Error
- line 24-26 (the previously inserted code)
2. You should see a lightbulb, click that and select the Fix using Copilot
option. Copilot should suggest a code fix for you!
- Optional: If Copilot does not produce satisfying results, try using Copilot Chat and use the command
/fix
(using the highlighted code). The fix that Copilt chat suggests can be added by clicking "Insert at Cursor", which will replace the existing (bad) code.
- Situation: Try using Copilot to
Explain the Code
- You should see a little lightbulb, click that and select
Explain using Copilot
. - Optional: If Copilot does not produce satisfying results, try using Copilot Chat and use the command
/explain
(using the highlighted code). Copilot Chat will give a detailed description of the highlighted code.
This concludes the GitHub Copilot operations demo!