Skip to content

Commit

Permalink
Use LineContext
Browse files Browse the repository at this point in the history
  • Loading branch information
uga-rosa committed Jan 5, 2024
1 parent f6f4f1e commit 26c6cd9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions denops/@ddc-sources/denippet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from "https://deno.land/x/[email protected]/base/source.ts";
import { Denops, op } from "../denippet/deps/denops.ts";
import { splitLines } from "../denippet/util.ts";
import { lsputil } from "../denippet/deps/lsp.ts";

type Params = Record<PropertyKey, never>;

Expand Down Expand Up @@ -51,9 +52,8 @@ export class Source extends BaseSource<Params> {
} else if (completed_event === "undefined") {
// native-ui
const itemWord = await denops.eval(`v:completed_item.word`) as string;
const beforeLine = await denops.eval(
`getline('.')[:col('.')-2]`,
) as string;
const ctx = await lsputil.LineContext.create(denops);
const beforeLine = ctx.text.slice(0, ctx.character);
if (!beforeLine.endsWith(itemWord)) {
return;
}
Expand Down

0 comments on commit 26c6cd9

Please sign in to comment.