aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2020-02-25 22:07:03 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2020-02-25 22:07:03 +0900
commit1ae6dff3ff3057967f602fc3a692c6f454d1a46d (patch)
treea9171a61f873f0ff522e6b9da4406ba13e4a07c2
parentb7afc25d2669b44766bdf03037f0202d4e007132 (diff)
downloadvim-lsp-settings-1ae6dff3ff3057967f602fc3a692c6f454d1a46d.tar.gz
vim-lsp-settings-1ae6dff3ff3057967f602fc3a692c6f454d1a46d.tar.bz2
vim-lsp-settings-1ae6dff3ff3057967f602fc3a692c6f454d1a46d.zip
Add candidate of '_' for completion
-rw-r--r--autoload/lsp_settings.vim54
1 files changed, 26 insertions, 28 deletions
diff --git a/autoload/lsp_settings.vim b/autoload/lsp_settings.vim
index fd908c6..8d0db8c 100644
--- a/autoload/lsp_settings.vim
+++ b/autoload/lsp_settings.vim
@@ -226,38 +226,36 @@ function! lsp_settings#complete_uninstall(arglead, cmdline, cursorpos) abort
endfunction
function! lsp_settings#complete_install(arglead, cmdline, cursorpos) abort
- let l:ft = tolower(get(split(&filetype, '\.'), 0, ''))
- let l:ft = empty(l:ft) ? '_' : l:ft
- if !has_key(s:settings, l:ft)
- return []
- endif
- let l:server = s:settings[l:ft]
- if empty(l:server)
- return []
- endif
let l:installers = []
- for l:conf in l:server
- let l:missing = 0
- for l:require in l:conf.requires
- if !executable(l:require)
- let l:missing = 1
- break
- endif
- endfor
- if l:missing !=# 0
+
+ for l:ft in split(&filetype . '.', '\.', 1)
+ let l:ft = tolower(empty(l:ft) ? '_' : l:ft)
+ if !has_key(s:settings, l:ft)
continue
endif
- let l:command = printf('%s/install-%s', s:installer_dir, l:conf.command)
- if has('win32')
- let l:command = substitute(l:command, '/', '\', 'g') . '.cmd'
- else
- let l:command = l:command . '.sh'
- endif
- if executable(l:command)
- call add(l:installers, l:conf.command)
- endif
+ for l:conf in s:settings[l:ft]
+ let l:missing = 0
+ for l:require in l:conf.requires
+ if !executable(l:require)
+ let l:missing = 1
+ break
+ endif
+ endfor
+ if l:missing !=# 0
+ continue
+ endif
+ let l:command = printf('%s/install-%s', s:installer_dir, l:conf.command)
+ if has('win32')
+ let l:command = substitute(l:command, '/', '\', 'g') . '.cmd'
+ else
+ let l:command = l:command . '.sh'
+ endif
+ if executable(l:command)
+ call add(l:installers, l:conf.command)
+ endif
+ endfor
endfor
- return filter(uniq(l:installers), 'stridx(v:val, a:arglead) == 0')
+ return filter(uniq(sort(l:installers)), 'stridx(v:val, a:arglead) == 0')
endfunction
function! s:vim_lsp_uninstall_server(command) abort