Use AI-Powered Rename Suggestions to rename your C++ variables in Visual Studio

Sinem Akinci

We are very excited to announce C++ support for AI-Powered Rename Suggestions from GitHub Copilot in Visual Studio 2022. Seamlessly integrated into your familiar Rename workflow in the IDE, AI-powered rename suggestions dynamically generate name suggestions for any C++ identifier. It will generate proposed names based on its usage and your code’s style to help you strike a balance between describing the variable with appropriate descriptive qualities while remaining concise. Instead of spending time brainstorming new names, you can focus on reviewing the variable names generated by Copilot to determine the appropriate new name that describes the identifier.

AI-Powered rename suggestions suggesting more appropriate qualifiers for a vague variable named "property"

To enable AI-powered rename suggestions for C++, you’ll need at least Visual Studio 2022 version 17.10 Preview 1 installed, the GitHub Copilot and Copilot Chat extensions installed, and an active subscription to GitHub Copilot.

Note that as of Visual Studio 2022 17.10 Preview 3, these extensions are unified as one GitHub Copilot extension and automatically included with Visual Studio as a recommended component.

You can toggle the visibility of this feature via Tools > Options under GitHub > Copilot chat Preview features.

The Options for GitHub > Copilot chat preview features to enable rename suggestionsHow to use AI-Powered Rename Suggestions

To access this feature, right-click any variable and select Rename. To the right of the familiar Rename dialog, you’ll see a new sparkle icon to call for AI-powered rename suggestions.

Request AI-generated rename suggestions icon in the rename dialog highlightedCopilot chat will be invoked on this symbol to generate suggestions for what to rename the identifier to, based on its usage in the code and the code’s naming conventions.

A dropdown list containing the generated rename suggestions.What do you think?

Try out the new AI-powered rename suggestions whenever you need to rename C++ symbols. Please share your thoughts on this experience with C++ in the survey below, as we look to improve this feature:

In addition, our team is working hard on improving C++ integrations with Copilot Chat, so please let us know any other improvements you’d like to see to your C++ workflows and content you’d like to see.

We welcome all types of feedback on your experience with the product. Comment below or you can find us via email at visualcpp@microsoft.com or via X at @VisualC

 

0 comments

Leave a comment

Feedback usabilla icon