From b5e7b1bae71e873c06691aa73ddddba7cf38a2db Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Mon, 16 Dec 2019 03:03:56 +0900 Subject: Use first one --- autoload/lsp_settings.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'autoload/lsp_settings.vim') diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim index a9cead0..3514b3f 100644 --- a/autoload/lsp_settings.vim +++ b/autoload/lsp_settings.vim @@ -16,6 +16,13 @@ function! lsp_settings#get(name, key, default) abort return l:config[a:key] endfunction +function! s:first_one(cmd) abort + if empty(a:cmd) + return '' + endif + return fnamemodify(split(a:cmd, "\n")[0], ':p') +endfunction + function! lsp_settings#exec_path(cmd) abort if executable(a:cmd) return a:cmd @@ -26,7 +33,7 @@ function! lsp_settings#exec_path(cmd) abort endif let l:paths .= ',' . s:servers_dir . '/' . a:cmd if !has('win32') - return globpath(l:paths, a:cmd) + return s:first_one(globpath(l:paths, a:cmd)) endif let l:path = globpath(l:paths, a:cmd . '.exe') if !empty(l:path) -- cgit v1.2.3-54-g00ecf