Skip to content

Commit 5133b8c

Browse files
committed
updated exercise 2 - analyze and document
1 parent d2073ad commit 5133b8c

1 file changed

Lines changed: 22 additions & 36 deletions

File tree

Instructions/Labs/LAB_AK_02_analyze_document_code.md

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Use the following steps to set up the library application:
102102

103103
For example, in the SOLUTION EXPLORER view, right-click **AccelerateDevGHCopilot**, and then select **Build**.
104104

105-
You'll see some Warnings, but there shouldn't be any Errors.
105+
You may see some Warnings, but there shouldn't be any Errors.
106106
107107
## Use GitHub Copilot to explain the library application codebase
108108
@@ -112,9 +112,9 @@ GitHub Copilot can help you to understand an unfamiliar codebase by generating e
112112
113113
GitHub Copilot's Chat view includes a chat-based interface that allows you to interact with GitHub Copilot using natural language prompts. When evaluating an existing codebase for the first time, you can create prompts that generate an explanation at the workspace or project level, or at the code block or code line level. To assist you in specifying the context of your prompt, GitHub Copilot provides chat participants, chat variables, and slash commands.
114114

115-
- Chat participants are used to scope your prompt to a specific domain.
116-
- Chat variables are used to include specific context in your prompt.
117-
- Slash commands are used to avoid writing complex prompts for common scenarios.
115+
- Use chat participants in your prompts to invoke a domain-specific expert. Experts provide the most accurate responses.
116+
- Use chat variables in your prompts to include specific context. Context helps GitHub Copilot generate more relevant responses.
117+
- Use slash commands in your prompts to invoke specific actions or to set the intent of your prompt.
118118

119119
Use the following steps to complete this section of the exercise:
120120

@@ -124,25 +124,21 @@ Use the following steps to complete this section of the exercise:
124124
125125
To open the Chat view, select the **Toggle Chat** button at the top of the Visual Studio Code window.
126126
127-
![Screenshot showing the GitHub Copilot status menu.](./Media/m02-github-copilot-toggle-chat.png)
128-
129127
You can also open the Chat view using the **Ctrl+Alt+I** keyboard shortcut.
130128
131-
1. In the Chat view, enter a prompt that uses GitHub Copilot's **@workspace** Chat participant to generate a description of the project.
129+
1. In the Chat view, enter a prompt that uses the **#codebase** chat variable to include the full context of the codebase when generating a description of your code.
132130
133131
For example, enter the following prompt in the Chat view:
134132
135133
```plaintext
136-
@workspace describe this project
134+
#codebase describe this project
137135
```
138136
139-
Use Chat participants, such as the **@workspace**, to improve the responses generated by GitHub Copilot. Chat participants work like domain experts who can help you in their specialized areas. Use **@workspace** when you want GitHub Copilot to consider the structure of your project, how different parts of your code interact, or design patterns in your project.
140-
141-
To see a list of all available chat participants, type **@** in the chat prompt box.
137+
Use chat variables, such as **#codebase**, to include specific context in your prompt. Context helps GitHub Copilot generate more relevant responses.
142138
143139
1. Take a minute to compare GitHub Copilot's response with the actual project files.
144140

145-
You should see a response that describes each of the projects in the solution:
141+
You should see a response that describes all of the projects included in the solution:
146142

147143
- **Library.ApplicationCore**
148144
- **Library.Console**
@@ -151,39 +147,31 @@ Use the following steps to complete this section of the exercise:
151147

152148
1. Use the SOLUTION EXPLORER view to expand the project folders.
153149

154-
1. Locate and then open the **ConsoleApp.cs** file.
155-
156-
The ConsoleApp.cs file is located in the **src/Library.Console** folder.
157-
158-
1. Take a moment to review the code file.
150+
1. Take a moment to review the project files.
159151

160-
1. Enter a prompt in the Chat view that generates a description of the **ConsoleApp** class.
152+
1. Enter a prompt in the Chat view that asks how to publish your codebase to a private GitHub repository.
161153

162154
For example, enter the following prompt in the Chat view:
163155

164156
```plaintext
165-
@workspace #usages How is the ConsoleApp class used?
157+
@github #codebase What's the easiest way to publish my current codebase to a private GitHub repo from within Visual Studio Code?
166158
```
167159

168-
Use chat variables, such as **#usages**, to include specific context in your prompt. To see a list of the chat variables, type **#** in the chat prompt box.
160+
Use chat participants, such as **@github**, to assign a domain expert for your prompt. Domain experts help GitHub Copilot generate accurate responses.
169161

170162
> **NOTE**: GitHub Copilot considers your chat history and the code files you have open in Visual Studio Code when constructing a context for your prompt and generating a response.
171163

172-
1. Take a minute to verify the accuracy of GitHub Copilot's response.
173-
174-
You should see a response that the describes where the **ConsoleApp** class is defined and how it's used in the codebase. The ConsoleApp.cs and Program.cs files are referenced in the response, along with line numbers
175-
176164
1. Open the **Program.cs** file and examine the code.
177165

178166
1. Enter a prompt in the Chat view that generates an explanation of the Program.cs file.
179167

180168
For example, enter the following prompt in the Chat view:
181169

182170
```plaintext
183-
@workspace /explain Explain the Program.cs file
171+
/explain #codebase Explain the Program.cs file
184172
```
185173

186-
Use Slash commands, such as **/explain**, to avoid writing complex prompts for common scenarios. To see a list of all available slash commands, type **/** in the chat prompt box. Available slash commands may vary, depending on your environment and the context of your chat.
174+
Use slash commands, such as **/explain**, to specify the intent of your prompt. Communicating your intent helps GitHub Copilot understand the type of response that it needs to generate. The list of available slash commands may vary depending on your environment and the context of your chat.
187175

188176
1. Take a minute to review the detailed response generated by GitHub Copilot.
189177

@@ -193,28 +181,26 @@ Use the following steps to complete this section of the exercise:
193181

194182
### Improve chat responses by adding context
195183

196-
GitHub Copilot uses context to generate more relevant responses.
184+
GitHub Copilot uses context to generate relevant responses.
197185

198-
Opening files in the code editor is one way to establish context, but you can also add files to the Chat context using drag-and-drop operations or by using the **Attach Context** button in the Chat view.
186+
Opening files in the code editor is one way to establish context, but you can also add files to the Chat context using drag-and-drop operations or by using the **Add Context** button in the Chat view.
199187

200188
Use the following steps to complete this section of the exercise:
201189

202190
1. Expand the **Library.Infrastructure** project, and then expand the **Data** folder.
203191

204192
1. Use a drag-and-drop operation to add the following files from the SOLUTION EXPLORER view to the Chat context: **JsonData.cs**, **JsonLoanRepository.cs**, and **JsonPatronRepository.cs**.
205193

206-
GitHub Copilot uses the Chat Context to understand the code files that are relevant to your prompt. You can add files to the Chat context using drag-and-drop operations, or you can use the **Attach Context** button in the Chat view.
207-
208-
Instead of adding individual files manually, you can let Copilot find the right files from your codebase automatically. This can be useful when you don't know which files are relevant to your question.
194+
GitHub Copilot uses the Chat context to understand the code files that are relevant to your prompt. You can add files to the Chat context using drag-and-drop operations, or you can use the **Add Context** button in the Chat view.
209195

210-
To let Copilot find the right files automatically, add #codebase in your prompt or select Codebase from the list of context types.
196+
Instead of adding individual files manually, you can let Copilot find the right files from your codebase. This approach can be useful when you don't know which files are relevant to your question, but it does slow down the response time. To let Copilot find the right files automatically, add #codebase in your prompt.
211197
212198
1. Enter a prompt in the Chat view that generates an explanation of the data access classes.
213199
214200
For example, enter the following prompt in the Chat view:
215201
216202
```plaintext
217-
@workspace /explain Explain how the data access classes work
203+
/explain Explain how the data access classes work
218204
```
219205
220206
1. Take a couple minutes to read through the response.
@@ -237,7 +223,7 @@ Use the following steps to complete this section of the exercise:
237223
238224
1. Ensure that you have the **Solution Explorer** view open.
239225
240-
The Solution Explorer view is not the same as the Explorer view. The Solution Explorer view uses project and solution files as "directory" nodes to display the structure of the solution.
226+
The Solution Explorer is a dedicated view added to Visual Studio Code's primary sidebar by the C# Dev Kit extension. It provides a structured, solution-centric view of your .NET application that's similar to the Solution Explorer in the Visual Studio IDE. It's more informative and organized than the plain folder/file tree that the built-in Explorer view.
241227

242228
1. To run the application, right-click **Library.Console**, select **Debug**, and then select **Start New Instance**.
243229

@@ -302,13 +288,13 @@ Use the following steps to complete this section of the exercise:
302288

303289
1. Add a new file named **README.md** to the root folder of the **AccelerateDevGHCopilot** solution.
304290

305-
1. Open the Chat view.
291+
1. Open the Chat view, and select the **Ask** agent mode.
306292

307293
1. To generate project documentation for your README file, enter the following prompt:
308294

309295
```plaintext
310296
311-
@workspace Generate the contents of a README.md file for a code repository. Use "Library App" as the project title. The README file should include the following sections: Description, Project Structure, Key Classes and Interfaces, Usage, License. Format all sections as raw markdown. Use a bullet list with indents to represent the project structure. Do not include ".gitignore" or the ".github", "bin", and "obj" folders.
297+
#codebase I need you to generate the contents of a README.md file that I can use for the current code repository. Use "Library App" as the project title. The README file should include the following sections: Description, Project Structure, Key Classes and Interfaces, Usage, License. Format all sections as raw markdown. Use a bullet list with indents to represent the project structure. Do not include ".gitignore" or the ".github", "bin", and "obj" folders. I want add the suggested content to the README.md file that's open in the editor.
312298
313299
```
314300

0 commit comments

Comments
 (0)