Add an option not to highlight variable references but only declarations/definitions
See original GitHub issueDescribe what you want
In VSCode this theme highlights variable references in the same color (coral red) as variable declarations/definitions. In some cases, such as when variables are referenced many times in a code block, the visual effect is a large area of red on screen and it’s not easy to tell the definitions out of references. Another case is when assigning local variables to keyword arguments in Python, in which both argument names and values are in red and look basically the same, unless Italic
options is turned on.
My request is to have an option that disables highlighting variable references, so definitions are in red and references are in plain white color. In this way the definitions/declarations easily stand out at first glance. It would be great to keep function calls blue unchanged.
Additional context The attached screenshot compares the highlighting effects between Emacs and VSCode with one dark pro themes. This SO post shows an Atom screenshot. It looks local variables are not highlighted in Atom either, just obj members are highlighted. As the first answer points out, “The purpose of syntax highlighting in text editors is to make important code structures stand out.” IMHO, variable declarations/definitions are more important than their uses, so they should be made stand out of their references. But for highlighting function calls, this one dark pro theme in VSCode make them blue and it definitely looks better than the Emacs one.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@skilkis Thank you for the guide! With the following settings, I got exactly what I want:
@0liu it’s possible to differentiate between module constants as well with the following rule, but not between global and local variables 😞
To customize the semantic token colors further you can use the VS Code command:
Developer: Inspect Editor Tokens and Scopes
which will bring up a window with token information.Using the above, I had made a configuration for myself that I’ve included below. Feel free to adapt / extend it! Happy hacking 😄