AI Does The Difficult Job Of Naming Variables
Written by Kay Ewbank   
Wednesday, 10 January 2024

Microsoft has updated its Copilot extension for Visual Studio to add renaming suggestions based on AI. Is this a feature we'll rush to adopt?

Announcing the update on the Visual Studio developers blog, Dalia Abo Sheasha said:

"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 new feature uses AI to analyze your identifier's current usage and the code's naming style. It then comes up with a range of expressive name suggestions. Yes, we've all been there on a bad day, though some of our name suggestions are more to do with alternative names for the pointy headed manager.

Microsoft's tool is more focused, with the aim of helping:

"improve the readability and maintainability of your code, ensuring its longevity and ease of comprehension for years to come."

The way it works is that you just select any identifier, right-click, and choose Rename. The tool will come up with a list of naming suggestions tailored to the context of your code.

Renaming in Visual Studio

To try out the feature you'll need an active GitHub Copilot subscription. Update the GitHub Copilot Chat Extension and enable the renaming feature from Options, GitHub, Copilot chat,  “Enable rename suggestions”.

Of course, those older developers among us (speak for yourself (Ed)), can remember the delights of code where the original developer had chosen to name everything randomly, such as the program where all the variables were named after racehorses. While that's an outlier, I have some nostalgia for those old Fortran programs where everything was I, J, K etc. to save on memory. After all, where's the fun in leaving your successors big clues as to what a variable is doing?

More seriously, it's tricky sometimes to think up something meaningful when you're creating the procedure. Would having help from Copilot be a good idea? Your answer is probably age related. While the results of the 2023 Stack Overflow Survey revealed that 77% of respondents are favourable towards using AI tools as part of their development workflow there is a clear correlation with experience - the longer your experience as a professional developer the less likely you are to be interested in using AI tools.


More Information

GitHub Copilot Chat Extension

Related Articles

Microsoft Adds Copilot Key To Windows  

Microsoft Announces New Tools at Ignite

Developers Positive About Using AI Tools

GitHub Sees Exponential Rise In AI

Copilot Chat Improves Confidence and Enjoyment

What Devs Think About AI

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


Actionforge Releases GitHub Actions VSCode Extension

Actionforge has released the beta of its GitHub Actions tool as a VS Code extension. The extension consists of a suite of tools making up a visual node system for building and managing GitHub Actions  [ ... ]

Java Version 22 Released

JDK 22 is not a Long Term Support release, but is one of the regular releases that are scheduled to arrive every six months. Still, it has got a lot to show for itself.

More News

raspberry pi books



or email your comment to:

Last Updated ( Wednesday, 10 January 2024 )