Sometimes we want to change the name of a variable or class in the code
But if it is changed, many places will be changed together
It would be a waste of time to change everything one by one
So we need some way to change all the same variable or class names at the same time
Multi cursor
We can use multiple cursors to select all the places to be changed and change them together
If the operation of multi cursor can not, you can go to my first vscode operation, the link is at the end of the article
demonstration:
Although it is more convenient to use multiple cursors than to change them one by one, we still need to add them one by one
rename
There is another way to rename our class names, variable names and so on
Operation mode: select the class name or variable name, and then click the rename symbol to directly change the same name in the whole code
demonstration:
Find and replace
There is another way
You can directly use the search and replace function of vscode
Replace the specified string in the whole code with another string
Operation mode: press Ctrl + F to open a small window to search for replacement, then input the string to be replaced and click replace all
demonstration:
Although it is convenient to find and replace the function, it should be used with caution
summary
This article about vscode at the same time change all the same variable name or class name text tutorial article introduced here, more related vscode change variable name or class name content, please search the previous article of developeppaer or continue to browse the related articles below, hope that you can support more developeppaer in the future!