2

Exploring the AskVS command in GitHub Copilot for Visual Studio

 1 week ago
source link: https://devblogs.microsoft.com/visualstudio/exploring-the-askvs-command-in-github-copilot-for-visual-studio/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Exploring the AskVS command in GitHub Copilot for Visual Studio

OIP-96x96.jpeg

Cynthia Zanoni

IMG_20201023_103247_900-96x96.jpg

Laurent Bugnion

April 23rd, 2024 0

Image the askvs command github copilot

GitHub Copilot is an AI-driven coding assistant designed to streamline your coding tasks and boost productivity in various development environments. In this ongoing series, we focus on its integration with Visual Studio, illustrating how it can significantly enhance your workflow and coding experience.

The latest short video I just published focuses on a specific command in GitHub Copilot for Visual Studio: the AskVS command.

The AskVS command

In the example from the video, Bruno selects a block of code and then opens the GitHub Copilot Chat window, where he enters the following command:

/AskVS refactor the #

This command triggers a series of helpful auto-completions. The initial / invokes the Slash command menu, allowing Bruno to choose the AskVS option. When he types #, another menu appears, enabling him to select the specific lines of code he previously highlighted. This approach also allows for flexibility, as you can select other context options, like different files or scopes.

Continuing with the command, the updated instruction is:

askvs refactor the CustomChatCompletionService.cs:25-32 to a new function

By issuing this command, GitHub Copilot receives a clear directive to refactor lines 25-32 within the specified file.

GitHub Copilot’s Response

After running the command, GitHub Copilot presents the refactored code in a dialog, complete with a preview button. This feature lets you review the proposed changes before applying them, ensuring you’re comfortable with the modifications. Additionally, Copilot might suggest related code, like helper functions or code snippets demonstrating how to utilize the new code structure.

GitHub Copilot AskVS

GitHub Copilot’s Response to AskVS command

Exploring AskVS for More Insights

The AskVS command has broader applications beyond refactoring. In the video, Bruno asks Copilot how to switch from the light theme to the dark theme in Visual Studio. In response, Copilot outlines the steps to change themes and includes hyperlinks to the specific Visual Studio dialogs where these changes occur.

Conclusion

GitHub Copilot offers more slash commands and features, as demonstrated in previous videos. To explore these further, you can view the full-length video here. For additional resources, check our curated collection here.

Additional Resources:

Cynthia Zanoni Cloud Advocate, Developer Relations

Follow

Laurent Bugnion Principal Cloud Advocate, Developer Relations

Follow


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK