News for hackers. Stuff that matters.
Re:Turning off syntax highlighting by qznc on Sunday November 06, 2016 @02:41PM (#12886686)
Yes, nice idea. For example, it might be helpful to have different colors for local variables, global variables and fields. If you accidentally shadow a variable, you might notice this way.

Likewise, highlight macros in C and make them different to variables/functions.

Re:Turning off syntax highlighting by marmaduke on Sunday November 06, 2016 @04:15PM (#12887075)
IntelliJ & MATLAB both change highlighting to indicate variable scoping etc, so it's neither unseen nor impossible, just uncommon in simpler editors.
Re:Turning off syntax highlighting by amk_ on Sunday November 06, 2016 @04:34PM (#12887168)
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 :)

Re:Turning off syntax highlighting by cygned on Sunday November 06, 2016 @02:54PM (#12886742)
Re:Turning off syntax highlighting by qznc on Sunday November 06, 2016 @03:01PM (#12886771)
From reading the README, it just cycles through colors. The colors are random, not semantic, so the name seems to be misleading?
Re:Turning off syntax highlighting by cygned on Sunday November 06, 2016 @03:08PM (#12886806)
Haven't tried it yet, just bookmarked it. So I can't review it.
Re:Turning off syntax highlighting by hvidgaard on Monday November 07, 2016 @02:47AM (#12889534)
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.
Re:Turning off syntax highlighting by yoz-y on Sunday November 06, 2016 @08:17PM (#12888140)
Many IDEs do that. For C++ i use Qt Creator which differentiates all of that and more (virtual functions, globals, primitive vs complex types etc)