aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/health.lua
diff options
context:
space:
mode:
authorBogdan Grigoruță <43993819+krady21@users.noreply.github.com>2023-09-24 21:43:16 +0300
committerGitHub <noreply@github.com>2023-09-24 11:43:16 -0700
commitd1bc6fca7123d77ebf03d0badd63f930a5b74064 (patch)
treef8f98d83a6ed64419540dcc0910b6781ac38b3bf /runtime/lua/vim/lsp/health.lua
parent0592fd5e17dc3609c148e0ccc25a4f035d5f7153 (diff)
downloadrneovim-d1bc6fca7123d77ebf03d0badd63f930a5b74064.tar.gz
rneovim-d1bc6fca7123d77ebf03d0badd63f930a5b74064.tar.bz2
rneovim-d1bc6fca7123d77ebf03d0badd63f930a5b74064.zip
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 (limited to 'runtime/lua/vim/lsp/health.lua')
-rw-r--r--runtime/lua/vim/lsp/health.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp/health.lua b/runtime/lua/vim/lsp/health.lua
index 023b1c26be..fe06006108 100644
--- 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