Skip to content

Commit

Permalink
add ignoreCompleteProvider option
Browse files Browse the repository at this point in the history
  • Loading branch information
shun committed Feb 23, 2022
1 parent 93732f7 commit 7d4b11e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,25 @@ https://github.com/mattn/vim-lsp-settings
## Configuration

```
e.g.
call ddc#custom#patch_global('sources', ['vim-lsp'])
call ddc#custom#patch_global('sourceOptions', {
\ 'vim-lsp': {
\ 'matchers': ['matcher_head'],
\ 'mark': 'lsp',
\ },
\ })
" if you want to use the unsupported CompleteProvider Server,
" set true by'ignoreCompleteProvider'.
call ddc#custom#patch_filetype(['css'], {
\ 'sourceParams': {
\ 'vim-lsp': {
\ 'ignoreCompleteProvider': v:true,
\ },
\ },
\ })
```

ddc.vim remove duplicated keyword by default.
Expand Down
8 changes: 6 additions & 2 deletions autoload/ddc_vim_lsp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ function! ddc_vim_lsp#request(server_name, id) abort
endfunction


function! ddc_vim_lsp#get_completion_servers() abort
function! ddc_vim_lsp#get_completion_servers(ignoreCompleteProvider) 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')
if a:ignoreCompleteProvider
call add(l:names, l:server_name)
else
if has_key(l:capabilities, 'completionProvider')
call add(l:names, l:server_name)
endif
endif
endfor
return l:names
Expand Down
9 changes: 7 additions & 2 deletions denops/@ddc-sources/vim-lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import {
} from "https://deno.land/x/ddc_vim@v2.0.0/base/source.ts#^";

// deno-lint-ignore ban-types
type Params = {};
type Params = {
ignoreCompleteProvider: boolean;
};

export class Source extends BaseSource<Params> {
private counter = 0;
Expand All @@ -20,6 +22,7 @@ export class Source extends BaseSource<Params> {

const lspservers: string[] = await args.denops.call(
"ddc_vim_lsp#get_completion_servers",
args.sourceParams.ignoreCompleteProvider,
// deno-lint-ignore no-explicit-any
) as any;
if (lspservers.length === 0) {
Expand All @@ -39,6 +42,8 @@ export class Source extends BaseSource<Params> {
}

params(): Params {
return {};
return {
ignoreCompleteProvider: false,
};
}
}
11 changes: 11 additions & 0 deletions doc/ddc-vim-lsp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,19 @@ EXAMPLES *ddc-vim-lsp-examples*
\ 'mark': 'lsp',
\ },
\ })
" if you want to use the unsupported CompleteProvider Server,
" set true by'ignoreCompleteProvider'.
call ddc#custom#patch_filetype(['css'], {
\ 'sourceParams': {
\ 'vim-lsp': {
\ 'ignoreCompleteProvider': v:true,
\ },
\ },
\ })
<


ddc.vim remove duplicated keyword by default.
If you want to list up both of them, please add `'dup': v:true` .

Expand Down

0 comments on commit 7d4b11e

Please sign in to comment.