From the course: AI-Powered Development: GitHub Copilot in Visual Studio

Chat mode in Copilot: Quick review

- [Instructor] Now it's time to see custom instructions and prompt files and actions. But first, a word about this chapter's project and repository. To understand why a different repository is needed, let's start with where custom instructions are stored. The hell's going on? Ugh, stone damn it. I hate this thing. Code completions give us quick suggestions. The chat window gives us a conversation, one that understands our code and helps us think through it. The Copilot chat window lets us ask questions about our code base, understand the underlying logic, and solve problems with full context. Like any chat tool powered by a large language model, Copilot chat understands natural human speech and responds with fluent human-like conversation. But here's the difference. This conversation is grounded in code. It is a dialogue that's anchored to your project, your files, and your programming goals. And it doesn't just talk about code, it shows it. Copilot outputs clean, formatted code snippets directly in the chat window. You can copy them with a click, drop them into your editor, and keep building. It's conversational, but it's also actionable. There's plenty to discover when working in the Copilot chat window. We'll start with the basics, how to interact with Copilot chat and what it can do. Copilot chat lets us switch between different language models, depending on the coding needs. It's a simple dropdown in the chat window, but it can make a big difference in how your prompts are interpreted. Copilot chat doesn't just respond to your words. It can shape its response based on your code. We can guide Copilot by referencing specific files, or methods, or even the entire workspace. This context helps Copilot generate answers that are accurate, relevant, and centered on your actual code base. Copilot chat isn't one size fits all. You can customize how it responds. With custom instructions, you can tailor Copilot's tone, level of detail, and even its coding preferences to match your style. Whether you prefer concise answers, verbose explanations, or specific frameworks, these settings help Copilot feel like it's working just for you. Prompt files are a powerful way to turn your best prompts into repeatable tools. You can create reusable, shareable templates that guide Copilot with consistent instructions, perfect for team standards, onboarding, or reoccurring tasks. So here's the scoop. Custom instructions shape the overall behavior while prompt files standardize a list of reusable actions. Finally, we have slash commands, text-based triggers that execute predefined actions directly within Copilot chat. Copilot has its own set of slash commands designed for coding tasks. For example, you can use /explain to get a plain text language explanation of the selected code, or /refactor to ask Copilot to clean up and improve your logic. We'll explore some of these commands throughout the chapter. To summarize, Copilot chat gives us more than answers, it gives us control. From slash commands and model switching to prompt files and custom instructions, we can shape how chat works for us. Now it's time to get chatting. Let's put these tools to work.

Contents