Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check signal #123

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions denops/ddu/ddu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1089,9 +1089,12 @@ export class Ddu {
async expandItems(
denops: Denops,
items: ExpandItem[],
opts?: { signal?: AbortSignal },
opts?: {
preventRedraw?: boolean;
signal?: AbortSignal;
},
): Promise<void> {
const { signal = this.#aborter.signal } = opts ?? {};
const { preventRedraw, signal = this.#aborter.signal } = opts ?? {};
for (const item of items.sort((a, b) => a.item.__level - b.item.__level)) {
const maxLevel = item.maxLevel && item.maxLevel < 0
? -1
Expand All @@ -1110,7 +1113,9 @@ export class Ddu {
);
}

await this.uiRedraw(denops, { signal });
if (!preventRedraw && !signal.aborted) {
await this.uiRedraw(denops, { signal });
}
}

async expandItem(
Expand Down Expand Up @@ -1708,6 +1713,10 @@ export class Ddu {

async restoreTree(
denops: Denops,
opts?: {
preventRedraw?: boolean;
signal?: AbortSignal;
},
): Promise<void> {
// NOTE: Check expandedItems are exists in this.#items
const checkItems: Map<string, DduItem> = new Map();
Expand All @@ -1723,7 +1732,7 @@ export class Ddu {
return;
}

await this.expandItems(denops, restoreItems);
await this.expandItems(denops, restoreItems, opts);
}

async #filterItems(
Expand Down