How to get Visual Studio 2010 to highlight instances of a variable

后端 未结 10 1893
梦谈多话
梦谈多话 2021-02-03 21:28

I\'m new using vs2010 I\'ve read that when you click on a variable its suppose to highlight all the instances of that variable in that file and highlight red or show an error as

相关标签:
10条回答
  • 2021-02-03 21:58

    In visual Studio 2012, Tools -> Options -> Environment -> Fonts and Colors -> [Text Editor] [Display Itemns] -> Highlighted References -> Item background: Choose the color you want.

    0 讨论(0)
  • 2021-02-03 22:01

    in vs 2012: Tools > Options > Env > Fonts and Colors > Text Editor > Highlighted Reference

    0 讨论(0)
  • 2021-02-03 22:01

    I think you mean placing a cursor over the line and then pressing F9. This will make the code stop there. Place the mouse cursor over the desired string value and it will pop up....that's the lazy way I do it..:-)

    0 讨论(0)
  • 2021-02-03 22:02

    Productivity Power Tools for 2010 in the Visual Studio Gallery can do this, it took me a bit to find out how I did it, but in the Tools->Options... menu, there is a "Productivity Power Tools' drop down.

    The default for the 'Words matching the caret location color in the editor' is fully transparent, so it isn't used. A color choice dialog pops up and you can set the color. Just ensure you set an alpha value above 1 to enable it.

    The color values I used below are [153, 138, 188, 219] It seems to work well in light themes.Productivity Power Tools->Enhanced Scroll Bar

    0 讨论(0)
  • 2021-02-03 22:05

    If you are using VS2013 the following extension would solve this

    https://visualstudiogallery.msdn.microsoft.com/df093e9f-3e74-41c5-aeec-6371436423c5

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

    I came here from google while looking to do the same thing with Visual Studio 2017 community edition. The answers above point out you can turn this on for VB and C#. The option does not exist for C or C++. ie. for C/C++ the option does not exist in advanced settings so you can not right click the variable and select highlight variable.

    However, I learned its simpler for C/C++ to get the equivalent behaviour. Simply double click the variable/function to select it. The editor will highlight all instances of the variable or function in the file. Its not limited by blocks. Its highlighted in the entire file.

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