Open justinmk opened 1 month ago
Can information such as tool versions be derived from the LSP server response instead?
No way lsp spec doesn't have a method to get information of server instead :!clangd --version
not enough ? the only usage of config.lspinfo is in hls..so i think you don't need worry about there..
updated proposal. clangd --version
requires config-specific stuff and doesn't address things like https://github.com/neovim/nvim-lspconfig/pull/1693 which wants to report the "project file".
aha okay so can we add a health field instead of lspinfo
in configs ? this can lead more users to pay attention to checkhealth . default use info level is enought health_info(table.concat(configs.health()), '\n')
add a health field instead of
lspinfo
in configs
No. That wouldn't be any different than the existing config.lspinfo
field.
What I'm asking is first, what info does the LSP client already know, that can be displayed by checkhealth. Does workspace/workspaceFolders
report anything useful?
And why isn't root_dir
enough to provide what was intended in https://github.com/neovim/nvim-lspconfig/pull/1693 @TamaMcGlinn ? root_dir
already defines the *.gpr
pattern, so why can't checkhealth use root_dir
to say which pattern matched, then report that?
so why can't checkhealth use root_dir to say which pattern matched, then report that?
Because there could be multiple *.gpr
files in a same root directory, so root_dir
isn't enough to know which one is being used by the ada language server. In such a case, clients will often use workspace/didChangeConfiguration
to select a .gpr
file, but storing and re-displaying that information would not work in cases where the client let the server choose a .gpr
file.
instead
:!clangd --version
not enough ?
Maybe I misunderstood your suggestion. I think LspInfo could just do this automatically, by running [cmd, '--version']
. No need to manually bake that into each config, as hls.lua currently does. Done: https://github.com/neovim/nvim-lspconfig/pull/3375 https://github.com/neovim/nvim-lspconfig/pull/3383
The output for checkhealth looks pretty bad when the current buffer is attached to gopls
since it ends up printing a very large 'help' page (that gopls
spits out) as the version for gopls
.
gopls
only reports the version if you run gopls version
.
Is there a way to override how the version check occurs? Or maybe just "version" can be added to the list of options in try_format_version
.
Or maybe just "version" can be added to the list of options in
try_format_version
.
yes, that is the idea :) PR welcome...
since it ends up printing a very large 'help' page (that
gopls
spits out)
we should truncate the output. Done: https://github.com/neovim/nvim-lspconfig/pull/3388
Added version
for gopls. #3386
Probably need to add status command to each config.
Probably need to add status command to each config.
No. If server commands can't be bothered to provide --version
, we aren't going to maintain special workarounds for them. They can either provide --version
or we will report "failed to get version". It is idiotic that they don't provide --version
, or some other common arg to get version/status info.
Could :LspInfo
also list root_dir? I have this situation:
pyproject.toml
a.py
test/
test_a.py
ruff.toml
ruff.lua
lspconfig has this (but also mentions .git
in the description, is that a general default?):
local root_files = {
'pyproject.toml',
'ruff.toml',
'.ruff.toml',
}
and I currently don't understand if I'm supposed to see one or two ruff LSP servers launched when I open both a.py
and test_a.py
Could
:LspInfo
also list root_dir?
Thanks, that was a regression. Fixed in https://github.com/neovim/nvim-lspconfig/pull/3402
Something I'd like to see is whether an LSP has document formatting support. I have a BufWritePre
hook that will format the buffer using all available LSPs. Sometimes that doesn't behave in the way I want (e.g. conflicting styles) so I'd like to know which LSPs are being triggered.
I'm not sure this should be included in lspconfig or if a new API should exist to allow end-users to configure additional status functions to be ran for all language servers.
Description
https://github.com/neovim/nvim-lspconfig/pull/3375 removes an undocumented
config.lspinfo
extension point that was intended to allow config-specific augmentation of the LspInfo report. Can information such as tool versions be derived from LSP client info and/or server responses instead?Example use case: https://github.com/neovim/nvim-lspconfig/pull/1693 which wants to report the "project file".
Proposal
<cmd> --version
result. 3375, 3383 3388workspace/configuration
, so it knows its own configuration. Why can't LspInfo ask the cient for this kind of info?workspace/workspaceFolders
, which sounds related toinitialize
,workspace/didChangeConfiguration
, etc. If that info is available via e.g.vim.lsp.get_clients()
, then LspInfo can use it. If info isn't available viavim.lsp.get_clients()
, then question is why, and should it be?suggested by @glacambre :
Maybe
vim.lsp.Client
could have astatusCmds: string[]
field which defines how "status" can be reported by a server.