From f986297e51c070041a03ee902bde61a61081b86c Mon Sep 17 00:00:00 2001 From: rootiest Date: Wed, 11 Dec 2024 14:45:20 -0500 Subject: [PATCH] feat: add user command to list active LSP clients --- lua/config/overrides.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lua/config/overrides.lua b/lua/config/overrides.lua index 462a34e..9add234 100644 --- a/lua/config/overrides.lua +++ b/lua/config/overrides.lua @@ -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, {})