diff options
| author | William Boman <william@redwill.se> | 2021-04-05 14:19:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-05 14:19:07 +0200 |
| commit | dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb (patch) | |
| tree | 419e086d757624aa9e2bcaa456e02a6c8f7a3968 /plugin/nvim-lsp-installer.vim | |
| parent | eslintls: avoid globbing/word splitting (diff) | |
| download | mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar.gz mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar.bz2 mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar.lz mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar.xz mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.tar.zst mason-dcf117a8a60d887a2c2ff9d5617a9c39c5ee95fb.zip | |
rename Installer to Server for clarity (#3)
Diffstat (limited to 'plugin/nvim-lsp-installer.vim')
| -rw-r--r-- | plugin/nvim-lsp-installer.vim | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/plugin/nvim-lsp-installer.vim b/plugin/nvim-lsp-installer.vim index 34277863..48f6a96b 100644 --- a/plugin/nvim-lsp-installer.vim +++ b/plugin/nvim-lsp-installer.vim @@ -4,38 +4,40 @@ let g:loaded_nvim_lsp_installer = 1 let s:save_cpo = &cpo set cpo&vim +function! s:MapServerName(servers) abort + return map(a:servers, {_, val -> val.name}) +endfunction + function! s:LspInstallCompletion(...) abort - return join(luaeval("require'nvim-lsp-installer'.get_available_servers()"), "\n") + return join(s:MapServerName(luaeval("require'nvim-lsp-installer'.get_available_servers()")), "\n") endfunction function! s:LspUninstallCompletion(...) abort - return join( - \ map(luaeval("require'nvim-lsp-installer'.get_installed_servers()"), {_, val -> val.name}), - \ "\n") + return join(s:MapServerName(luaeval("require'nvim-lsp-installer'.get_installed_servers()")), "\n") endfunction -function! s:LspInstall(server) abort - call luaeval("require'nvim-lsp-installer'.install(_A)", a:server) +function! s:LspInstall(server_name) abort + call luaeval("require'nvim-lsp-installer'.install(_A)", a:server_name) endfunction function! s:LspInstallAll() abort - for server in luaeval("require'nvim-lsp-installer'.get_uninstalled_servers()") - call luaeval("require'nvim-lsp-installer'.install(_A)", server) + for server_name in s:MapServerName(luaeval("require'nvim-lsp-installer'.get_uninstalled_servers()")) + call luaeval("require'nvim-lsp-installer'.install(_A)", server_name) endfor endfunction -function! s:LspUninstall(server) abort - call luaeval("require'nvim-lsp-installer'.uninstall(_A)", a:server) +function! s:LspUninstall(server_name) abort + call luaeval("require'nvim-lsp-installer'.uninstall(_A)", a:server_name) endfunction function! s:LspUninstallAll() abort - for server in luaeval("require'nvim-lsp-installer'.get_installed_servers()") + for server in s:MapServerName(luaeval("require'nvim-lsp-installer'.get_installed_servers()")) call s:LspUninstall(server) endfor endfunction function! s:LspPrintInstalled() abort - echo map(luaeval("require'nvim-lsp-installer'.get_installed_servers()"), {_, val -> val.name}) + echo s:MapServerName(luaeval("require'nvim-lsp-installer'.get_installed_servers()")) endfunction command! -nargs=1 -complete=custom,s:LspInstallCompletion LspInstall exe s:LspInstall("<args>") |
