Working efficiently with Copilot
1. Working efficiently with Copilot
You've seen how to prompt Copilot, guide it with context, and use it across different interfaces. Now let's build on that with a couple of features to work more efficiently.2. Slash commands: predefined actions
Sometimes, you don't need to write a detailed prompt—you just want Copilot to take a specific action. That's where slash commands come in.3. Slash commands: predefined actions
Just type a slash (/) in the chat to trigger quick, predefined actions.4. Slash commands in action
Let's say you're looking at a function that's throwing an error. You highlight the block and type: /fix Copilot will analyze the code and suggest a fix, without you providing extra instructions. Or maybe you're reviewing a file and want a plain-English summary of what it does. Just type: /explain, and Copilot will break it down for you.5. Other slash command examples
You can also use slash commands to: Generate tests with /tests, scaffold a new project with /new, or even reset the chat with /clear. They're handy when you know what you want and just need Copilot to execute.6. Smart actions: AI-powered suggestions
Now, what if Copilot could anticipate what you need? That's what smart actions do in Visual Studio Code.7. Smart actions: AI-powered suggestions
These AI-powered suggestions appear in the editor as you write, review, or refactor code.8. Smart actions: AI-powered suggestions
You'll spot them as a sparkle icon or a light bulb next to your code.9. Smart actions in action
For example, let's say you highlight a function. A sparkle icon appears—click it, and you'll see options like "Modify" or "Review". The first opens the inline chat, but the second creates review comments in the Comments panel and shows them inline in the editor. Here's another example: You notice a variable is underlined with a yellow squiggly. You click it, and a light bulb icon appears, offering a list of suggestions. Among them are "Fix" and "Explain." Click on any of them, and Copilot will analyze the issue and suggest a code fix or explain the problem right in context—no prompt is needed. Or imagine you've just staged some code changes. Instead of writing a commit message from scratch, click the sparkle icon in the Source Control view. Copilot will summarize your changes into a descriptive message, ready to go! These are just some examples of the many smart actions Visual Studio Code includes.10. Getting more out of Copilot
And there you have it! These tools don't replace the prompting techniques you've already learned—they build on them.11. Getting more out of Copilot
Think of slash commands as shortcuts: when you know what you need, they get it done fast.12. Getting more out of Copilot
And think of smart actions as helpful nudges: they surface options when you potentially need them.13. Getting more out of Copilot
Together, they help you work faster,14. Getting more out of Copilot
stay in flow, and get more out of Copilot.15. Let's practice!
Next, you'll evaluate your knowledge!Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.