From 978d09ad437fcc71d0bc928a10436dbfd537d401 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Tue, 18 Feb 2020 17:31:55 +0900 Subject: If the default server is specified as list, continue to look next --- autoload/lsp_settings.vim | 21 ++++++++++++++++++--- settings.json | 12 ++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim index d9a6a5b..f1b163e 100644 --- a/autoload/lsp_settings.vim +++ b/autoload/lsp_settings.vim @@ -391,6 +391,8 @@ function! s:vim_lsp_load_or_suggest(ft) abort command! -nargs=1 LspRegisterServer autocmd User lsp_setup call lsp#register_server() endif + let l:default = get(g:, 'lsp_settings_' . a:ft, '') + let l:found = 0 let l:disabled = 0 @@ -399,10 +401,19 @@ function! s:vim_lsp_load_or_suggest(ft) abort let l:disabled += 1 continue endif - let l:default = get(g:, 'lsp_settings_' . a:ft, '') - if !empty(l:default) && l:default != l:server.command + + if type(l:default) ==# v:t_list + if len(l:default) ># 0 && index(l:default, l:server.command) == -1 + continue + endif + elseif type(l:default) ==# v:t_string + if !empty(l:default) && l:default != l:server.command + continue + endif + else continue endif + let l:command = lsp_settings#get(l:server.command, 'cmd', []) if empty(l:command) && !lsp_settings#executable(l:server.command) let l:script = printf('%s/%s.vim', s:checkers_dir, l:server.command) @@ -429,7 +440,11 @@ function! s:vim_lsp_load_or_suggest(ft) abort exe 'source' l:script let l:found += 1 let s:ftmap[a:ft] = 1 - break + + " If default server is specified as list, continue to look next. + if type(l:default) !=# v:t_list + break + endif endif endfor diff --git a/settings.json b/settings.json index 046f307..7847d2b 100644 --- a/settings.json +++ b/settings.json @@ -241,6 +241,12 @@ "requires": [ "npm" ] + }, + { + "command": "eslint-language-server", + "requires": [ + "git", "npm" + ] } ], "javascriptreact": [ @@ -554,6 +560,12 @@ "requires": [ "npm" ] + }, + { + "command": "eslint-language-server", + "requires": [ + "git", "npm" + ] } ], "typescriptreact": [ -- cgit v1.2.3-54-g00ecf