|
| 1 | +<!-- |
| 2 | + <<< Author notes: Step 3 >>> |
| 3 | + Start this step by acknowledging the previous step. |
| 4 | + Define terms and link to docs.github.com. |
| 5 | +--> |
| 6 | + |
| 7 | +## Step 3: View the GitHub Copilot tab with multiple suggestions |
| 8 | + |
| 9 | +_Nice work! You just used AI code suggestions within a C# file by using GitHub Copilot :sparkles:_ |
| 10 | + |
| 11 | +Keep in mind that as you continue to use copilot, you may not want some of the suggestions GitHub Copilot offers. GitHub Copilot will show you multiple suggestions in a new tab. |
| 12 | + |
| 13 | +### :keyboard: Activity: Pull the latest code to the Codespace repo. |
| 14 | + |
| 15 | +> **Note** |
| 16 | +> Pull MUST be done prior to the next activity. |
| 17 | +
|
| 18 | +1. Use the VS Code terminal to pull the latest code: |
| 19 | + |
| 20 | + ``` |
| 21 | + git pull |
| 22 | + ``` |
| 23 | + |
| 24 | +### :keyboard: Activity: Add another C# method and view all suggestions |
| 25 | + |
| 26 | +1. From inside the codespace in the Solution Explorer, right click on the project, create a new file. |
| 27 | + |
| 28 | +> Note: If you closed the Codespace from above please open it back up or create a new Codespace. |
| 29 | +
|
| 30 | +2. Select **Class** and name the file `Members.cs` |
| 31 | +3. In the `Members.cs` file, type the following function inside of the `Member` class. |
| 32 | + ``` |
| 33 | + public strin |
| 34 | + ``` |
| 35 | +4. Stop typing and view the Copilot suggestion by hovering over end the red squiggly grat text and select the `...` |
| 36 | +5. Click `Open Completions Panel`. |
| 37 | + |
| 38 | + > **Note** |
| 39 | + > If you don't see the copilot code block suggestion or the red squiggly and the three dots `...`, you can type `control + enter` to bring up the GitHub Copilot completions panel. |
| 40 | +
|
| 41 | +6. Copilot will synthesize around 10 different code suggestions or press CTRL+Enter. You should see something like this: |
| 42 | +  |
| 43 | +7. Find a solution you like and click `Accept Solution`. |
| 44 | +8. Your `Member.cs` file will be updated with your solution. |
| 45 | + |
| 46 | +### :keyboard: Activity: Push code to your repository from the codespace |
| 47 | + |
| 48 | +1. Use the VS Code terminal to add the `Member.cs` file to the repository: |
| 49 | + |
| 50 | + ``` |
| 51 | + git add Member.cs |
| 52 | + ``` |
| 53 | + |
| 54 | +2. Next from the VS Code terminal stage and commit the changes to the repository: |
| 55 | + |
| 56 | + ``` |
| 57 | + git commit -m "Copilot second commit" |
| 58 | + ``` |
| 59 | + |
| 60 | +3. Finally from the VS Code terminal push to code to the repository: |
| 61 | + |
| 62 | + ``` |
| 63 | + git push |
| 64 | + ``` |
| 65 | + |
| 66 | +**Wait about 60 seconds then refresh your repository landing page for the next step.** |
0 commit comments