vfclists · 2022-12-10 14:16
From what I understand lsp/eglot use information about the functions and variables in your codebase to provide suggestions, like company or intellisense, but what does tree-sitter do?
Can tree-sitter be used to provide some of the lsp functionality.
janoc · 2022-12-10 15:15
`tree-sitter` is mostly used for parsing the buffer and providing stuff like fast syntax highlighting. Later on it could be potentially used for other things.
They are complementary with LSP, not alternatives.
codemuncher · 2022-12-10 20:32
Tree sitter operates only in the text in the file. In other words it’s “just” a lexer and parser. But it doesn’t understand semantic elements and elements that are cross file.
Where as lsp typically integrates with your build system and can actually compile the thing, offer cross refs, auto complete, documentation etc.
These are complementary usages. There’s a real advantage in having a relatively simple self contained syntax highlighter and indenter. And some modes don’t need more, eg: json mode.