diff options
author | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2020-02-20 00:14:47 +0900 |
---|---|---|
committer | Yasuhiro Matsumoto <mattn.jp@gmail.com> | 2020-02-20 00:14:47 +0900 |
commit | e55fa57320b284eb38392a5e57b2edee27d966a5 (patch) | |
tree | eeb85b5221af4d2136157a78146f105dde8a7bff /autoload/lsp_settings.vim | |
parent | 7ecb6223a7eb1d510c3662e8ca4f7a3b1fd5b3fb (diff) | |
download | vim-lsp-settings-e55fa57320b284eb38392a5e57b2edee27d966a5.tar.gz vim-lsp-settings-e55fa57320b284eb38392a5e57b2edee27d966a5.tar.bz2 vim-lsp-settings-e55fa57320b284eb38392a5e57b2edee27d966a5.zip |
root_uri patterns should be configurable
Diffstat (limited to 'autoload/lsp_settings.vim')
-rw-r--r-- | autoload/lsp_settings.vim | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim index f1b163e..9183069 100644 --- a/autoload/lsp_settings.vim +++ b/autoload/lsp_settings.vim @@ -168,13 +168,22 @@ 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 = [] + 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 + 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() |