diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2019-12-15 15:31:44 +0900 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2019-12-15 15:31:44 +0900 |
commit | c972a43e49fa8b25b34254c73b6bea30ca5fc2fc (patch) | |
tree | f0369030cd1ba8bff2cc45dba263b58bacf0f1ca /plugin | |
parent | 77e3fe3f2b6c55d5a2f4e4efa39bf7f3ac39623d (diff) | |
download | vim-lsp-settings-c972a43e49fa8b25b34254c73b6bea30ca5fc2fc.tar.gz vim-lsp-settings-c972a43e49fa8b25b34254c73b6bea30ca5fc2fc.tar.bz2 vim-lsp-settings-c972a43e49fa8b25b34254c73b6bea30ca5fc2fc.zip |
Check requires
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/lsp_setup.vim | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/plugin/lsp_setup.vim b/plugin/lsp_setup.vim index 91499b6..59c6fcb 100644 --- a/plugin/lsp_setup.vim +++ b/plugin/lsp_setup.vim @@ -3,10 +3,28 @@ 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_installer() - if empty(s:setting[&filetype]) + let l:setting = s:setting[&filetype] + if empty(l:setting) return '' endif - let l:command = printf('%s/install-%s', s:installer_dir, s:setting[&filetype][0].command) + let l:found = {} + for l:conf in l:setting + let l:missing = 0 + for l:require in l:conf.requires + if !executable(l:require) + let l:missing = 1 + break + endif + endfor + if l:missing == 0 + let l:found = l:conf + break + endif + endfor + if empty(l:found) + return '' + endif + let l:command = printf('%s/install-%s', s:installer_dir, l:setting[0].command) if has('win32') let l:command = substitute(l:command, '/', '\', 'g') . '.cmd' else |