diff --git a/autoload/langserver/default.vim b/autoload/langserver/default.vim index f067131..2c381a0 100644 --- a/autoload/langserver/default.vim +++ b/autoload/langserver/default.vim @@ -6,16 +6,19 @@ function! langserver#default#cmd() abort let l:bad_cmd = [-1] if has_key(g:langserver_executables, &filetype) - let l:tmp_cmd = g:langserver_executables[&filetype]['cmd'] - - if type(l:tmp_cmd) != type([]) - echoerr 'Make sure your dictionary is structued like: {"filetype": {"cmd": [cmd, list, here]}}' - return l:bad_cmd - endif + let l:tmp_cmd = g:langserver_executables[&filetype]['cmd'] + if type(l:tmp_cmd) == type([]) return l:tmp_cmd - return - else - return l:bad_cmd + elseif type(l:tmp_cmd) == type(function('tr')) + let l:result = l:tmp_cmd() + if type(l:result) == type([]) + return l:result + endif + endif endif + + " If we didn't return anything, there was an error. + echoerr 'Please consult the documentation for how to configure the langserver' + return l:bad_cmd endfunction