The latest release of the Visual Studio GitHub Copilot Chat Extension introduces two notable productivity features, slash commands and context variables. Additionally, developers can explore a couple of preview features like the Exception Assistant, Test failure Analysis, Suggestions for Breakpoint Expressions, Commit message suggestions and many more.
The first notable addition is the inclusion of slash commands, which are a set of specialized directives that developers can use within the chat interface to trigger specific actions related to the code. There are a couple of commands introduced, by utilizing /doc
, users can effortlessly add a documentation comment to the code.
Similarly, the /explain
command brings a detailed explanation of the code, while /fix
proposes solutions to identified issues within the selected code. Developers can also try /generate
to start Copilot to generate code addressing their queries, /help
to seek assistance within Copilot Chat, /optimize
to analyze and enhance the runtime of the selected code, and /tests
to generate unit tests for the chosen code.
(Usage of slash commands within Visual Studio text editor, Source: Microsoft Dev Blogs)
Additionally, the second notable feature added is the context variables feature which enables developers to easily include files from solutions to questions with the usage of the # symbol.
This feature allows Copilot to access the content of the referenced files and provide more targeted responses. For instance, developers can ask about the functionality of a specific file, for example, #Main.cs
, and receive relevant insights from Copilot Chat. With the note that multiple files can be included in a single question.
To view the referenced files in the chat, developers can check under the answers section, where links to the added files will be visible. Clicking on these links will redirect users to the included content, offering a convenient way to navigate and comprehend the referenced files.
In addition to the main features in the Visual Studio Copilot Chat release, several experimental preview features are also available. These features include the Exception Assistant in the debugger, providing information on exceptions, breakpoint expression suggestions for conditional breakpoints, and commit message generation to describe code changes.
Another notable preview feature is the Solution Reference, allowing users to locate and navigate references of code elements within their solution. By using the #solution directive, Copilot automatically includes relevant code in the context of the question.
The Suggestions in the Performance Profiler feature analyzes performance data collected by the Visual Studio Performance Profiler, showing insights to optimize code speed, memory usage, and responsiveness. Also, Copilot assists in debugging and fixing unit test failures through the Test Failure Analysis feature.
(Test failure Analysis, Source: Microsoft Dev Blogs)
For developers interested in activating these preview features, the process involves accessing Options, going to GitHub, and selecting Copilot Chat. In the Preview features section, developers can check the boxes corresponding to the features they wish to explore.
Community feedback on Visual Studio Copilot Chat is generally positive, with users praising features like #solution references. However, specific concerns include challenges with certain slash commands, like /doc for extensive code selections, and the generic nature of /explain. Users suggest customization options, such as choosing the language for commit messages. There's also a visionary suggestion for future enhancements, like monitoring abilities and emotional expressions.
Some users compare Copilot to other tools, emphasizing its value in inline suggestions but expressing consideration for tools with advanced features. Overall, the community feedback highlights both appreciation for existing functionalities and a desire for continuous improvement of the tool.
Lastly, for Visual Studio Copilot Chat usage developers should use Visual Studio 2022 version 17.8 or higher. Additionally, developers need to verify that the GitHub account signed into Visual Studio is associated with an active GitHub Copilot subscription.