You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Use CTRL+A to select all the content in the file
24
+
3. Type `/doc` to add comments
25
+
26
+
### Observations
27
+
28
+
A comment is created at the top of the file.
29
+
30
+
31
+
## Step 2: Use Copilot to explain some code
32
+
33
+
1. Open `CsvProcessor.cs` file
34
+
2. Select the two `import` lines towards the top of the file
35
+
3. Type `/explain`
36
+
37
+
### Observations
38
+
39
+
Copilot explains the purpose of the `import` statements -- a new keyword in C++ 20.
40
+
Copilot also provide additional hyperlinks at the end of the explanation
41
+
for further exploration.
42
+
43
+
## Step 3: Let Copilot generate code from a comment
44
+
45
+
1. Open `CsvProcessor.cs` file
46
+
2. At the top of the `main` function, place the cusor at the end of the line
47
+
that reads `//TODO3` and press ENTER
48
+
3. Press TAB to accept the suggestion from Copilot
49
+
50
+
51
+
### Observations
52
+
53
+
When you type comments before writing a section of code, Copilot can automatically
54
+
generate the code for you. If you like the suggestion, you can accept it by pressing TAB.
55
+
If not, keep typing and Copilot will continue to suggest code.
56
+
That way, Copilot integrates seemlessly with your workflow.
57
+
58
+
## Step 4: Add comments to a block of code
59
+
60
+
1. Open `CsvProcessor.cs` file
61
+
2. In the `main` function, select the entire `for` loop.
62
+
Hint: You can press the Down arrow in the margin to "roll in" the loop
63
+
in one line, then select the entire line
64
+
3. Tell Copilot to "add comments to the selected code"
65
+
66
+
### Observations
67
+
68
+
Copilot comments each meaningful block of code. This is a great way to
69
+
document existing code, or to help you understand code that you didn't write.
70
+
71
+
72
+
## Step 5: Create automated tests
73
+
74
+
1. Open the Test Explorer window by selecting the menu item `View` > `Test Explorer`
75
+
2. Run the tests by right-clicking on `LexerTest` and selecting `Run` in the context menu
76
+
3. Open `LexerTest.cpp` file 4. Uncomment the lines `TEST_METHOD(...)` one by one and press ENTER to let Copilot generate the test code for you 5. Compile with F6 and run all tests again6. Create additional test methods with meaningful names in order to guide Copilot
77
+
### Observations
78
+
79
+
Copilot generates the test code based on several assumptions. In most cases,
80
+
the generated test code passes. However, you may need to adjust the test code
81
+
for edge cases or to test specific scenarios.
82
+
83
+
## Step 6: Create more automated tests
84
+
85
+
1. Open the Test Explorer window by selecting the menu item `View` > `Test Explorer`
86
+
2. Run the tests by right-clicking on `ParserTest` and selecting `Run` in the context menu
87
+
3. Open `ParserTest.cpp` file 4. Uncomment the lines `TEST_METHOD(...)` one by one and press ENTER to let Copilot generate the test code for you 5. Compile with F6 and run all tests again6. Create additional test methods with meaningful names in order to guide Copilot
0 commit comments