Skip to content

Commit d84e0db

Browse files
committed
Improve update check
1 parent 769e372 commit d84e0db

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

denops/@ddu-sources/ddc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { Context, Item } from "jsr:@shougo/ddu-vim@9.3.0/types";
2-
import { BaseSource } from "jsr:@shougo/ddu-vim@9.3.0/source";
1+
import type { Context, Item } from "jsr:@shougo/ddu-vim@9.5.0/types";
2+
import { BaseSource } from "jsr:@shougo/ddu-vim@9.5.0/source";
33
import type { DdcItem } from "../ddc/types.ts";
44

55
import type { Denops } from "jsr:@denops/std@~7.4.0";

denops/ddc/ddc.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,16 +474,6 @@ export class Ddc {
474474

475475
this.#prevInput = context.input;
476476

477-
const changedTick = vars.b.get(denops, "changedtick") as Promise<number>;
478-
const cursor = fn.getcurpos(denops);
479-
if (
480-
context.changedTick !== await changedTick ||
481-
!equal(context.cursor, await cursor)
482-
) {
483-
// Input is changed. Skip invalid completion.
484-
return;
485-
}
486-
487477
const dynamicUi = await callCallback(denops, options.dynamicUi, {
488478
completePos,
489479
items,
@@ -506,6 +496,17 @@ export class Ddc {
506496
await ddc.show(denops, context, options, completePos, items);
507497
}
508498
})(this);
499+
500+
const changedTick = vars.b.get(denops, "changedtick") as Promise<number>;
501+
const cursor = fn.getcurpos(denops);
502+
if (
503+
context.changedTick !== await changedTick ||
504+
!equal(context.cursor, await cursor)
505+
) {
506+
// Input is changed. Skip invalid completion.
507+
await this.hide(denops, context, options);
508+
return;
509+
}
509510
}
510511

511512
async show(

0 commit comments

Comments
 (0)