From 00294b84031711013a385f18c0fb0e8db84ebaf9 Mon Sep 17 00:00:00 2001 From: William Boman Date: Tue, 7 Sep 2021 02:44:09 +0200 Subject: add direct integration with libuv instead of going through termopen, also implement a UI (#79) * add direct integration with libuv instead of going through termopen, also implement a UI * alleged free perf boosts yo that's free cycles --- plugin/nvim-lsp-installer.vim | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'plugin') diff --git a/plugin/nvim-lsp-installer.vim b/plugin/nvim-lsp-installer.vim index cd610f3c..1cd772ef 100644 --- a/plugin/nvim-lsp-installer.vim +++ b/plugin/nvim-lsp-installer.vim @@ -10,36 +10,45 @@ function! s:MapServerName(servers) abort endfunction function! s:LspInstallCompletion(...) abort - return join(sort(s:MapServerName(luaeval("require'nvim-lsp-installer'.get_available_servers()"))), "\n") + return join(sort(s:MapServerName(luaeval("require'nvim-lsp-installer.servers'.get_available_servers()"))), "\n") endfunction function! s:LspUninstallCompletion(...) abort - return join(sort(s:MapServerName(luaeval("require'nvim-lsp-installer'.get_installed_servers()"))), "\n") + return join(sort(s:MapServerName(luaeval("require'nvim-lsp-installer.servers'.get_installed_servers()"))), "\n") endfunction -function! s:LspInstall(server_name) abort - call luaeval("require'nvim-lsp-installer'.install(_A)", a:server_name) +function! s:LspInstall(server_names) abort + for server_name in split(a:server_names, " ") + call luaeval("require'nvim-lsp-installer'.install(_A)", server_name) + endfor endfunction -function! s:LspUninstall(server_name) abort - call luaeval("require'nvim-lsp-installer'.uninstall(_A)", a:server_name) +function! s:LspUninstall(server_names) abort + for server_name in split(a:server_names, " ") + call luaeval("require'nvim-lsp-installer'.uninstall(_A)", server_name) + endfor endfunction function! s:LspUninstallAll() abort - for server in s:MapServerName(luaeval("require'nvim-lsp-installer'.get_installed_servers()")) + for server in s:MapServerName(luaeval("require'nvim-lsp-installer.servers'.get_installed_servers()")) call s:LspUninstall(server) endfor endfunction function! s:LspPrintInstalled() abort - echo s:MapServerName(luaeval("require'nvim-lsp-installer'.get_installed_servers()")) + echo s:MapServerName(luaeval("require'nvim-lsp-installer.servers'.get_installed_servers()")) +endfunction + +function! s:LspInstallInfo() abort + lua require'nvim-lsp-installer'.display() endfunction -command! -nargs=1 -complete=custom,s:LspInstallCompletion LspInstall exe s:LspInstall("") -command! -nargs=1 -complete=custom,s:LspUninstallCompletion LspUninstall exe s:LspUninstall("") +command! -nargs=+ -complete=custom,s:LspInstallCompletion LspInstall exe s:LspInstall("") +command! -nargs=+ -complete=custom,s:LspUninstallCompletion LspUninstall exe s:LspUninstall("") command! LspUninstallAll call s:LspUninstallAll() command! LspPrintInstalled call s:LspPrintInstalled() +command! LspInstallInfo call s:LspInstallInfo() autocmd User LspAttachBuffers lua require"nvim-lsp-installer".lsp_attach_proxy() -- cgit v1.2.3-70-g09d2