Browse Source

Merge pull request #12 from blyoa/use-only-server-providing-completion-function

use only a server that is the completion provider
pull/13/head
Shunsuke Kudo 3 years ago
committed by GitHub
parent
commit
75671e8b0f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      autoload/ddc_vim_lsp.vim
  2. 2
      denops/@ddc-sources/vim-lsp.ts

12
autoload/ddc_vim_lsp.vim

@ -26,3 +26,15 @@ function! ddc_vim_lsp#request(server_name, id) abort
\ 'on_notification': function('ddc_vim_lsp#_callback', [l:server, l:position, a:id]),
\ })
endfunction
function! ddc_vim_lsp#get_completion_servers() abort
let l:names = []
for l:server_name in lsp#get_allowed_servers()
let l:capabilities = lsp#get_server_capabilities(l:server_name)
if has_key(l:capabilities, 'completionProvider')
call add(l:names, l:server_name)
endif
endfor
return l:names
endfunction

2
denops/@ddc-sources/vim-lsp.ts

@ -18,7 +18,7 @@ export class Source extends BaseSource<Params> {
this.counter = (this.counter + 1) % 100;
const lspservers: string[] = await args.denops.call(
"lsp#get_allowed_servers",
"ddc_vim_lsp#get_completion_servers",
// deno-lint-ignore no-explicit-any
) as any;
if (lspservers.length === 0) {

Loading…
Cancel
Save