Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That 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?



AFAIK 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.


It 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.


Oh, 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.


Last I checked, "semantic tokens" were opt-in; I think it's still the case:

https://emacs-lsp.github.io/lsp-mode/page/settings/semantic-...


tree-sitter emacs package tree-sitter-hl-mode

What lang do you use?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: