From 5d06f7504b505fdae63888d75d813e60d9675004 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Mon, 27 Jan 2020 12:31:49 +0900 Subject: Possible to install specified server --- plugin/lsp_settings.vim | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'plugin') diff --git a/plugin/lsp_settings.vim b/plugin/lsp_settings.vim index 62ffc3b..70aec73 100644 --- a/plugin/lsp_settings.vim +++ b/plugin/lsp_settings.vim @@ -41,7 +41,7 @@ function! s:executable(cmd) abort return 0 endfunction -function! s:vim_lsp_installer(ft) abort +function! s:vim_lsp_installer(ft, ...) abort let l:ft = tolower(split(a:ft, '\.')[0]) if !has_key(s:settings, l:ft) return [] @@ -50,6 +50,10 @@ function! s:vim_lsp_installer(ft) abort if empty(l:server) return [] endif + let l:name = get(a:000, 0, '') + if !empty(l:name) + return filter(copy(l:server), 'l:conf.command ==# l:name') + endif let l:found = {} for l:conf in l:server let l:missing = 0 @@ -105,8 +109,8 @@ function! s:vim_lsp_install_server_post(command, job, code, ...) abort endif endfunction -function! s:vim_lsp_install_server(ft) abort - let l:entry = s:vim_lsp_installer(a:ft) +function! s:vim_lsp_install_server(ft, name) abort + let l:entry = s:vim_lsp_installer(a:ft, a:name) if empty(l:entry) return endif @@ -137,7 +141,7 @@ function! s:vim_lsp_settings_suggest(ft) abort echohl Directory echomsg 'Please do :LspInstallServer to enable Language Server' echohl None - command! -buffer LspInstallServer call s:vim_lsp_install_server(&l:filetype) + command! -nargs=? -buffer LspInstallServer call s:vim_lsp_install_server(&l:filetype, ) endif endfunction @@ -259,7 +263,7 @@ function! s:vim_lsp_load_or_suggest(ft) abort else doautocmd User lsp_setup if exists(':LspInstallServer') !=# 2 - command! -buffer LspInstallServer call s:vim_lsp_install_server(&l:filetype) + command! -nargs=? -buffer LspInstallServer call s:vim_lsp_install_server(&l:filetype, ) endif endif -- cgit v1.2.3-54-g00ecf