aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/nvim-lsp-installer.lua15
-rw-r--r--plugin/nvim-lsp-installer.vim4
2 files changed, 16 insertions, 3 deletions
diff --git a/lua/nvim-lsp-installer.lua b/lua/nvim-lsp-installer.lua
index 27727370..5b3e7cff 100644
--- a/lua/nvim-lsp-installer.lua
+++ b/lua/nvim-lsp-installer.lua
@@ -27,6 +27,21 @@ function M.uninstall(server_name)
status_win().open()
end
+function M.uninstall_all()
+ local installed_servers = servers.get_installed_servers()
+ if #installed_servers > 0 then
+ local function uninstall(idx)
+ status_win().uninstall_server(installed_servers[idx])
+ if installed_servers[idx + 1] then
+ vim.schedule(function()
+ uninstall(idx + 1)
+ end)
+ end
+ end
+ uninstall(1)
+ end
+end
+
function M.on_server_ready(cb)
dispatcher.register_server_ready_callback(cb)
vim.schedule(function()
diff --git a/plugin/nvim-lsp-installer.vim b/plugin/nvim-lsp-installer.vim
index 1cd772ef..2e2bc315 100644
--- a/plugin/nvim-lsp-installer.vim
+++ b/plugin/nvim-lsp-installer.vim
@@ -30,9 +30,7 @@ function! s:LspUninstall(server_names) abort
endfunction
function! s:LspUninstallAll() abort
- for server in s:MapServerName(luaeval("require'nvim-lsp-installer.servers'.get_installed_servers()"))
- call s:LspUninstall(server)
- endfor
+ lua require'nvim-lsp-installer'.uninstall_all()
endfunction
function! s:LspPrintInstalled() abort