As a developer you make repetitive changes to your code all the time. In many cases you don’t even realize that you are doing a repetitive task or that Visual Studio IntelliCode suggestions can help you. IntelliCode suggestions can already do the edit and find other locations where the same edit applies, making your life easier! But now, in Visual Studio 16.9 you can easily apply suggestions in a frictionless way all without breaking your editing flow. You can find IntelliCode suggestions right in your IntelliSense completion list, and can find and apply the same change at other locations.
Completion list: how it works:
IntelliCode suggestions in the completion list blends naturally into your editing flow. The edit is added to the completion list in a non intrusive way. Now it is easy to find, and non-intrusively perform the repeated action. You can recognize the suggestion is coming from IntelliCode by the icon and star.
Follow-up after apply
After you have applied an IntelliCode suggestion, if there are more locations the same edit would apply, IntelliCode shows a lightbulb to help you follow up. The lightbulb has actions to enable you to do the same edit at other locations.
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”. The underlying technology is like the Excel’s Flash Fill feature and is described in this research paper.
New in preview: key bindings
Many of you prefer to work from the keyboard. IntelliCode suggestions now has key bindings for all the common actions in preview. Ctrl+Alt-. to apply directly, Ctrl+Alt-, to go to the next suggestion and Ctrl+Alt+/ will toggle an inline preview if there is a suggestion on the current line.
You can help us to perfect the key bindings preview feature – enable it in Visual Studio 16.9 by setting Options->IntelliCode->Preview section-> Suggestions key bindings to Enabled, try it out and send us feedback!
Putting it all together
Check out the video below to see how this works end-to-end:
this comment has been deleted.
I have seen options for IntelliCode in C++, you can check those out by going to Options > IntelliCode > General. Ensure that you have the most recent version of Visual Studio 2019 installed.
Thank you for the feedback, IntelliCode suggestions is currently not available for C++. We have other languages under consideration and noted your comment. For C++ we offer currently IntelliCode IntelliSense completions based on common usage and you can train models on your own code base.
this comment has been deleted.
this comment has been deleted.
Thanks for the feedback, from usage numbers we know it is especially useful for language constructs. Imagine in you are changing a property or number of parameters of a method. You probably use the construct multiple times in your code at different locations. After doing the change twice we help you at the next locations. By looking at the changes you do to the syntax tree we can predict the probably changes you are about...