feat: progress messages for uninitialized clients
Continuing discussion of #139 here (this is no longer specific to ClojureLSP).
@Samy-33:
Hey John, do
active clientsmean the attached clients?If so, it won't return clojure LSP as it's not yet attached ( but still sending
$/progressmessages, which is allowed by the spec).
Yeah, just like Neovim's vim.lsp.status() function, I call vim.lsp.get_clients(), which only looks for active clients.
At the moment, I don't know of any mechanism for iterating through all clients, including uninitialized ones. I will a file an issue upstream to see if this is possible.
@Samy-33 I've finally got around to trying to reproduce your issue (i.e., progress messages on yet-to-be-initialized LSP client). However, I've had no luck: clojure-lsp does not appear to be sending anything.
I followed your instructions + enabled ClojureLSP using nvim-lspconfig, but I do not see any progress messages from clojure-lsp at all (I overrode the $/progress handler using the snippet I wrote before). But it does seem to be working, insofar as showing me these error messages about missing http-server:
Here are the versions I have, on macOS:
$ java --version
openjdk 21.0.1 2023-10-17
OpenJDK Runtime Environment Homebrew (build 21.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.1, mixed mode, sharing)
$ lein --version
Leiningen 2.10.0 on Java 21.0.1 OpenJDK 64-Bit Server VM
$ clojure-lsp --version
clojure-lsp 2023.10.30-21.15.51-nightly
clj-kondo 2023.10.21-SNAPSHOT
Have you still been having this issue lately?
@j-hui, thanks for taking the time to reproduce the issue.
I think, we're missing a workDoneToken. clojure-lsp doesn't return progress-updates unless we manually send the token in the initialise request.
We need to hook a function that updates params sent in initialise token like this: https://github.com/Samy-33/dotfiles/blob/master/dotcom/.config/nvim/fnl/user/config/lsp.fnl#L62-L65C64 while configuring the lsp handlers.
Lua equivalent (but autogenerated): https://github.com/Samy-33/dotfiles/blob/master/dotcom/.config/nvim/lua/user/config/lsp.lua#L50-L57
@j-hui, I see an interesting implementation here: https://github.com/rafaeldelboni/cajus-nfnl/blob/main/.config/nvim/fnl/config/lsp.fnl
Lua equivalent (autogenerated): https://github.com/rafaeldelboni/cajus-nfnl/blob/main/.config/nvim/lua/config/lsp.lua
Maybe it'll help you with some ideas.
For the longest time I have been running fidget.nvim on the legacy branch (I cannot remember why I was on that release) but I have now just updated to the latest release.
The first thing I noticed was this issue - fidget not displaying notifications until the client attaches.
@j-hui Whatever fidget used to be doing in legacy was working just fine with clojure-lsp and unattached clients in general.
I also want to point out that while clojure-lsp is the most affected client (for me), I also clearly notice a delay with all other LSP clients I have configured. The old fidget used to start showing notifications practically immediately on entering a buffer - now there is always a short (or long :) delay.
At the moment, I don't know of any mechanism for iterating through all clients, including uninitialized ones. I will a file an issue upstream to see if this is possible.
But there must have been a way as this was not an issue in older versions of this plugin. Is it possible to go back and bring some of the old behaviour back or has the architecture changed too much for this to make sense?
The latest fidget is waay prettier than the version I was using - but I'm kinda tempted to just go back to the previous version as it was more useful.
Maybe I'll look at working on a fix if I get some time.