feat: add user command to list active LSP clients

This commit is contained in:
2024-12-11 14:45:20 -05:00
parent b8805d7507
commit f986297e51
+12
View File
@@ -55,3 +55,15 @@ vim.keymap.set('n', 'q:', function()
require('data.func').pick('command_history')
end, opts)
vim.api.nvim_create_user_command('ListLspClients', function()
local clients = vim.lsp.get_active_clients({ bufnr = 0 })
if #clients == 0 then
print('No LSP attached')
else
local names = {}
for _, client in ipairs(clients) do
table.insert(names, client.name)
end
print('Attached LSP(s): ' .. table.concat(names, ', '))
end
end, {})