Skip to content

Commit

Permalink
update for ddc v0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
shun committed Aug 24, 2021
1 parent 537871d commit a9e0d64
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions denops/ddc/sources/ddc-vim-lsp.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
import {
BaseSource,
Candidate,
Context,
DdcOptions,
SourceOptions,
} from "https://deno.land/x/ddc_vim@v0.0.13/types.ts#^";
} from "https://deno.land/x/ddc_vim@v0.2.2/types.ts#^";

import {
Denops,
} from "https://deno.land/x/ddc_vim@v0.0.13/deps.ts#^";
} from "https://deno.land/x/ddc_vim@v0.2.2/deps.ts#^";

import {
once
} from "https://deno.land/x/denops_std@v1.4.0/anonymous/mod.ts";
} from "https://deno.land/x/denops_std@v1.7.4/anonymous/mod.ts";

export class Source extends BaseSource {
async gatherCandidates(
async gatherCandidates(args: {
denops: Denops,
context: Context,
_ddcOptions: DdcOptions,
_sourceOptions: SourceOptions,
_sourceParams: Record<string, unknown>,
completeStr: string,
): Promise<Candidate[]> {
}): Promise<Candidate[]> {

const lspservers = await denops.call("lsp#get_allowed_servers");
const lspservers = await args.denops.call("lsp#get_allowed_servers");
if (lspservers.length === 0) {
return [];
}

return new Promise((resolve) => {
// NOTE: choose first lsp server
denops.call("ddc_vim_lsp#request", lspservers[0], denops.name, once(denops, (response) => {
args.denops.call("ddc_vim_lsp#request", lspservers[0], args.denops.name, once(args.denops, (response) => {
resolve(response);
})[0])
})
Expand Down

0 comments on commit a9e0d64

Please sign in to comment.