Skip to content
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

autocmd CursorHold stopped working #44

Open
andrewrynhard opened this issue Mar 28, 2021 · 12 comments
Open

autocmd CursorHold stopped working #44

andrewrynhard opened this issue Mar 28, 2021 · 12 comments
Labels
bug Something isn't working upstream_issue

Comments

@andrewrynhard
Copy link

andrewrynhard commented Mar 28, 2021

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.

@wbthomason
Copy link
Collaborator

Thanks for the report! I can reproduce this issue, so some bug was introduced...

@wbthomason wbthomason added the bug Something isn't working label Mar 29, 2021
@wbthomason
Copy link
Collaborator

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.

@wbthomason
Copy link
Collaborator

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?

@wbthomason
Copy link
Collaborator

Ah, and further if I run doautoall CursorHold things work as expected...

@wbthomason
Copy link
Collaborator

Ok - for some reason, having the timer run prevents CursorHold from triggering.

@wbthomason
Copy link
Collaborator

@andrewrynhard I think this is caused by neovim/neovim#12587, which means that we need to rethink @joshuachp's timer-based design or have this plugin break CursorHold until that issue is closed.

@wbthomason
Copy link
Collaborator

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 a timer.

@andrewrynhard
Copy link
Author

Thanks for digging into this @wbthomason.

@andrewrynhard
Copy link
Author

Hmm, still not working for me FWIW.

@wbthomason
Copy link
Collaborator

@andrewrynhard: right - as I said, we're blocked by neovim/neovim#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.

@joshuachp
Copy link
Contributor

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 a timer.

Sorry, I missed that. I thought it was an aucmd fired by the plugin.

@joshuachp
Copy link
Contributor

joshuachp commented Mar 29, 2021

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 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream_issue
Projects
None yet
Development

No branches or pull requests

3 participants