X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/5a4872f466ebd76ddd532bdf2798554421c53df4..fe3919e725e156d751069662d11e38f7b4791de1:/.vim/bundle/vim-lsp/autoload/lsp/utils/workspace_config.vim diff --git a/.vim/bundle/vim-lsp/autoload/lsp/utils/workspace_config.vim b/.vim/bundle/vim-lsp/autoload/lsp/utils/workspace_config.vim new file mode 100644 index 00000000..0304f29f --- /dev/null +++ b/.vim/bundle/vim-lsp/autoload/lsp/utils/workspace_config.vim @@ -0,0 +1,35 @@ +function! lsp#utils#workspace_config#get(server_name) abort + try + let l:server_info = lsp#get_server_info(a:server_name) + let l:config_type = type(l:server_info['workspace_config']) + + if l:config_type == v:t_func + let l:config = l:server_info['workspace_config'](l:server_info) + else + let l:config = l:server_info['workspace_config'] + endif + + return l:config + catch + return v:null + endtry +endfunction + +function! lsp#utils#workspace_config#projection(config, item) abort + try + let l:config = a:config + + for l:section in split(a:item['section'], '\.') + let l:config = l:config[l:section] + endfor + + return l:config + catch + return v:null + endtry +endfunction + +function! lsp#utils#workspace_config#get_value(server_name, item) abort + let l:config = lsp#utils#workspace_config#get(a:server_name) + return lsp#utils#workspace_config#projection(l:config, a:item) +endfunction