IntelliJ & MATLAB both change highlighting to indicate variable scoping etc, so it's neither unseen nor impossible, just uncommon in simpler editors.
More advanced tokenizers are able to emit different tokens for those scopes, but not all syntax highlighters differentiate between them. The online Textmate theme editor is a good place to examine what's availabe because many text editors are able to import .tmThemes or use them directly (Sublime, VS Code).
You can see here that the Monokai theme supports about 20 tokens and doesn't differentiate much between scopes: https://tmtheme-editor.herokuapp.com/#!/editor/theme/Monokai
Personally, I prefer highlighters that do something to highlight variables differently, like this variant of Monokai (ie around line 45 for the JS example): https://tmtheme-editor.herokuapp.com/#!/editor/theme/Monokai...
Re:Turning off syntax highlighting
by Adverblessly on Sunday November 06, 2016 @03:05PM
(#12886789)
EDIT: Actually, I think I misunderstood what you meant.
What you are describing sounds like regular syntax highlighting to me. This is my current theme: http://imgur.com/a/cQbWL You can see the level of customization available fits with what you described.
And it has really helped many times in the past, preventing all sorts of silly mistakes that could have been hell to debug. Like shadowing a variable :)
Something like this?
From reading the README, it just cycles through colors. The colors are random, not semantic, so the name seems to be misleading?
Haven't tried it yet, just bookmarked it. So I can't review it.
There is a lot of things we can do with highlighting, but that is not one that we should. An online linting tool should tell you that a variable is shadowing another (and I personally believe that it should not be possible at all). If you make a syntax highlighter that can color differently based on scope, you're only one stop away from a tool that can warn you about shadowing anyway.
Likewise, highlight macros in C and make them different to variables/functions.