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
|
||||
|
||||
-- Display attached LSP client
|
||||
local function lsp_clients()
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
local client_names = {}
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, "filetype")
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
local function lsp_client_name()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
-- local clients = vim.lsp.buf_get_clients(bufnr)
|
||||
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||
if next(clients) == nil then
|
||||
return "n/a"
|
||||
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
|
||||
--return "[" .. table.concat(client_names, ", ") .. "]"
|
||||
return "\u{f085} " .. table.concat(c, ",")
|
||||
end
|
||||
|
||||
-- hide content on narrow windows
|
||||
|
|
@ -69,8 +70,8 @@ return {
|
|||
-- specify full list of elements when adding custom things
|
||||
{ "encoding", cond = hide_in_width },
|
||||
{ "fileformat" },
|
||||
{ "filetype" },
|
||||
{ lsp_clients, cond = hide_in_width },
|
||||
{ "filetype", cond = hide_in_width },
|
||||
{ lsp_client_name, cond = hide_in_width },
|
||||
--{ clock, cond = hide_in_width },
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue