Refactor local variable name using Visual Studio Code

后端 未结 4 824
抹茶落季
抹茶落季 2021-02-01 11:51

I have this simple situation. I\'d like to refactor the name of the role variable:

It looks like Visual Studio Code is smart enough to know that \"roles\" in th

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 12:18

    Use rename symbol instead of the standard find/replace. Rename is bound to F2 by default.

    Rename symbol will know to only touch the local roles references in your example. Visual Studio Code ships with rename support for JavaScript and TypeScript. Other languages may require installing a language extension.

提交回复
热议问题