3 ms·
> You would only get the top half of your code highlighted because a compiler Your comment implies a language server taps into the language's compiler/interpre
by G3rn0ti 3y ago
> You would only get the top half of your code highlighted because a compiler
Your comment implies a language server taps into the language's compiler/interpreter. That is a popular misconception. Almost all LSP severs don't actually use the compiler backend of the language they are servicing. All the LSP server implementations I've seen at least just use a static parsing approach (or even worse i.e. just a tokenizer) similar to what Treesitter does. It is just not limited to a single file.
That's why I still think Treesitter has the potential to not only improve syntax highlighting but also to simplify language servers or even -- in the long run with some extensions of the the language modes -- replace it altogether.
- gpderetta 3y agoBut some do. Most notably clangd. Still clangd tries parse broken code using recovery heuristics (which can still be useful in a compiler to produce decent error messages).
- morelisp 3y ago> Your comment implies a language server taps into the language's compiler/interpreter. That is a popular misconception. But it is a misconception which framed the discussion, not a misconception of the answerer. The claim was that LSP was > performed by 100% accurate parsers instead of approximations