diff options
-rw-r--r-- | autoload/lsp_settings/profile.vim | 2 | ||||
-rw-r--r-- | autoload/lsp_settings/utils.vim | 53 |
2 files changed, 2 insertions, 53 deletions
diff --git a/autoload/lsp_settings/profile.vim b/autoload/lsp_settings/profile.vim index 98bf7b2..4fd9315 100644 --- a/autoload/lsp_settings/profile.vim +++ b/autoload/lsp_settings/profile.vim @@ -4,7 +4,7 @@ function! lsp_settings#profile#load_local() abort if !empty(l:root) && filereadable(l:root . '/settings.json') let l:settings = json_decode(join(readfile(l:root . '/settings.json'), "\n")) if has_key(g:, 'lsp_settings') - call lsp_settings#utils#merge(g:lsp_settings, l:settings) + let g:lsp_settings = extend(g:lsp_settings, l:settings) else let g:lsp_settings = l:settings endif diff --git a/autoload/lsp_settings/utils.vim b/autoload/lsp_settings/utils.vim index 3a48d7c..5bcd151 100644 --- a/autoload/lsp_settings/utils.vim +++ b/autoload/lsp_settings/utils.vim @@ -31,57 +31,6 @@ function! lsp_settings#utils#first_one(lines) abort return l:path endfunction -function! lsp_settings#utils#merge(lhs, rhs) abort - let [l:lhs, l:rhs] = [a:lhs, a:rhs] - if type(l:lhs) ==# 3 - if type(l:rhs) ==# 3 - let l:lhs += l:rhs - if len(l:lhs) - call remove(l:lhs, 0, len(l:lhs)-1) - endif - for l:rhi in l:rhs - call add(l:lhs, l:rhs[l:rhi]) - endfor - elseif type(l:rhs) ==# 4 - let l:lhs += map(keys(l:rhs), '{v:val : l:rhs[v:val]}') - endif - elseif type(l:lhs) ==# 4 - if type(l:rhs) ==# 3 - for l:V in l:rhs - if type(l:V) != 4 - continue - endif - for l:k in keys(l:V) - let l:lhs[l:k] = l:V[l:k] - endfor - endfor - elseif type(l:rhs) ==# 4 - for l:key in keys(l:rhs) - if type(l:rhs[l:key]) ==# 3 - if !has_key(l:lhs, l:key) - let l:lhs[l:key] = [] - endif - if type(l:lhs[l:key]) == 3 - let l:lhs[l:key] += l:rhs[l:key] - elseif type(l:lhs[l:key]) == 4 - for l:k in keys(l:rhs[l:key]) - let l:lhs[l:key][l:k] = l:rhs[l:key][l:k] - endfor - endif - elseif type(l:rhs[l:key]) ==# 4 - if has_key(l:lhs, l:key) - call lsp_settings#utils#merge(l:lhs[l:key], l:rhs[l:key]) - else - let l:lhs[l:key] = l:rhs[l:key] - endif - else - let l:lhs[l:key] = l:rhs[l:key] - endif - endfor - endif - endif -endfunction - function! lsp_settings#utils#dotmerge(d) abort let l:ret = {} let l:keys = keys(a:d) @@ -101,7 +50,7 @@ function! lsp_settings#utils#dotmerge(d) abort endif let l:cur = l:cur[l:kk] endfor - call lsp_settings#utils#merge(l:ret, l:new) + let l:ret = extend(l:ret, l:new) endfor return l:ret endfunction |