aboutsummaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authormattn <mattn.jp@gmail.com>2020-01-03 16:20:39 +0900
committerGitHub <noreply@github.com>2020-01-03 16:20:39 +0900
commit5bda6ae210a4cd5e9bf64acc64930a09904a66fa (patch)
treebb71bf4e6cb25e76aa0facbd017a9bbc4de5b4de /autoload
parentac4f61f82fd8d0c4b0cbabd4e364dced0c72c645 (diff)
parent776ce84f47a1a0b8d5df5e84c4c509ca0658f623 (diff)
downloadvim-lsp-settings-5bda6ae210a4cd5e9bf64acc64930a09904a66fa.tar.gz
vim-lsp-settings-5bda6ae210a4cd5e9bf64acc64930a09904a66fa.tar.bz2
vim-lsp-settings-5bda6ae210a4cd5e9bf64acc64930a09904a66fa.zip
Merge pull request #60 from wordijp/fix/multiple_npm_addition
fix: not found tsserver for typescript-language-server
Diffstat (limited to 'autoload')
-rw-r--r--autoload/lsp_settings.vim22
1 files changed, 13 insertions, 9 deletions
diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim
index f8c145d..d59d4ed 100644
--- a/autoload/lsp_settings.vim
+++ b/autoload/lsp_settings.vim
@@ -24,23 +24,27 @@ function! s:first_one(cmd) abort
endfunction
function! lsp_settings#exec_path(cmd) abort
+ let l:s = split(a:cmd, ':')
+ let l:dir = len(l:s) >= 1 ? l:s[0] : ''
+ let l:cmd = len(l:s) >= 2 ? l:s[1] : l:s[0]
+
let l:paths = split($PATH, has('win32') ? ';' : ':')
let l:paths = join(l:paths, ',')
- let l:path = globpath(l:paths, a:cmd)
+ let l:path = globpath(l:paths, l:cmd)
if !has('win32')
if !empty(l:path)
return s:first_one(l:path)
endif
else
- let l:path = globpath(l:paths, a:cmd . '.exe')
+ let l:path = globpath(l:paths, l:cmd . '.exe')
if !empty(l:path)
return s:first_one(l:path)
endif
- let l:path = globpath(l:paths, a:cmd . '.cmd')
+ let l:path = globpath(l:paths, l:cmd . '.cmd')
if !empty(l:path)
return s:first_one(l:path)
endif
- let l:path = globpath(l:paths, a:cmd . '.bat')
+ let l:path = globpath(l:paths, l:cmd . '.bat')
if !empty(l:path)
return s:first_one(l:path)
endif
@@ -51,19 +55,19 @@ function! lsp_settings#exec_path(cmd) abort
let l:paths = join(l:paths, ',') . ','
endif
let l:servers_dir = get(g:, 'lsp_settings_servers_dir', s:servers_dir)
- let l:paths .= l:servers_dir . '/' . a:cmd
+ let l:paths .= l:servers_dir . '/' . l:dir
if !has('win32')
- return s:first_one(globpath(l:paths, a:cmd))
+ return s:first_one(globpath(l:paths, l:cmd))
endif
- let l:path = globpath(l:paths, a:cmd . '.exe')
+ let l:path = globpath(l:paths, l:cmd . '.exe')
if !empty(l:path)
return s:first_one(l:path)
endif
- let l:path = globpath(l:paths, a:cmd . '.cmd')
+ let l:path = globpath(l:paths, l:cmd . '.cmd')
if !empty(l:path)
return s:first_one(l:path)
endif
- let l:path = globpath(l:paths, a:cmd . '.bat')
+ let l:path = globpath(l:paths, l:cmd . '.bat')
if !empty(l:path)
return s:first_one(l:path)
endif