home: vim: add function to list LSP client names

This commit is contained in:
Bruno BELANYI 2022-03-02 13:50:32 +01:00
parent c5fff38942
commit 213d698d56

View file

@ -14,6 +14,20 @@ M.is_executable_condition = function(cmd)
return function() return M.is_executable(cmd) end return function() return M.is_executable(cmd) end
end end
-- list all active LSP clients for current buffer
-- @param bufnr int? buffer number
-- @return table all active LSP client names
M.list_lsp_clients = function(bufnr)
local clients = vim.lsp.buf_get_clients(bufnr)
local names = {}
for _, client in ipairs(clients) do
table.insert(names, client.name)
end
return names
end
-- shared LSP configuration callback -- shared LSP configuration callback
-- @param client native client configuration -- @param client native client configuration
-- @param bufnr int? buffer number of the attched client -- @param bufnr int? buffer number of the attched client