This commit is contained in:
Zacharias-Brohn
2025-02-15 22:59:12 +01:00
parent 9e53ed6666
commit 2ac5fc926a
6 changed files with 213 additions and 47 deletions
+15 -10
View File
@@ -1,16 +1,21 @@
local fn = vim.fn
local function get_coc_lsp_client()
local clients = vim.g.coc_service_initialized and vim.fn['CocAction']('services') or {}
for _, client in pairs(clients) do
if client['state'] == 'running' then
local client_name = client['id']
-- Remove 'languageserver.' prefix if it exists
client_name = client_name:gsub('^languageserver%.', '')
return client_name
local get_active_lsp = function()
local msg = "🚫"
local buf_ft = vim.api.nvim_get_option_value("filetype", {})
local clients = vim.lsp.get_clients { bufnr = 0 }
if next(clients) == nil then
return msg
end
for _, client in ipairs(clients) do
---@diagnostic disable-next-line: undefined-field
local filetypes = client.config.filetypes
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
return client.name
end
end
return ''
return msg
end
local function spell()
@@ -127,7 +132,7 @@ require("lualine").setup {
color = { fg = "black", bg = "#f46868" },
},
{
get_coc_lsp_client,
get_active_lsp,
icon = " LSP:",
},
{