1

I would like to use tokenColor in Visual Studio Code to highlight the initial binding of a variable in python. That is to say, the first time a variable name appears in its scope, I would like it to have a different color. This would usually be where the keyword "let" or "var" would be used in JavaScript. How would I go about adding this to VSCode?

1 Answer 1

1

This is not possible using a simple language grammar as it requires understanding the structure of the program itself (i.e. understanding what are initial bindings vs re-assignments). This type of highlighting is called semantic highlighting.

As of VS Code 1.29, you can implement a custom version of semantic coloring using decorators. A proper semantic highlighting api is tracked by this issue

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.