aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-10-25 07:50:39 -0700
committerGitHub <noreply@github.com>2024-10-25 07:50:39 -0700
commit4ae8ea049034a4f1b95b3e671ab9d35c16eeafb9 (patch)
tree386c81e84bb97111ae58c748a89ae98a4c8ffc3e /lua
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-4ae8ea049034a4f1b95b3e671ab9d35c16eeafb9.tar
nvim-lspconfig-4ae8ea049034a4f1b95b3e671ab9d35c16eeafb9.tar.gz
nvim-lspconfig-4ae8ea049034a4f1b95b3e671ab9d35c16eeafb9.tar.bz2
nvim-lspconfig-4ae8ea049034a4f1b95b3e671ab9d35c16eeafb9.tar.lz
nvim-lspconfig-4ae8ea049034a4f1b95b3e671ab9d35c16eeafb9.tar.xz
nvim-lspconfig-4ae8ea049034a4f1b95b3e671ab9d35c16eeafb9.tar.zst
nvim-lspconfig-4ae8ea049034a4f1b95b3e671ab9d35c16eeafb9.zip
fix(health): "root directory" not reported #3402
Problem: "root directory" not reported. Solution: report root_dir. regression from b55b9659de9ac17e05df4787bb023e4c7ef45329
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/health.lua19
1 files changed, 10 insertions, 9 deletions
diff --git a/lua/lspconfig/health.lua b/lua/lspconfig/health.lua
index 62b489c6..d92e7c0c 100644
--- a/lua/lspconfig/health.lua
+++ b/lua/lspconfig/health.lua
@@ -88,9 +88,11 @@ local function fmtpath(p)
if vim.startswith(p, 'Running') then
return p
end
+ local isdir = 0 ~= vim.fn.isdirectory(vim.fn.expand(p))
local r = vim.fn.fnamemodify(p, ':~')
- -- If the path ends with "~" add a space (:checkhealth currently uses ft=help).
- return r .. (vim.endswith(r, '~') and ' ' or '')
+ -- Force directory path to end with "/".
+ -- Bonus: avoids wrong highlighting for "~" (because :checkhealth currently uses ft=help).
+ return r .. ((isdir and not r:find('[/\\\\]%s*$')) and '/' or '')
end
local cmd_type = {
@@ -205,17 +207,16 @@ local function make_client_info(client, fname)
end
end
end
-
if not client_info.root_dir then
client_info.root_dir = 'Running in single file mode.'
end
- client_info.attached_buffers_list = table.concat(vim.lsp.get_buffers_by_client_id(client.id), ', ')
- table.insert(
- info_lines,
- 1,
- ('Client: %s (id: %s, bufnr: [%s])'):format(client.name, client.id, client_info.attached_buffers_list)
- )
+ client_info.attached_bufs = table.concat(vim.lsp.get_buffers_by_client_id(client.id), ', ')
+
+ info_lines = vim.list_extend({
+ ('Client: `%s` (id: %s, bufnr: [%s])'):format(client.name, client.id, client_info.attached_bufs),
+ 'root directory: ' .. fmtpath(client_info.root_dir),
+ }, info_lines)
return table.concat(info_lines, '\n')
end