Naming Made Easy: AI-Powered Rename Suggestions
Ever struggled to name a variable, method, or class—finding that perfect balance between expressiveness and conciseness? You’re not alone. We’ve tackled this universal challenge in the latest Visual Studio Preview via our GitHub Copilot Chat extension (subscription required). Introducing: AI-powered rename suggestions. This feature doesn’t just suggest names; it learns how your identifier is used and your code style to propose identifiers that seamlessly fit into your codebase. It’s like having a dedicated naming expert by your side, enhancing your code while keeping you in the coding flow.
The Power of AI in Naming
Our new feature utilizes AI to analyze your identifier’s current usage and the code’s naming style. By understanding how identifiers are used within your code, it generates a range of expressive name suggestions. Our goal is to help you improve the readability and maintainability of your code, ensuring its longevity and ease of comprehension for years to come.
How It Works
In Visual Studio, simply select any identifier, right-click, and choose Rename (Ctrl+R, Ctrl+R). Click on the rename suggestions button or use the Ctrl+Space shortcut. You will be presented with a list of naming suggestions tailored to the context of your code. Pick the name you like best and press Enter.
Try it out!
This feature uses GitHub Copilot to analyze the code and generate the renaming suggestions. You’ll need an active GitHub Copilot subscription. Ensure you are using Visual Studio 2022 17.9 Preview 3 and update the GitHub Copilot Chat Extension (if it’s already installed). Enable this feature by going to Options > GitHub > Copilot chat > and check the “Enable rename suggestions” option.
Your Feedback Matters
We’d love to hear your thoughts on how this feature impacts your coding workflow. Your feedback is instrumental as we continue to improve the feature and quality of the renaming suggestions provided. Please share your thoughts with us!
We appreciate the time you’ve spent reporting issues/suggestions and hope you continue to give us feedback when using Visual Studio on what you like and what we can improve. Your feedback is critical to help us make Visual Studio the best tool it can be! You can share feedback with us via Developer Community: report any bugs or issues via report a problem and share your suggestions for new features or improvements to existing ones.