commit d1bc6fca7123d77ebf03d0badd63f930a5b74064
parent 0592fd5e17dc3609c148e0ccc25a4f035d5f7153
Author: Bogdan Grigoruță <43993819+krady21@users.noreply.github.com>
Date: Sun, 24 Sep 2023 21:43:16 +0300
feat(health): list attached buffers in LSP report #23561
Problem:
Users using `vim.lsp.start` directly (instead of nvim-lspconfig) need
more visibility for troubleshooting. For example, troubleshooting
unnecesary servers or servers that aren't attaching to expected buffers.
Solution:
Mention attached buffers in the `:checkhealth lsp` report.
Example:
vim.lsp: Active Clients ~
- clangd (id=1, root_dir=~/dev/neovim, attached_to=[7])
- lua_ls (id=2, root_dir=~/dev/neovim, attached_to=[10])
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/runtime/lua/vim/lsp/health.lua b/runtime/lua/vim/lsp/health.lua
@@ -32,8 +32,15 @@ function M.check()
vim.health.start('vim.lsp: Active Clients')
if next(clients) then
for _, client in pairs(clients) do
+ local attached_to = table.concat(vim.tbl_keys(client.attached_buffers or {}), ',')
report_info(
- string.format('%s (id=%s, root_dir=%s)', client.name, client.id, client.config.root_dir)
+ string.format(
+ '%s (id=%s, root_dir=%s, attached_to=[%s])',
+ client.name,
+ client.id,
+ vim.fn.fnamemodify(client.config.root_dir, ':~'),
+ attached_to
+ )
)
end
else