From fab66bb68570a68d35747bf9a1182fe1a66a3502 Mon Sep 17 00:00:00 2001 From: Matt Leong Date: Fri, 12 Nov 2021 13:26:27 -0800 Subject: [PATCH] fix(utils): fix issue with reloading cosmic --- lua/cosmic/utils.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/cosmic/utils.lua b/lua/cosmic/utils.lua index 648d978..60c1914 100644 --- a/lua/cosmic/utils.lua +++ b/lua/cosmic/utils.lua @@ -43,11 +43,13 @@ function M.get_active_lsp_client_names() local buf = vim.api.nvim_get_current_buf() -- only return attached buffers if vim.lsp.buf_is_attached(buf, client.id) then - table.insert(client_names, i, client.name) + table.insert(client_names, client.name) end end - table.sort(client_names) + if not vim.tbl_isempty(client_names) then + table.sort(client_names) + end return client_names end @@ -70,6 +72,7 @@ end function M.reload_cosmic() unload('cosmic') require('cosmic') + vim.cmd(':e') end function M.get_install_dir()