aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2019-12-16 23:50:29 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2019-12-16 23:50:29 +0900
commit933ed95d2d0d112907ab331b200b2dbb2de11f49 (patch)
treec65622aeae2f7e2400623dff2e2607e0c8bcbcea /plugin
parent70831679422a4134001ce9f0c6bde3d9d4db0096 (diff)
downloadvim-lsp-settings-933ed95d2d0d112907ab331b200b2dbb2de11f49.tar.gz
vim-lsp-settings-933ed95d2d0d112907ab331b200b2dbb2de11f49.tar.bz2
vim-lsp-settings-933ed95d2d0d112907ab331b200b2dbb2de11f49.zip
Add installer
Diffstat (limited to 'plugin')
-rw-r--r--plugin/lsp_setup.vim38
1 files changed, 20 insertions, 18 deletions
diff --git a/plugin/lsp_setup.vim b/plugin/lsp_setup.vim
index 9deb09f..60abfa1 100644
--- a/plugin/lsp_setup.vim
+++ b/plugin/lsp_setup.vim
@@ -31,12 +31,12 @@ function! s:vimlsp_installer() abort
if !has_key(s:settings, &filetype)
return ''
endif
- let l:setting = s:settings[&filetype]
- if empty(l:setting)
+ let l:server = s:settings[&filetype]
+ if empty(l:server)
return ''
endif
let l:found = {}
- for l:conf in l:setting
+ for l:conf in l:server
let l:missing = 0
for l:require in l:conf.requires
if !s:executable(l:require)
@@ -52,20 +52,22 @@ function! s:vimlsp_installer() abort
if empty(l:found)
return ''
endif
- let l:command = s:vimlsp_settings_get(l:setting[0].command, 'cmd', l:setting[0].command)
- if type(l:command) == type([])
- let l:command = l:command[0]
- endif
- let l:command = printf('%s/install-%s', s:installer_dir, l:command)
- if has('win32')
- let l:command = substitute(l:command, '/', '\', 'g') . '.cmd'
- else
- let l:command = l:command . '.sh'
- endif
- if !s:executable(l:command)
- return ''
- endif
- return l:command
+ for l:conf in l:server
+ let l:command = s:vimlsp_settings_get(l:conf.command, 'cmd', l:conf.command)
+ if type(l:command) == type([])
+ let l:command = l:command[0]
+ endif
+ let l:command = printf('%s/install-%s', s:installer_dir, l:command)
+ if has('win32')
+ let l:command = substitute(l:command, '/', '\', 'g') . '.cmd'
+ else
+ let l:command = l:command . '.sh'
+ endif
+ if s:executable(l:command)
+ return l:command
+ endif
+ endfor
+ return ''
endfunction
function! s:vimlsp_install_server() abort
@@ -77,7 +79,7 @@ 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")
+ echomsg printf('If you want to enable Language Server, please do :LspInstallServer')
command! -buffer LspInstallServer call s:vimlsp_install_server()
endfunction