Mikhail
Mikhail

Reputation: 21749

Highlight fundamental types differently than other keywords in Visual C++

I would like to highlight C++ fundamental types like int, bool, double, etc., differently than other keywords, like for, if, class, etc. in Visual Studio text editor. What is the easiest way to do it?

Native Visual Studio 2013/2015 functionality is preferred. If not, a free extension is ok. If not, I can use VisualAssistX or Resharper++.

What I was able to find:

Upvotes: 3

Views: 803

Answers (2)

Jordan Harris
Jordan Harris

Reputation: 390

This could be a bit more than what you want, but you could use this extension called Viasfora for this. First of all, Viasfora is an extension that gives you things like rainbow braces (which are very useful), keyword highlighting, and more.

Anyways, if you have Viasfora, go to Tools->Options->Viasfora->Languages->C++. You'll see two sections, Control Flow and Visibility. By default Control Flow has keywords like if, else, while, for, etc. and Visibility has words like public private, protected, etc. Well you could change the Visibility section to include any of the keyword you wanted and you could change the color in the "Fonts and Colors" section in Options.

If you don't want the keyword highlighting for Control Flow, you could just erase all of the keywords in that section. Also, if you don't want any of the other Viasfora features, you can try to disable them in the Viasfora options.

By the way, if you do want to erase all of the keywords for the Control Flow section, you might get an error saying "property value is not valid". To get past this, just click on the little square button on the right ( looks like [...]) and erase all of the text from there. I don't know why this is, but it works. Hey, you might even like how it does the control flow highlighting so you may decide to keep it.

Edit: I noticed that you can't actually leave Control Flow blank because it fills in the defaults after you apply it. You can, however, use some character and that works fine. I just used a space character (' '). That's a weird hack, but it's not too bad.

I do urge to at least try out the rainbow braces. I find it extremely useful when looking for matching braces. No more counting braces! Also, you can customize the color of each brace and choose how many different colors are used.

Upvotes: 3

VolAnd
VolAnd

Reputation: 6407

Tools -> Options -> Enviroment -> Fonts and Colors

But you should understand that int, double and other standard data types are also keywords, so their appearance is defined by Display item "Keyword"

Upvotes: -1

Related Questions