aboutsummaryrefslogtreecommitdiff
path: root/autoload/lsp_settings.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/lsp_settings.vim')
-rw-r--r--autoload/lsp_settings.vim13
1 files changed, 5 insertions, 8 deletions
diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim
index f1b163e..0305ae9 100644
--- a/autoload/lsp_settings.vim
+++ b/autoload/lsp_settings.vim
@@ -285,7 +285,7 @@ function! s:vim_lsp_install_server_post(command, job, code, ...) abort
call lsp_settings#utils#msg('Installed ' . a:command)
endfunction
-function! s:vim_lsp_install_server(ft, command) abort
+function! s:vim_lsp_install_server(ft, command, bang) abort
if !empty(a:command) && !lsp_settings#utils#valid_name(a:command)
call lsp_settings#utils#error('Invalid server name')
return
@@ -295,6 +295,9 @@ function! s:vim_lsp_install_server(ft, command) abort
call lsp_settings#utils#error('Server not found')
return
endif
+ if empty(a:bang) && confirm(printf('Install %s ?', l:entry[0]), "&Yes\n&Cancel") ==# 2
+ return
+ endif
let l:server_install_dir = lsp_settings#servers_dir() . '/' . l:entry[0]
if isdirectory(l:server_install_dir)
call lsp_settings#utils#msg('Uninstalling ' . l:entry[0])
@@ -324,9 +327,6 @@ function! s:vim_lsp_settings_suggest(ft) abort
echohl Directory
echomsg 'Please do :LspInstallServer to enable Language Server ' . l:entry[0]
echohl None
- if exists(':LspInstallServer') !=# 2
- command! -nargs=? -buffer -complete=customlist,lsp_settings#complete_install LspInstallServer call s:vim_lsp_install_server(&l:filetype, <q-args>)
- endif
endfunction
function! s:vim_lsp_suggest_plugin() abort
@@ -458,11 +458,7 @@ function! s:vim_lsp_load_or_suggest(ft) abort
if exists('#User#lsp_setup') !=# 0
doautocmd User lsp_setup
endif
- if exists(':LspInstallServer') !=# 2
- command! -nargs=? -buffer -complete=customlist,lsp_settings#complete_install LspInstallServer call s:vim_lsp_install_server(&l:filetype, <q-args>)
- endif
endif
-
endfunction
function! lsp_settings#clear() abort
@@ -484,5 +480,6 @@ function! lsp_settings#init() abort
autocmd BufNewFile,BufRead * call s:vim_lsp_suggest_plugin()
augroup END
command! -nargs=? -complete=customlist,lsp_settings#complete_uninstall LspUninstallServer call s:vim_lsp_uninstall_server(<q-args>)
+ command! -bang -nargs=? -complete=customlist,lsp_settings#complete_install LspInstallServer call s:vim_lsp_install_server(&l:filetype, <q-args>, '<bang>')
call s:vim_lsp_load_or_suggest('_')
endfunction