Nice work! 🎉 You created a Codespace using a devcontainer file that installed Copilot!
GitHub Copilot provides suggestions for numerous languages and a wide variety of frameworks, but works especially well for Python, JavaScript, TypeScript, Ruby, Go, C# and C++. The following samples are in C#, but other languages will work similarly.
Let's try this out utilizing C# for Copilot.
Note: If you closed the Codespace from above, please open it back up or create a new Codespace.
Note: Make sure to open the Solution Explorer to see an organized view to easily add new projects and run them..
-
Create a new .NET project by using the
.NET: New Project...
command and selectingConsole App
. -
Select the code folder and name the project Skills.
-
Open
Program.cs
-
In the
Program.cs
file, remove any code and then type the following function header.void CalculateNumbers(int var1, int var2) {
GitHub Copilot will automatically suggest an entire function body in grayed text. Below is an example of what you'll most likely see, but the exact suggestion may vary.
-
Press
Tab
to accept the suggestion.
Let's use GitHub Copilot to summarize our changes and then commit the code.
- Open the Source Control tab
- Tap on the ✨ button in the Message entry for Copilot to generate your message.
- Click the Commit button.
Head to Part 3 of the Exercise