diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2020-01-22 19:56:01 +0900 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2020-01-22 19:56:01 +0900 |
commit | d2a871d1cf98fb737c39d6d49341e0eb6ac2d8ae (patch) | |
tree | 4723220d0f8dbf3a4b13f8d83845ef40a18e3d2f /plugin | |
parent | d7be9b1ed2cefcd7a02f4a853974c98fd1b5fb84 (diff) | |
download | vim-lsp-settings-d2a871d1cf98fb737c39d6d49341e0eb6ac2d8ae.tar.gz vim-lsp-settings-d2a871d1cf98fb737c39d6d49341e0eb6ac2d8ae.tar.bz2 vim-lsp-settings-d2a871d1cf98fb737c39d6d49341e0eb6ac2d8ae.zip |
Add checker
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/lsp_settings.vim | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/plugin/lsp_settings.vim b/plugin/lsp_settings.vim index cf368be..dcf4a3d 100644 --- a/plugin/lsp_settings.vim +++ b/plugin/lsp_settings.vim @@ -4,6 +4,7 @@ endif let g:loaded_lsp_settings= 1 let s:settings_dir = expand('<sfile>:h:h').'/settings' +let s:checkers_dir = expand('<sfile>:h:h').'/checkers' let s:installer_dir = expand('<sfile>:h:h').'/installer' let s:servers_dir = expand('<sfile>:h:h').'/servers' let s:settings = json_decode(join(readfile(expand('<sfile>:h:h').'/settings.json'), "\n")) @@ -203,13 +204,28 @@ function! s:vimlsp_load_or_suggest(ft) abort if type(l:command) == type([]) let l:command = l:command[0] endif - if s:executable(l:command) - let l:script = printf('%s/%s.vim', s:settings_dir, l:server.command) - if filereadable(l:script) - exe 'source' l:script - let l:found += 1 - break + if !s:executable(l:command) + let l:script = printf('%s/%s.vim', s:checkers_dir, l:server.command) + if !filereadable(l:script) || get(l:server, 'disabled', 0) == 1 + continue endif + try + exe 'source' l:script + let l:command = LspCheckCommand() + catch + continue + finally + let l:server['disabled'] = 1 + if exists('*LspCheckCommand') + delfunction LspCheckCommand + endif + endtry + endif + let l:script = printf('%s/%s.vim', s:settings_dir, l:server.command) + if filereadable(l:script) + exe 'source' l:script + let l:found += 1 + break endif endfor |