lsp-status.nvim
lsp-status.nvim copied to clipboard
autocmd CursorHold stopped working
Hello 👋🏻 . I am coming back to nvim
after some years away (never really was a power user) so forgive me if I am making a silly mistake. Really appreciate all that the Neovim community is doing lately with Lua. Feels great to get away from the heavy feeling of VScode.
Before #43 was merged the following autocmd
worked:
autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics()
I could be missing something simple, but as far as I can tell (looking at a number of examples out there) there is nothing silly I am missing like my comment here.
Thanks for the report! I can reproduce this issue, so some bug was introduced...
Part of this is that the LspDiagnosticsChanged
autocommand was removed, I think. I don't know why that would affect show_line_diagnostics
, but it causes a stale diagnostics display in the statusline component at the least.
Another interesting thing: If I manually trigger the show_line_diagnostics
function, it works as expected, but the CursorHold
autocommand doesn't seem to work for me. Maybe this is an issue with autocommand setup?
Ah, and further if I run doautoall CursorHold
things work as expected...
Ok - for some reason, having the timer run prevents CursorHold
from triggering.
@andrewrynhard I think this is caused by https://github.com/neovim/neovim/issues/12587, which means that we need to rethink @joshuachp's timer-based design or have this plugin break CursorHold
until that issue is closed.
I've fixed the issue with LspDiagnosticsChanged
not triggering a redraw. From discussion in the Neovim Gitter, there's a chance that https://github.com/neovim/neovim/issues/12587 can get fixed soon - if not, I'll spend some time looking at a redesign that gets around the need for a timer
.
Thanks for digging into this @wbthomason.
Hmm, still not working for me FWIW.
@andrewrynhard: right - as I said, we're blocked by https://github.com/neovim/neovim/issues/12587 and waiting for a bit to see if it gets fixed. The part I fixed is the diagnostics counts being displayed in the statusline component; CursorHold
still has problems because of the linked upstream issue.
I've fixed the issue with
LspDiagnosticsChanged
not triggering a redraw. From discussion in the Neovim Gitter, there's a chance that neovim/neovim#12587 can get fixed soon - if not, I'll spend some time looking at a redesign that gets around the need for atimer
.
Sorry, I missed that. I thought it was an aucmd
fired by the plugin.
I was trying out an idea of stopping the timer when there is no update from the server. So the CursorHold
shouldn't be blocked. Unfortunately I'm having some troubles with my LSP setup and didn't fully test it, but if you could perhaps try this branch solves the problem. joshuachp/lsp-status.nvim/stop-timer
I warn you, the code is awful and just for testing 😅