From 24de62683bbe337b4389cb57d48eb68c9afcf4ea Mon Sep 17 00:00:00 2001 From: wordi Date: Fri, 3 Jan 2020 14:44:12 +0900 Subject: fix: not found tsserver for typescript-language-server --- autoload/lsp_settings.vim | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'autoload/lsp_settings.vim') diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim index f8c145d..ce3d09c 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 -- cgit v1.2.3-54-g00ecf