fix: lualine LSP client depreciation warning, fixes #1
This commit is contained in:
parent
2ba4c993ed
commit
ba271f705b
1 changed files with 15 additions and 14 deletions
|
|
@ -1,20 +1,21 @@
|
||||||
-- status line like vim-airline
|
-- status line like vim-airline
|
||||||
|
|
||||||
-- Display attached LSP client
|
-- Display attached LSP client
|
||||||
local function lsp_clients()
|
local function lsp_client_name()
|
||||||
local clients = vim.lsp.get_active_clients()
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
local client_names = {}
|
|
||||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
-- local clients = vim.lsp.buf_get_clients(bufnr)
|
||||||
for _, client in ipairs(clients) do
|
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||||
local filetypes = client.config.filetypes
|
if next(clients) == nil then
|
||||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
return "n/a"
|
||||||
return client.name
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if next(client_names) == nil then
|
|
||||||
return "no LS"
|
local c = {}
|
||||||
|
for _, client in pairs(clients) do
|
||||||
|
table.insert(c, client.name)
|
||||||
|
-- table.insert(c, string.sub(client.name, 0, 8) .. "...")
|
||||||
end
|
end
|
||||||
--return "[" .. table.concat(client_names, ", ") .. "]"
|
return "\u{f085} " .. table.concat(c, ",")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hide content on narrow windows
|
-- hide content on narrow windows
|
||||||
|
|
@ -69,8 +70,8 @@ return {
|
||||||
-- specify full list of elements when adding custom things
|
-- specify full list of elements when adding custom things
|
||||||
{ "encoding", cond = hide_in_width },
|
{ "encoding", cond = hide_in_width },
|
||||||
{ "fileformat" },
|
{ "fileformat" },
|
||||||
{ "filetype" },
|
{ "filetype", cond = hide_in_width },
|
||||||
{ lsp_clients, cond = hide_in_width },
|
{ lsp_client_name, cond = hide_in_width },
|
||||||
--{ clock, cond = hide_in_width },
|
--{ clock, cond = hide_in_width },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue