Making repeated edits easier with IntelliCode suggestions

Peter Groenewegen

What if your developer tools could track your edits and learn while you are making changes? What if they could offer to do remaining edits for you?

Your repeated edit experience is now enhanced by IntelliCode suggestions in Visual Studio 2019 16.7. IntelliCode spots repetitions and suggests other places in your code where you could apply that same change.


Try it now

IntelliCode suggestions is available for C# from Visual Studio 2019 16.7. Check out the release notes for all the details. 

How it works

Under the hood, IntelliCode looks at each of your edits as you type. Using PROSE (PROgram Synthesis by Example), IntelliCode synthesizes generalized edit scripts that take your code from the “before editing” state to the “after”. When IntelliCode suggestions discovers that it can apply one of these scripts in your code, IntelliCode lets you know via the Visual Studio lightbulb in the margin and when you hover over the affected code. In both the lightbulb and by hovering over the affected code, IntelliCode offers actions to apply the suggestion for you. The underlying technology is like the Excel’s Flash Fill feature and is described in this research paper.

This is not just tracking text changes – IntelliCode is aware of the syntactic structure of your code. Syntactic awareness allows IntelliCode to detect cases where the variable names in your refactoring examples differ, but the essential structure of the change is the same.

If you do not like a suggested change you can select the ignore option on the lightbulb, and we will not bother you about that detected pattern again.

Let us know what you think!

We would love to hear about your experiences as you try this new feature. Your feedback, good or bad, will help us improve. Please raise issues Visual Studio “report a problem”.