Simplified Code Refinement and Debugging with GitHub Copilot Chat
This March, we announced GitHub Copilot chat for Visual Studio 2022. With Chat, Copilot has moved beyond code completions, offering in-depth analysis and explanations of how code works. It supports the generation of unit tests, and even helps with proposed fixes to bugs, and explaining exceptions. By gathering useful context data from Visual Studio, Copilot Chat helps you form great questions to get useful answers. Using GitHub Copilot with Visual Studio gives you more time for creativity by spending less time on boilerplate manual tasks and diagnosis.
Now, we’ve taken deep integration with Visual Studio a step further. Using the Interactive Code Assistant view, you can seamlessly refine your code with Copilot Chat, without ever needing to leave the comfort of your editor window. Your workflow is uninterrupted – no more going back and forth to the chat window! Get started using “ask Copilot” wherever in your code file you want to work – ask your questions and see answers inline with the code they relate to. Whenever Copilot suggests code changes, you’ll see your code side by side with Copilot’s suggestion – the normal Visual Studio diff view pattern – to help you thoroughly review, correct and refine what is being proposed at your own pace before applying to your code. We’ve taken care to make sure you are always in the driver’s seat, with complete control throughout the process.
Check out the video below to see how Copilot’s Interactive Code Assistant works:
Enhanced diagnostics with Copilot
The team’s also been hard at work bringing Copilot Chat to your fingertips in more places when you are debugging in Visual Studio. The three features below illustrate some of that work:
CPU Usage auto insights in the profiler
A profiler can help you make informed decisions quickly by providing a visual depiction of execution times and CPU usage for your application. Copilot now gives you detailed information via CPU Usage auto insights. It now provides more detailed information and insights for specific methods and properties, including Enum.HasFlag, Enum.ToString, String.StartsWith, ConcurrentDictionary.Count and more. With Copilot, you can ask questions about functions on the identified hot paths in your code, which can help you produce more efficient or cost-effective code. Just click “Ask Copilot” to start exploring.
Copilot Exception Helper
Copilot can provide you with meaningful help when you are debugging your code. For example, when an exception is thrown, it gives you the opportunity to start asking questions. Copilot has access to exceptions, call stack, local variables, and code. By forming good questions based on the right parts of the data Visual Studio has when you’re at an exception, Copilot Chat can provide useful insights and fixes for the issue.
See how this works in this video
Debugger “Rubber Ducking”
Copilot can now understand call stacks, frames, variable names, and values. This means you can pose detailed questions to a debugger-aware Copilot.
Check out the video below to see how this works:
How can I get these Copilot Chat preview features?
All Copilot for Individuals users now have access to the GitHub Copilot Chat preview for Visual Studio! See Shuyin Zhao’s blog post for more details. If you are already a user of Copilot for Individuals, just get the latest version of the extension to see the new features.
We want to hear from you!
We’re really grateful for all the feedback you’ve provided so far as we’ve been creating Copilot Chat, and excited to see where this next wave of AI-assisted productivity takes you as you create great software. Please try the new features and share your feedback – just use Visual Studio “Report a Problem” to send us your suggestions, feedback and issues for GitHub Copilot Chat in Visual Studio.