fidget.nvim
fidget.nvim copied to clipboard
feat: Show fidget when we request any action to the LSP server
Instead of just registering to the progress handler, would be possible to show for every / some actions that we send to the LSP server?
For example:
- if I request to rename a class in typescript it can take 500ms, show fidget for this time
- if I request some imports, can take up to 2s and sometimes even timeouts, show fidget for this time
I have no idea if LSP or neovim-lsp provide such handlers, so I'm just asking for the feasibility, I would even implement this if I have some directions.
typically that's the task of the LSP server to report progress, that what's the event for. Best bet is probably creating a PR to the LSP servers repo that implements it
The only way I can imagine this working would be to override the LSP handlers for each command, and generating the progress while calling the original server.
I'll try to document myself if the progress handler can be used for reporting "wait" operations, but I don't think so at first glance.
Unfortunately, due to https://github.com/neovim/neovim/issues/15848 I guess we cannot use handlers for this.
So, I guess the only way to do this properly is to create a custom function when we requests code actions and call the fidget.
Sad. I'll try to do something.
Yeah, to my knowledge there's no way to tell which tasks an LSP server should notify clients about. There's also no way to distinguish between which tasks were caused by an explicit user request and which were caused by the editor (especially if, e.g., the editor is configured to autoformat on save).
One workaround that could work is to give users greater flexibility over what tasks are and aren't shown; someone requested a similar feature on Reddit. So while I won't be able to figure out what progress to display a priori, users will be able to specify, for each language server, which tasks should be shown. Then you could only show tasks whose title corresponds to tasks you're interested, e.g., formatting or importing.
Interesting, how you would do that? I mean on the LSP side, would you listen with handlers? I'm asking because for example, the one I'm interested and it's probably the slowest (codeAction) does not have handlers anymore.
I could give some help in the implementation, in case.
The best (clean) way is still to create a PR to the actual language server to just report the progress with the LSP APIs.
Unfortunately I have to agree, any other implementation, even if cool, would be just a workaround.
Interesting, how you would do that? I mean on the LSP side, would you listen with handlers?
The same way I do now; if the LSP server isn't sending progress notifications then there's nothing I can really do.
(What I was proposing is essentially a filter on existing notifications)
FYI: #55 allows you to specify a custom task formatter which you can use to filter out specific notifications (but I know that's not exactly what @lucax88x is asking for here).
Closing; please re-open if we can clarify what the feature should be/how it would work.