From f374e3c45128f2db89df3369a07dda4c78c2ebbf Mon Sep 17 00:00:00 2001 From: blyoa Date: Tue, 25 Jan 2022 08:00:12 +0900 Subject: [PATCH] use only a server that is the completionProvider --- autoload/ddc_vim_lsp.vim | 12 ++++++++++++ denops/@ddc-sources/vim-lsp.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/autoload/ddc_vim_lsp.vim b/autoload/ddc_vim_lsp.vim index d00a62c..b8fe422 100644 --- a/autoload/ddc_vim_lsp.vim +++ b/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 diff --git a/denops/@ddc-sources/vim-lsp.ts b/denops/@ddc-sources/vim-lsp.ts index 36a5555..f67d73a 100644 --- a/denops/@ddc-sources/vim-lsp.ts +++ b/denops/@ddc-sources/vim-lsp.ts @@ -18,7 +18,7 @@ export class Source extends BaseSource { 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) {