-
-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable LSP and Treesitter for the log buffer by default #571
Comments
I used an autocmd in the AstroNvim Community Clojure pack to disable diagnostics in any buffer matching I assume something similar to disable Treesitter may be effective (but just a guess). I didnt notice an issue with Treesitter though (not a heavy user of the REPL log)
|
On LSP, the lspconfig plugin sets autocommands on I quickly hacked this together to demonstrate. |
Oh interesting! So maybe if I just change the order of the buftype setting it'd help some people out. I kind of like the LSP / linting in the log buffer because it helps me autocomplete, doc lookup and edit the contents in the same way as I would a normal buffer. I get that some people wouldn't want that but this is why I opted (in the past) to say "disable it yourself" rather than disabling it by default in such a way that people couldn't turn it back on. If I change the order and set buftype before the autocmd fires, I guess it turns off LSP for the log buffer? (in theory) In doing so, do I remove the ability for anyone to use LSP in the log without some hacking? Is there an easy way to then selectively turn it on for the users that do want the log to have LSP? Maybe if Of course this behaviour will change / break if the plugins we're trying to toggle change their behaviour. Which is another reason I never wanted to do this from Conjure's side. Conjure makes a Clojure buffer, your plugins hook into that buffer, I mostly feel like it's the duty of those plugins to be easily configurable to NOT fire for some buffers or patterns and I shouldn't try to actively block plugins from hooking into the log buffer since there could be infinitely many plugins and they may change behaviour from under me. So I'm not 100% settled on the way forward yet, but this is really interesting information and I'd like to find a solution that keeps both camps happier for the long term (people who want linting in the log and people who don't). |
One thing to note here is that there are really two different kinds of Clojure: one that you might see in a source file, and one that you see in a REPL (or the log buffer). As a quick example, here's what I see when I evaluate a simple source file:
So, one possible solution for me would be to somehow tell |
Having a look, lspconfig doesn't want to attach at all to vim.lsp.start({
name = "clojure_lsp",
cmd = { "clojure-lsp" },
root_dir = vim.fs.root(
0,
{ "project.clj", "deps.edn", "build.boot", "shadow-cljs.edn", ".git", "bb.edn" }
),
}) And trigger that by autocmd. But if you wanted to do that for each filetype I can see it being a pain. Personally I'd set the buffer options before |
I've pushed a change to develop that turns off diagnostics in the log by default. There is a config option to turn them back on. This way we only remove diagnostics but can still use doc lookup and go to definition on various symbols in the log. |
… system #571 I'm unsure if setting syntax=on enables the old syntax highlighting in this one buffer or not. Maybe it re-activates TS?
Also added a flag for treesitter although this one is NOT off by default because I think it's mostly useful and people will want it on. It's worth turning off if you end up doing lots of work in one project that causes your editor to slow down. This varies by machine too. So diagnostics: Off by default. TS: On by default. I also am not sure if I'm fully disabling treesitter or not, I'll need someone to check that for me with something that used to be too slow with it enabled. |
I tried f6e4eec and it helped with displaying large output to log buffer, making it no longer crash neovim. Thanks for this work! |
Nice! I do think the LSP disabling call needs to be called more often though, looks like as I open and close the log the diagnostics come back. |
The log buffer is great for scrolling through output, but there are a few annoyances with it when using LSP and Treesitter:
My solution to these problems currently looks like this (unrelated sections of my config omitted for brevity):
It would be nice if Conjure were able to handle these scenarios on its own, or at the very least recommend a solution like this in the README.
The Treesitter solution was inspired by this post, so it appears others have run into this as well and built their own solutions for it.
The text was updated successfully, but these errors were encountered: