Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio different colour for constants, function names etc.?

I know that you can change text editor colours but all the things I want to customized in one group "Identifiers".

Is there a way to break that group into "Variables","Constants","Functions" and things like that so I can customize colours for those things separately?

like image 385
Kristina Brooks Avatar asked Dec 18 '09 13:12

Kristina Brooks


People also ask

What do the different colors in Visual Studio mean?

Here's your quick reference to the colors and icons in the editor window's right-hand margin: Yellow: The line has been changed but not yet saved. Green: The line has been changed and saved. Orange: The line has been changed, saved, and the change undone. Little square dots in the middle of the margin: Break points.

How do I change the color of a variable in Visual Studio?

You can edit colors in Options -> Environment -> Fonts and Colors -> Text Editor -> "Semantic *****".


2 Answers

Current syntax coloring options are based on what can be easily recognized by the kind of rules a lexer uses. Coloring functional identifiers requires much more, the editor would actually have to parse the statements. That's an iffy proposition while you are entering code into the editor, especially when that code contains bad syntax or typing mistakes. Some of this is actually done by the IntelliSense parser but that's a feature that is disjoint from the basic editor implementation.

Changes are coming in VS2010, its extensibility model adds support for custom syntax highlighting through MEF plug-ins. To what degree this will be used for default coloring of a specific language isn't that clear to me. I don't see any hard promises yet.

like image 111
Hans Passant Avatar answered Oct 16 '22 06:10

Hans Passant


This can be achieved via different add-ins. Good commercial example is ReSharper.

Also there's syntax highlighting framework that allows to analyze source code and provide custom styles for any lexical elements (more on MSDN).

like image 41
terR0Q Avatar answered Oct 16 '22 08:10

terR0Q