aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/lsp_settings.vim22
-rw-r--r--installer/npm_install.cmd7
-rw-r--r--settings/typescript-language-server.vim2
3 files changed, 19 insertions, 12 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
diff --git a/installer/npm_install.cmd b/installer/npm_install.cmd
index 5f1d9bb..8521869 100644
--- a/installer/npm_install.cmd
+++ b/installer/npm_install.cmd
@@ -3,9 +3,12 @@
if "x%1" equ "x" goto :EOF
if "x%2" equ "x" goto :EOF
-call npm init -y
+if not exist package.json (
+ call npm init -y
+
+ echo {"name":""}>package.json
+)
-echo {"name":""}>package.json
call npm install "%2"
diff --git a/settings/typescript-language-server.vim b/settings/typescript-language-server.vim
index 534a151..a75567c 100644
--- a/settings/typescript-language-server.vim
+++ b/settings/typescript-language-server.vim
@@ -2,7 +2,7 @@ augroup vimlsp_settings_typescript_language_server
au!
LspRegisterServer {
\ 'name': 'typescript-language-server',
- \ 'cmd': {server_info->lsp_settings#get('typescript-language-server', 'cmd', [lsp_settings#exec_path('typescript-language-server'), '--stdio', '--tsserver-path', lsp_settings#exec_path('tsserver')])},
+ \ 'cmd': {server_info->lsp_settings#get('typescript-language-server', 'cmd', [lsp_settings#exec_path('typescript-language-server'), '--stdio', '--tsserver-path', lsp_settings#exec_path('typescript-language-server:tsserver')])},
\ 'root_uri':{server_info->lsp_settings#get('typescript-language-server', 'root_uri', lsp_settings#root_uri(['.git/', 'package.json']))},
\ 'initialization_options': lsp_settings#get('typescript-language-server', 'initialization_options', {"diagnostics": "true"}),
\ 'whitelist': lsp_settings#get('typescript-language-server', 'whitelist', ['javascript', 'javascriptreact', 'typescript', 'typescriptreact']),