j-hui / fidget.nvim

💫 Extensible UI for Neovim notifications and LSP progress messages.
MIT License
1.95k stars 58 forks source link

LSP progress message ringbuf overflow #201

Closed Amleto closed 8 months ago

Amleto commented 8 months ago

When attaching in a rust project with many dependencies, fidget doesn't seem to detect rust analyzer finishing.

Normally the last proc macro build notification remains, along with the rotating dots.

I haven't managed to find a small repro yet. I've turned the logs on and don't really know what to look for.

When I open the repo with vscode it shows that rust analyzer finished loading/attaching ok

j-hui commented 8 months ago

Thanks for filing this issue. I use Fidget for small- to medium-size projects and haven't encountered this issue before, so it might not be reproducible with a small example. But would you be able to point me to a bigger repo where this is an issue?

Also, when it gets stuck, what does it show? Can you capture some logs of this happening, to see if there's any hints there on what kind of notifications lead to this issue?

A workaround might be to set the lsp.display.progress_ttl to a large number, say, 300. Then if your proc macro hasn't completed in 5 min, the notification should disappear on its own.

On Mon, Jan 15, 2024 at 3:16 PM Amleto @.***> wrote:

When attaching in a rust project with many dependencies, fidget doesn't seem to detect rust analyzer finishing.

Normally the last proc macro build notification remains, along with the rotating dots.

I haven't managed to find a small repro yet. I've turned the logs on and don't really know what to look for.

When I open the repo with vscode it shows that rust analyzer finished loading/attaching ok

— Reply to this email directly, view it on GitHub https://github.com/j-hui/fidget.nvim/issues/201, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2A5DARCIVX652645LC35TYOVB5LAVCNFSM6AAAAABB3N7IXGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA4DEMRTGY3TKMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Amleto commented 8 months ago

I will have to look around and try some open source repo to see if it's reproducible (I'm seeing the issue in my work repo)

If I disable proc macro builds with rust analyser then I've never seen the issue.

Also, when it gets stuck, what does it show?

Normally the last proc macro build notification remains, along with the rotating dots.

I will gen some logs and paste a bit. Not sure what is of use from rust analyser, though, and they seem quite noisy

Amleto commented 8 months ago

I see that the notification that "sticks" is the very last message that has token = "rustAnaltzer/Building". But all of the proc macro builds seem to have the same one-off message.

The last proc macro progress message has

pending = {
["rustAnalyzer/Building"] = "Building"
}

But the next progress message has

pending = {
["rustAnalyzer/Loading"] = "Loading",
["rustAnalyzer/Roots Scanned"] = "Roots Scanned"
}

And the final message has pending as empty

Amleto commented 8 months ago

I checked out tokio repo and was able to reproduce straight away.

I will try the ttl setting

j-hui commented 8 months ago

I see what's going on here. The progress buffer is getting overwhelmed with messages from Tokio---I say this because I can reproduce the issue on nvim 0.10 (which uses a ring buffer) but not on nvim 0.9 (which uses an unbounded queue). It's the same issue as #167.

Fidget is already responding to LspUpdate events as soon as it can, by default, so I'm not sure there's much more that can be done here.

Can you see what happens if you set the progress.lsp.progress_ringbuf_size setting to something large, like 2048? That might fix it for you.

CosmicSyntax commented 8 months ago

Can you see what happens if you set the progress.lsp.progress_ringbuf_size setting to something large, like 2048? That might fix it for you.

@j-hui This worked for me. Thank you!

Amleto commented 8 months ago

Yes, this looks to have done the job for me, too!

Thanks!

j-hui commented 8 months ago

Oddly enough, I can no longer reproduce this issue at the moment, even without setting progress.lsp.progress_ringbuf_size... seems pretty finicky, but I'm glad that at least the workaround works for others.

In any case, I'm going close this issue.