Search code examples
c++visual-studiohighlight

Excessive cursor reference highlighting VS Community


so I have been using VS Community for a while now to code in c++ and somehow must have activated reference hightlighting. Now every time my cursor is inside a word it highlights every occurence in the entire file. This gets very confusing especially inside nested loops:

enter image description here

I tried looking for reference highlighting but could only find it in the C# section in the options.

I also tried changing the background color of the highlight to the background color of the plain text but this still draws the rectangle highlight box around it.

Is there no way to disable this cursor highlighting for c++? Basicly I only want the highlight to show when I actually hightlight stuff.


Solution

  • If you want to disable all cursor highlighting, you could set True in Tools->Options->Text Editor->C/C++->Advanced->References->Disable Reference Highlighting. enter image description here

    If you want to customize the cursor highlighting, here is a solution for reference.

    This tip was proposed by Sairama Jamalapuram. Syntax coloring for user-defined keywords is used for C++ files only.

    Here are the steps you need to take to enable syntax coloring for user-defined keywords. The steps are taken from the online help.

    1. In the same directory as msdev.exe (for Visual Studio .Net search for ...\Microsoft Visual Studio.NET\Common7\IDE\devenv.exe), use the Text editor or Windows Notepad to create a text-only file named usertype.dat.
    2. Add your keywords to usertype.dat, one keyword per line. Note: The usertype.dat file is read during initialization. It cannot be renamed, nor can it be reloaded during an editing session. The syntax coloring mechanism checks the usertype.dat file last. Thus, all previously defined color settings take precedence over the user-defined keywords.
    3. Save the file as a text-only file, exit, and then restart Visual Studio.
    4. From the Tools menu, choose Options.
    5. Select the Format tab.
    6. In the Colors box, select User Defined Keywords.
    7. Set the font, font size, foreground color, and background color to your preferences.
    8. Click OK.
    9. Restart DevStudio.