In this section, you'll learn how to reference existing code files in your chat conversations.
-
[] Open the Products.razor again from the Store project.
-
[] Ensure that GitHub Copilto Chat is open by clicking on the Github Copilot Chat in the top-right corner of Visual Studio and select Open Chat Window or press
Ctrl+\+Cif Copilot chat isn't open. -
Change the mode to
Ask -
Start a new chat by clicking the
+icon in the top right corner of the chat window. -
[] Type:
#ProductService.csto reference the ProductService file. -
[] Ask:
How would I implement getting and visualizing the products in a table using the code in #ProductService and the css required. -
[] Review the code suggestion but don't implement it yet.
-
[] Notice how Copilot can reference existing code to provide contextual suggestions.
Key Takeaway: Referencing files in your chat provides Copilot with the context it needs to give more accurate, project-specific suggestions.
Back: Part 02 - Enhancing UI with Inline Chat | Next: Part 04 - Using Custom Instructions


