-
-
Notifications
You must be signed in to change notification settings - Fork 123
Add some metadata to the servers #90
Comments
Hey! This is definitely on my mind as well. I do want to be careful adding certain features, especially those that incur a lot of added complexity. It'd take a lot of convincing and then some more for me to consider allowing global/system-wide or even user-local installations (really, anything outside of nvim-lsp-installer's dedicated file system boundaries). But maybe I misunderstand your 2nd and 3rd points?
I'm not following this one, could you perhaps give an example?
Yeah some of the lspconfig names are pretty opaque in terms of what's actually installed. I definitely think it makes sense to be more transparent with what'll actually end up being installed. I have an idea where this kind of metadata would quite easily be able to be inferred from each server's installation steps. For example, a server that has a
Yeah, I'm wondering what would be interesting to display here. I recently added a relative timestamp showing when each server was installed. I think this is the cheapest outlet to experiment with :) All in all, there's only really two features remaining before I feel like this plugin is more or less feature complete, and that is 1) a nicer API to ensure that a set of provided servers are installed (easy to impl), and 2) functionality that allow you to upgrade servers when upgrades are available (either through some UI notification, or automatically behind the scenes). Anything else feels somewhat redundant |
I actually retract the idea of user-level install because you don't want to be dealing with people who didn't setup their package managers correctly. In a perfect world, the user would have configured all the correct paths for their tools, but that's sadly not the case: LunarVim/LunarVim#1468, LunarVim/LunarVim#1463 😢 Regarding the other points, let's take this example.
Here's what I got:
It might be good if
This is why I feel this such an easy fix/feature. Consider this, which will be even easier internally: fd 'package.json' --max-depth=2 | xargs dirname | xargs -I {} npm ls -C {}
# results
# python@ /home/hatsu/.local/share/nvim/lsp_servers/python
# └── pyright@1.1.169
# tsserver@ /home/hatsu/.local/share/nvim/lsp_servers/tsserver
# ├── typescript-language-server@0.6.2
# └── typescript@4.4.3
# yaml@ /home/hatsu/.local/share/nvim/lsp_servers/yaml
# └── yaml-language-server@0.22.0 Do you see how it would make things just a slightly bit easier to display and validate that we're using v0.22.0 of Other observations:
|
I'm not following why you'd either a) want to put this kind of "semantic" state in the file system hierarchy in the first place, and b) why exactly where servers end up being installed is a concern for the (average) end user (other than the guarantee that it's inside the The fact that there exist a Don't you think it'd be much easier to contain this kind of state/logic in the Lua layer? Or I might still be misunderstanding.
Perhaps from a shell scripting perspective. I think the same can easily be implemented in a platform-agnostic manner if each server was responsible for reporting such metadata (so for npm-based installations we'd spawn subprocesses that report back a single package version). This could easily be parallelized with libuv.
If my quick check was correct, 23/50 servers are currently installed via npm, so it's actually not even a majority. But yeah I think the extra capabilities each server would offer (versioning, pinning, whatnot) will be entirely constrained by how it's installed in the first place. npm-based distributions can be heavily standardized whereas servers that require custom build scripts will not. |
I've started experimenting with this now, preview: https://asciinema.org/a/Bj6Q03SweLj6gJ7EGNqIr4beU. This is actually pretty easy to implement thanks to the state-driven UI framework that is in place. The question is what's interesting to show.. I'm thinking the following, for starterss: For installed servers:
For uninstalled servers:
Anything else that might be interesting to display? |
This looks like a great feature. Although obvious, how about displaying the full installation path (the LSP server directory or the cmd executable) so that one can navigate if they'd want some troubleshooting? |
That makes sense too I think! I'd probably opt for the server directory itself rather than the full command. The full command should be available via |
I'm actually working on implementing something similar just now There was a small problem where it would try to attach the server immediately if I had the a file with the associated filetype opened. The solution was disabling |
That's so cool 😎 ! However this seems to be a tighter integration between LunarVim and nvim-lsp-installer, and not so much about extending the feature set of nvim-lsp-installer itself - or am I missing something 🤔 ? Regarding the race condition - this might be because the |
I also have plans on adding something similar to what you're doing actually! I just pushed a somewhat finished version of it to |
Oh my bad, I misread the command name and thought it was an auto-installer! The two features that I would like to see, and can even help with, are:
I feel like the last point might be tricky, but I hope not. |
Yeah now most interactions with the plugin will be centered around the UI window. Implementing a floating window instead of a regular vertical split should actually be pretty straight forward. The code is a bit so-so and not really considered stable yet, but this is the part responsible for opening the window. I'd like to avoid having options for everything so I think either a floating window or vertical split window should be supported, not both. I don't have any strong opinions so happy to receive PR changing to floating window!
This should be possible today. The drawback is that if you bypass the APIs that are attached to the UI window, the UI window will become out of sync with any operations done outside of it. What you're interested in would be edit: Everything's technically possible:tm:, so we could make sure to funnel everything through some centralized state management while allowing for 3rd party use cases (basically lift the state management from the |
Yeah that's understandable, take a look at #98 and see if it's good enough. |
Some more progress on this: https://asciinema.org/a/fmqCxtLUR4HrqLcbteNaMGQqR |
How's the performance? I messed around a bit with |
Do you mean in terms of latency? It's perfectly fine for me, although the "latest version" is network-bound so ymmv. What happens is that when you expand a server it'll gather each individual data point separately in a subprocess via libuv, so in terms of perceived performance I don't think yarn vs npm will matter |
Good to know! I've heard conflicting tales about the superiority of |
Hehe maybe you need some |
Note to self: I realized for node packages we could probably bypass npm entirely through something like: local package_json = vim.json.decode(fs.read_file(path.concat { server.root_dir, "node_modules", package, "package.json" })
package_json.version |
And for fetching latest versions https://api.npms.io might be more interesting than going through npm cli, like: local package = vim.json.decode(fetch(("https://api.npms.io/v2/package/%s"):format(package_name)))
local latest_version = package.collected.metadata.version |
I recently learned that |
Can you check this can be help for dont use the api :) https://stackoverflow.com/questions/10972176/find-the-version-of-an-installed-npm-package |
Closing this thread as we've come pretty far in terms of displaying metadata, which was the topic of this issue. As for what was discussed for version checking of servers to allow updating outdated ones - this will be continued in #194. |
What about versions? (currently |
Yeah that won't be forgotten in #194! As long as the data is available, it's really easy to add to the UI |
It's pretty useful to be able to query the
package_name
when it's applicable. This will allow for some flexibility and easy to implement features, here are some of them:sudo
, i,e:pip install --user
and so onlspconfig
. (since you actually neednpm install bash-language-server
forbashls
)LspInstallInfo
per serverLet me know what you think :)
The text was updated successfully, but these errors were encountered: