The AskVS command in GitHub Copilot for Visual Studio
GitHub Copilot is a coding assistant powered by Artificial Intelligence (AI), which can run in various environments and help you be more efficient in your daily coding tasks. In this new series of content, we will show you how GitHub Copilot works in Visual Studio specifically and how it helps you being more productive.
The new short video I just published concentrates on one specific command you can use in GitHub Copilot for Visual Studio: The AskVS command. As for the 3 previous videos in this series, my colleague Bruno Capuano is showing you how this works.
The AskVS command
In the example, Bruno selected a piece of code and then typed the following command in the GitHub Copilot Chat window:
At this point, some auto-replace is happening: The / command opens the Slash command menu, in which Bruno selected the AskVS command. Then typing the # character opens another menu in which Bruno can select the lines that he selected in the file. Note that in this menu, he could also select another context, for example another code file.
Continuing to type the command, we now have:
This instructs Copilot to refactor the lines 25-32 in the CustomChatCompletionService.cs file.
The result
As a result, Copilot will propose the new code in a dialog with a preview button, like we saw a few times in previous videos. It will also propose code showing how to call the newly created function.
Getting more information from AskVS
The AskVS command can also be used to get more information about Visual Studio functionalities and settings. In the video. Bruno uses this to ask Copilot how to change from light theme to dark theme. As a result, Copilot lists all the steps, and even provides hyperlinks leading directly to the dialogs in Visual Studio that are used to perform the change.
More information
More slash commands are available as we saw in the previous videos. You can see the full length video here. For more information, check our collection with resources here. Stay tuned to this blog for more content posted regularly. And of course you can also subscribe to our YouTube channel to get more video content!
Published on:
Learn more