Add installer

This commit is contained in:
Yasuhiro Matsumoto
2019-12-16 23:50:29 +09:00
parent 7083167942
commit 933ed95d2d
3 changed files with 55 additions and 18 deletions

View File

@@ -0,0 +1,15 @@
@echo off
cd %~dp0
if exist "..\servers\typescript-language-server" rd /S /Q "..\servers\typescript-language-server"
md "..\servers\typescript-language-server"
cd "..\servers\typescript-language-server"
git clone https://github.com/theia-ide/typescript-language-server .
call yarn
echo @echo off ^
node %%~dp0\server\lib\cli.js --stdio ^
> typescript-language-server.cmd

View File

@@ -0,0 +1,20 @@
#!/bin/sh
set -e
cd $(dirname $0)
[ -d ../servers/typescript-language-server ] && rm -rf ../servers/typescript-language-server
mkdir ../servers/typescript-language-server
cd ../servers/typescript-language-server
git clone https://github.com/theia-ide/typescript-language-server .
yarn
yarn build
cat <<EOF > typescript-language-server
#!/bin/sh
DIR=\$(cd \$(dirname \$0); pwd)
node \$DIR/server/lib/cli.js --stdio
EOF
chmod +x typescript-language-server

View File

@@ -31,12 +31,12 @@ function! s:vimlsp_installer() abort
if !has_key(s:settings, &filetype)
return ''
endif
let l:setting = s:settings[&filetype]
if empty(l:setting)
let l:server = s:settings[&filetype]
if empty(l:server)
return ''
endif
let l:found = {}
for l:conf in l:setting
for l:conf in l:server
let l:missing = 0
for l:require in l:conf.requires
if !s:executable(l:require)
@@ -52,20 +52,22 @@ function! s:vimlsp_installer() abort
if empty(l:found)
return ''
endif
let l:command = s:vimlsp_settings_get(l:setting[0].command, 'cmd', l:setting[0].command)
if type(l:command) == type([])
let l:command = l:command[0]
endif
let l:command = printf('%s/install-%s', s:installer_dir, l:command)
if has('win32')
let l:command = substitute(l:command, '/', '\', 'g') . '.cmd'
else
let l:command = l:command . '.sh'
endif
if !s:executable(l:command)
return ''
endif
return l:command
for l:conf in l:server
let l:command = s:vimlsp_settings_get(l:conf.command, 'cmd', l:conf.command)
if type(l:command) == type([])
let l:command = l:command[0]
endif
let l:command = printf('%s/install-%s', s:installer_dir, l:command)
if has('win32')
let l:command = substitute(l:command, '/', '\', 'g') . '.cmd'
else
let l:command = l:command . '.sh'
endif
if s:executable(l:command)
return l:command
endif
endfor
return ''
endfunction
function! s:vimlsp_install_server() abort
@@ -77,7 +79,7 @@ function! s:vimlsp_settings_suggest() abort
if empty(s:vimlsp_installer())
return
endif
echomsg printf("If you want to enable Language Server, please do :LspInstallServer")
echomsg printf('If you want to enable Language Server, please do :LspInstallServer')
command! -buffer LspInstallServer call s:vimlsp_install_server()
endfunction