Skip to content

Conversation

kirawi
Copy link
Member

@kirawi kirawi commented Nov 30, 2021

No description provided.

@kirawi kirawi changed the title Syntax highlighting Semantic syntax highlighting Nov 30, 2021
@archseer
Copy link
Member

archseer commented Dec 1, 2021

I'm still not sure if semantic highlighting is something we want to support, it's a terrible spec.

“But what about LSP?” I can hear some of you say. The reason (most) LSP servers don’t offer syntax highlighting is because of the drag on performance. Every keystroke you type must be sent to the server, processed, a partial tree returned, and your syntax highlighting updated. Repeat that up to 100 words per minute (or whatever your typing speed is) and you’re looking at a lot of cross-chatter that is just better suited for in-process communication. But of course that doesn’t mean it can’t replace the language parsing used for other features in LSP!

https://www.masteringemacs.org/article/tree-sitter-complications-of-parsing-languages

@kirawi
Copy link
Member Author

kirawi commented Dec 1, 2021

I'll close this then and implement it on my branch until it can be made a plugin.

@kirawi kirawi closed this Dec 1, 2021
@kirawi
Copy link
Member Author

kirawi commented Dec 1, 2021

It would be nice if we could replicate the benefits of semantic syntax higlighting through tree-sitter, but that sounds pretty complicated or impossible in the case of doc comments. I assume it would require plugins too.

@archseer
Copy link
Member

archseer commented Dec 1, 2021

What are some of the benefits? Highlighting mutable variables can be done through locals.scm

@archseer
Copy link
Member

archseer commented Dec 1, 2021

Doc comments can be highlighted differently once tree-sitter/tree-sitter-rust#99 is merged

@kirawi
Copy link
Member Author

kirawi commented Dec 1, 2021

The benefits are that the ones for major languages usually have very accurate syntax highlighting and can differentiate between types, and that some languages are sufficiently incompatible with tree-sitter like Prolog.

It doesn't look like it can omit the leading characters /// which complicates it. Impossible was the wrong word to use, I meant that it is difficult. From tree-sitter/tree-sitter-c-sharp#208 it looks that while it's possible to do doc comments, it's not as easy as calling an injection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants