Issue #47 (Refactoring & Code Action Lightbulb)03/15/23
The refactoring features in VS Code are definitely something you'll want to be familiar with, if you've not already checked them out.
VS Code includes built-in refactoring suggestions for JavaScript and TypeScript and refactoring for other languages can be enabled via extensions.
By default refactor suggestions are instantly visible by means of the Code Action Lightbulb feature, shown in the image below.
It will appear if you select some code, and it will also show up as a blue lightbulb if you're cursor is on a line that could use a 'preferred quick fix'.
If, however, you don't like seeing the lightbulbs when writing code, but would rather choose when to initiate the suggestions, you can disable the feature. Search for "lightbulb" in your settings and uncheck the
Editor - Lightbulb option.
With the option disabled, you can still access the same refactor suggestions
by right-clicking on any line of code, or on any selected section of code. In the context menu, choose "Refactor..." and you'll see options like what's shown in the image below.
Notice the different "Surround with" options that include some built-in selections along with the ability to "Surround with" one of your own code snippets. These are the same options available by directly clicking the lightbulb when the lightbulb feature is enabled.
For more details on refactoring in VS Code, check
this article in the official documentation.