executablebooks / myst-vs-code

A syntax highlighter for the MyST Markdown format
https://marketplace.visualstudio.com/items?itemName=ExecutableBookProject.myst-highlight
MIT License
35 stars 15 forks source link

Look into semantic highlighting #11

Open chrisjsewell opened 4 years ago

chrisjsewell commented 4 years ago

VS Code just introduced this feature, which may be if use?

What is the difference between syntax and semantic highlighting?

Syntax highlighting colors the text based on lexical rules. In VS Code the lexical rules are expressed as regular expressions contained in a TextMate grammar.

Semantic highlighting enriches the syntax coloring based on symbol information from a language service that has the full understanding of the project. Based on this understanding each identifier gets colored & styled with the color of the symbol it resolves to. A constant variable name is rendered as constant throughout the file, not just in its declaration. Same for parameter names, property names, class names and so on.

choldgraf commented 4 years ago

whoah that sounds very cool. The only downside I'd see here is that some pages might end up looking like a rainbow vomited all over the page :-)