VisualStudio: Shortcut for when Renaming Variable

后端 未结 12 1103
轻奢々
轻奢々 2021-02-02 05:33

In Visual Studio, when you rename a variable name in its definition, there\'s a little underline in the last letter so if you hover that, you\'ll get the option \"Rename OldVari

相关标签:
12条回答
  • 2021-02-02 05:53

    I use ctrl + f

    It opens a window you can use to find and replace all occurrences of a word. You can replace the word in "Current Document", "All Open Documents", "Current Project", or "Entire Solution" with the drop down menu below the button that says "Replace All" when you hoover over it.

    I hope that helps.

    enter image description here

    0 讨论(0)
  • 2021-02-02 05:58

    Depending on what the default keyboard mapping scheme you use, you might be able to get away with simply pressing F2 to call Rename before ever typing in the text change.

    If your version of VS does not have the F2 mapped, you can rename that from within the program's Main Menu:

    • Tools >> Options
    • In Options Dialog, expand Environment, and then select Keyboard
    • Type File.Rename into the "Show commands containing" Search box
    • Select the "Press Shortcut keys" TextBox and click F2
    • Click Assign

    screenshot

    0 讨论(0)
  • 2021-02-02 06:00

    On Visual Studio 2013, the listed shortcuts Ctrl+. , F2, etc... did not work for me.

    I found that installing a Visual C++ Refactoring extension solved my problem.

    I can now use Ctrl+R, which brings up a refactoring pop-up and allows me to select current scope by default, as well as other instances in the same file.

    Here's an example of a variable I renamed in a function. There was another function there with the same variable name, which it suggests to rename...

    0 讨论(0)
  • 2021-02-02 06:01

    I think the default is Ctrl + ..

    0 讨论(0)
  • 2021-02-02 06:01

    Searched for this in 2019... What worked for me was to go to Options and add the shortcut on the Refactor.Rename command, like this

    0 讨论(0)
  • 2021-02-02 06:02

    After the rename: CTRL+.

    Before the rename: CTRL+r,r

    VS 2017, Smart Tags enabled

    0 讨论(0)
提交回复
热议问题