For me syntax highlight is one of most important programing improvements, almost as important as IntelliSense. Where IntelliSense is major for writing and syntax highlight is major for reading code.
Here is an example of what I’m talking about:
Code might be very complex and every facilitation are needed. Eg. Someone could write priceChange(price); you see braces you could think that it is a method, even if you suspect it could be some event you could not be sure unless you could distinguish them by color.
Other example you see some variable how to recognize is it a field, property, local variable without searching into code? Yes by it’s color.
According to Wikipedia:
Syntax highlighting is one strategy to improve the readability and context of the text; especially for code that spans several pages. The reader can easily ignore large sections of comments or code, depending on what they are looking for. Syntax highlighting also helps programmers find errors in their program. For example, most editors highlight string literals in a different color. Consequently, spotting a missing delimiter is much easier because of the contrasting color of the text.
A study published in the conference PPIG evaluated the effects of syntax highlighting on the comprehension of short programs, finding that the presence of syntax highlighting significantly reduces the time taken for a programmer to internalise the semantics of a program. Additionally, data gathered from an eye-tracker during the study suggested that syntax highlighting enables programmers to pay less attention to standard syntactic components such as keywords.
If you are familiar with UnityEngine then you know what is UnityEngine.Random.Range but if you don’t then you would have some trouble here.
You could say that just from plain text you know that there is calculated random number and is assigned to variable startPrice & Price. And that it’s all you need. But just by looking at that single line you could know that min & max are created inside this method, and knowing that price is property you are aware that there could be a hook triggered on value change.
What is more my eyes and brain are less tired since what I’m looking at is more diverse and humans are accustomed to colorful things like nature.
That’s all from intro so how to make Visual studio looks like that. Well there is built-in syntax highlight. But it’s not very convenient to use. What is more it has some missing features like coloring namespace or property. Fortunately there are many different extensions that support that and many more 🙂
- Codinion (I’m currently using)
- Semantic Syntax Colorizer
- Enhanced Syntax Highlighting
- Resharper – Paid (free for open source)
- Visual assist – Paid
- Supercharger – Paid (free to open source & non commercial)
Main features are Syntax Highlighting, Solution Navigation, Banner and Jump List organization.
It’s very easy to use and configure. With cool toggles that I belive can turn on and off just any Codinion feature.
For me it’s most advanced tool for syntax highlighting, with most highlight font and background options:
And many Highlight types:
It’s also worth to mention that it has it’s own settings file separate from visual studio settings, so it’s easy to transfer settings to new machine.
It’s very simple tool that only add several more highlight options to visual studio fonts and colors:
All settings are in Visual studio “fonts and colors” but they are easy to find because of “Semantic” prefix.
Another Lightweight Visual Studio editor classifier extension to highlighting custom tags in C# and Visual Basic code.
It’s add more options for “User Types” in fonts and colors. There are syntax highlighting for “Events”, “Fields”, “Fieds (Constant)”, “Fields (Inside Enums)”, “Local Variables”, “Methods”, “Methods (Extension)”, “Methods (Static)”, “Namespaces”, “Parameters” and “Properties”.
The legendary .NET productivity tool: find and fix errors and code smells; navigate and refactor; run unit tests and write quality code faster.
It has a whole lot of features and syntax highlight is only one of them but here I want to focus on it.
First of all that feature need to be enabled in Resharper settings window under Code Inspection -> Settings -> Color identifiers
Resharper has a lot of different syntax highlight options
It has one big disadvantage which is being hard to configure because of so many options it has.
Same as Resharper Visual Assist is productivity tool with lots of features including Syntax Highlight.
Visual Assist provides two sets of default colors: one for light backgrounds, and one for dark backgrounds. The default set for Visual Assist is determined during installation, using information from IDE settings.
Visual Assist has quite interesting settings where It has it’s own window settings but it’s still quite good integrate with Visual Studio Settings.
Last extension in list, one more with many features besides coloring code.
It has different formatting for types, constructors, regular methods and properties, even different formatting for regular private vs regular public methods.
Example of enabled and disabled version:
This is how it’s settings looks like:
And what do You prefer? Colorful syntax highlight vs no highlight at all? Or maybe something in the middle?