diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/lsp_setup.vim | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/plugin/lsp_setup.vim b/plugin/lsp_setup.vim index 29ec87f..0349741 100644 --- a/plugin/lsp_setup.vim +++ b/plugin/lsp_setup.vim @@ -2,9 +2,9 @@ let s:setting_dir = expand('<sfile>:h:h').'/setting' let s:installer_dir = expand('<sfile>:h:h').'/installer' let s:setting = json_decode(join(readfile(expand('<sfile>:h:h').'/setting.json'), "\n")) -function! s:vimlsp_install_server() abort +function! s:vimlsp_installer() if empty(s:setting[&filetype]) - return + return '' endif let l:command = printf('%s/install-%s', s:installer_dir, s:setting[&filetype][0].command) if has('win32') @@ -12,10 +12,21 @@ function! s:vimlsp_install_server() abort else let l:command = substitute(l:command, '/', '\', 'g') . '.sh' endif + if !executable(l:command) + return '' + endif + return l:command +endfunction + +function! s:vimlsp_install_server() abort + let l:command = s:vimlsp_installer() exe 'terminal' l:command endfunction function! s:vimlsp_settings_suggest() abort + if empty(s:vimlsp_installer()) + return + endif echomsg printf("If you want to enable Language Server, please do :LspInstallServer") command -buffer LspInstallServer call s:vimlsp_install_server() endfunction |