diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2020-02-20 14:50:44 +0900 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2020-02-20 14:50:44 +0900 |
commit | c61920a55b3f7c56a837f2bd650a64fbbcce383e (patch) | |
tree | c1ce933744ad087113cdb6ba15c33ba9a68df497 /autoload/lsp_settings.vim | |
parent | 750d4f135267fefbcfaa993abb0912c158fb92fd (diff) | |
parent | 7734093728215b27db4e10a6603e043569974374 (diff) | |
download | vim-lsp-settings-c61920a55b3f7c56a837f2bd650a64fbbcce383e.tar.gz vim-lsp-settings-c61920a55b3f7c56a837f2bd650a64fbbcce383e.tar.bz2 vim-lsp-settings-c61920a55b3f7c56a837f2bd650a64fbbcce383e.zip |
Merge branch 'master' of https://github.com/mattn/vim-lsp-settings
Diffstat (limited to 'autoload/lsp_settings.vim')
-rw-r--r-- | autoload/lsp_settings.vim | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim index 0305ae9..fd908c6 100644 --- a/autoload/lsp_settings.vim +++ b/autoload/lsp_settings.vim @@ -168,13 +168,24 @@ function! lsp_settings#exec_path(cmd) abort return '' endfunction -function! lsp_settings#root_path(...) abort +function! lsp_settings#root_path(name) abort let l:patterns = get(a:000, 0, []) return lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), extend(l:patterns, g:lsp_settings_root_markers)) endfunction -function! lsp_settings#root_uri(...) abort - let l:patterns = get(a:000, 0, []) +function! lsp_settings#root_uri(name) abort + let l:patterns = lsp_settings#get(a:name, 'root_uri_patterns', []) + if empty(l:patterns) + for l:ft in sort(keys(s:settings)) + for l:conf in s:settings[l:ft] + if l:conf.command ==# a:name && has_key(l:conf, 'root_uri_patterns') + let l:patterns = l:conf['root_uri_patterns'] + break + endif + endfor + endfor + endif + let l:dir = lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), extend(l:patterns, g:lsp_settings_root_markers)) if empty(l:dir) return lsp#utils#get_default_root_uri() @@ -336,15 +347,15 @@ function! s:vim_lsp_suggest_plugin() abort let l:ext = expand('%:e') for l:ft in keys(s:settings) for l:server in s:settings[l:ft] - if !has_key(l:server, 'vim-plugin') + if !has_key(l:server, 'vim_plugin') continue endif - if index(l:server['vim-plugin']['extensions'], l:ext) == -1 + if index(l:server['vim_plugin']['extensions'], l:ext) == -1 continue endif redraw echohl Directory - echomsg printf('Please install vim-plugin "%s" to enable Language Server', l:server['vim-plugin']['name']) + echomsg printf('Please install vim-plugin "%s" to enable Language Server', l:server['vim_plugin']['name']) echohl None return endfor |