diff options
-rw-r--r-- | autoload/lsp_settings.vim | 3 | ||||
-rw-r--r-- | test/lsp_settings.vimspec | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim index 82ba5e6..0b149f1 100644 --- a/autoload/lsp_settings.vim +++ b/autoload/lsp_settings.vim @@ -102,6 +102,9 @@ function! lsp_settings#get(name, key, default) abort endif return a:default endif + if type(l:config[a:key]) == v:t_func + return l:config[a:key](a:name, a:key) + endif return l:config[a:key] endfunction diff --git a/test/lsp_settings.vimspec b/test/lsp_settings.vimspec index 30995f6..529187e 100644 --- a/test/lsp_settings.vimspec +++ b/test/lsp_settings.vimspec @@ -4,6 +4,8 @@ Describe lsp_settings Assert Equals(lsp_settings#get('pyls', 'cmd', 'bad'), 'bad') let g:lsp_settings = {'pyls': {'cmd': 'good'}} Assert Equals(lsp_settings#get('pyls', 'cmd', 'bad'), 'good') + let g:lsp_settings = {'pyls': {'cmd': {key,name->'good'}}} + Assert Equals(lsp_settings#get('pyls', 'cmd', 'bad'), 'good') unlet g:lsp_settings End |