aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorWilliam Boman <william@redwill.se>2021-12-13 07:54:47 +0100
committerGitHub <noreply@github.com>2021-12-13 07:54:47 +0100
commitd7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2 (patch)
tree0c697a373655d0e5fd2907ff5787942001c86cf2 /plugin
parent.github: update new server request template (diff)
downloadmason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar.gz
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar.bz2
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar.lz
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar.xz
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.tar.zst
mason-d7b10b13d72d4bf8f7b34779ddc3514bcc26b0f2.zip
feat: allow server installation by just typing `:LspInstall` (#331)
This will prompt the user which server associated with the currently opened buffer's &filetype to install.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/nvim-lsp-installer.vim15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugin/nvim-lsp-installer.vim b/plugin/nvim-lsp-installer.vim
index e6470072..3829384c 100644
--- a/plugin/nvim-lsp-installer.vim
+++ b/plugin/nvim-lsp-installer.vim
@@ -19,6 +19,9 @@ function! s:LspUninstallAllCompletion(...) abort
endfunction
function! s:ParseArgs(args)
+ if len(a:args) == 0
+ return { 'sync': v:false, 'servers': [] }
+ endif
let sync = a:args[0] == "--sync"
let servers = sync ? a:args[1:] : a:args
return { 'sync': sync, 'servers': servers }
@@ -29,9 +32,13 @@ function! s:LspInstall(args) abort
if parsed_args.sync
call luaeval("require'nvim-lsp-installer'.install_sync(_A)", parsed_args.servers)
else
- for server_name in l:parsed_args.servers
- call luaeval("require'nvim-lsp-installer'.install(_A)", server_name)
- endfor
+ if len(parsed_args.servers) == 0
+ call luaeval("require'nvim-lsp-installer'.install_by_filetype(_A)", &filetype)
+ else
+ for server_name in l:parsed_args.servers
+ call luaeval("require'nvim-lsp-installer'.install(_A)", server_name)
+ endfor
+ endif
endif
endfunction
@@ -63,7 +70,7 @@ function! s:LspInstallLog() abort
exe 'tabnew ' .. luaeval("require'nvim-lsp-installer.log'.outfile")
endfunction
-command! -bar -nargs=+ -complete=custom,s:LspInstallCompletion LspInstall call s:LspInstall([<f-args>])
+command! -bar -nargs=* -complete=custom,s:LspInstallCompletion LspInstall call s:LspInstall([<f-args>])
command! -bar -nargs=+ -complete=custom,s:LspUninstallCompletion LspUninstall call s:LspUninstall([<f-args>])
command! -bar -nargs=? -complete=custom,s:LspUninstallAllCompletion LspUninstallAll call s:LspUninstallAll([<f-args>])