Issue #72 (Rename Symbol Command)09/06/23
Learn AI in 5 Minutes a Day
We'll teach you how to save time and earn more with AI. Join 70,000+ free daily readers for trending tools, productivity-boosting prompts, the latest news, and more.
|
|
|
VS Code has a bunch of refactoring features that are described in detail in the
Refactoring article in the VS Code docs, which I've discussed briefly before.
One particular refactoring-related feature is VS Code's Rename Symbol command, which is accessible by hitting F2 on your keyboard. This is a useful shortcut for Windows users because F2 is the universal shortcut for renaming.
This feature allows you to
rename any variable, function, or other symbol in your code and the name change will be applied to all the places where that symbol is referenced.
When you hit F2 and rename the symbol, you'll notice an option to apply it immediately to all instances by hitting ENTER. But you can also choose
SHIFT+ENTER, which allows you to preview the rename operation.
This opens a
"Refactor Preview" panel that allows you to review the changes that are going to take place before you commit to them. This would be useful for a large file or possibly for an inherited project that you may not know the full scope of.
And if you happen to prefer not to see the option to 'preview' your rename operation, you can disable it in your settings:
While this does clean up the UI a bit for the rename operation, I don't think it's all that bad to have that option always enabled (as it is by default). If it's enabled, you'll always have the option to preview the operation rather than potentially forgetting it's there.
Now on to this week's hand-picked links!