4 ms·
If you're wondering what Tree-Sitter is and why Emacs would want it, I wrote about it a while ago: https://www.masteringemacs.org/article/tree-sitter-complicat
by mickeyp 4y ago
If you're wondering what Tree-Sitter is and why Emacs would want it, I wrote about it a while ago:
https://www.masteringemacs.org/article/tree-sitter-complications-of-parsing-languages https://www.masteringemacs.org/article/tree-sitter-complicat...
- sph 4y agoThere is not an Emacs topic I'd like to know more about haven't already covered on your website. Thanks, your articles and your book are the best guides into the world of Emacs.
- mickeyp 4y agoThank you :) I'm glad you like my site and my book!
- afry1 4y agoThat point you make about syntax highlighting being slow while using eglot/LSP-mode is a great one. I've been a bit underwhelmed with eglot, and I think that must be the reason: it feels like I'm programming in a bowl of oatmeal with every keystroke. Do you have any tips or guides for using treesitter for syntax highlighting/structural editing and eglot/LSP-mode for everything else?
- omnicognate 4y agoAFAIK eglot/lsp-mode don't do syntax highlighting. The article's just explaining why that is (i.e. because it would be too slow). If you don't have tree-sitter your syntax highlighting will be done by the regex based font-lock-mode. I don't think eglot/lsp-mode make that slower, and I believe tree-sitter should speed it up (and make it more correct) without affecting them. I haven't tried it yet, though.
- TeMPOraL 4y agoIt must be a matter of configuration. At work, I use buffer re-fontification as an indicator that clangd correctly processed the C++ source file I just opened. That's with an Emacs built from source ~half a year ago + LSP mode.
- omnicognate 4y agoOh, interesting, it does appear lsp-mode now does "semantic highlighting" if the server supports it. I switched to eglot a while back (before it was added), which doesn't. I don't think I'd want that. Syntax highlighting and indentation are things I want instant feedback from. That affects the answer to the question. I assume you'd need to persuade lsp-mode not to do this and leave it to tree-sitter, but I don't know how to do that.
- TeMPOraL 4y agoLast I checked, "semantic tokens" were opt-in; I think it's still the case: https://emacs-lsp.github.io/lsp-mode/page/settings/semantic-tokens/#lsp-semantic-tokens-enable https://emacs-lsp.github.io/lsp-mode/page/settings/semantic-...
- srcreigh 4y agotree-sitter emacs package tree-sitter-hl-mode What lang do you use?