Semantic highlighting

Discuss any editing or program related subjects.
Post Reply
User avatar
pjj
Posts: 1784
Joined: 13 Oct 2009 13:48
Location: Kraków, Poland

Semantic highlighting

Post by pjj »

Recently I've read an interesting article about semantic highlighting and its novel use cases; discussion on Hacker News followed. The article I've linked explains it best what semantic highlighting is all about and what it could do for you, but nevertheless here's a short explanation from another place:
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.

https://github.com/microsoft/vscode/wik ... g-Overview
On a code sample it looks like this:

-- without semantic highlighting (current RJ TE highlighting is richer than this!):
Image

-- with semantic highlighting:
Image

This is not a feature request, but rather a food for thought. I guess it would be cool to have some of it implemented, though.
Alium tibi quaere fratrem; hic, quem tuum putas, meus est. Titus Flāvius Caesar Vespasiānus Augustus

Post Reply