Skip to content

Commit

Permalink
Fix signal problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Apr 19, 2024
1 parent 499dedc commit 21cb759
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
19 changes: 7 additions & 12 deletions denops/ddu/ddu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ export class Ddu {
this.#initialized = false;
this.#resetQuitted();
this.#startTime = Date.now();
const { signal } = this.#aborter;

// Gather items asynchronously.
const [availableSources, sourcesInitialized] = this
Expand All @@ -261,9 +260,11 @@ export class Ddu {

// UI should load before refresh.
// NOTE: If UI is blocked until refresh, user input will break UI.
await this.uiRedraw(denops, { signal });
await this.uiRedraw(denops, { signal: this.#aborter.signal });

await this.#refreshSources(denops, gatherStates, { signal });
await this.#refreshSources(denops, gatherStates, {
signal: this.#aborter.signal,
});

this.#initialized = true;
}
Expand Down Expand Up @@ -381,8 +382,6 @@ export class Ddu {
#createGatherStateTransformer(
denops: Denops,
): TransformStream<AvailableSourceInfo, GatherState> {
const { signal } = this.#aborter;

return new TransformStream({
transform: (sourceInfo, controller) => {
const { sourceIndex, source, sourceOptions, sourceParams } = sourceInfo;
Expand All @@ -395,7 +394,7 @@ export class Ddu {
sourceParams,
this.#loader,
0,
{ signal },
{ signal: this.#aborter.signal },
);
this.#gatherStates.set(sourceIndex, state);

Expand Down Expand Up @@ -909,8 +908,6 @@ export class Ddu {
actionName: string,
actionParams: BaseActionParams,
): Promise<void> {
const { signal } = this.#aborter;

if (await fn.getcmdwintype(denops) !== "") {
// Skip when Command line window
return;
Expand Down Expand Up @@ -999,7 +996,7 @@ export class Ddu {
ui,
uiOptions,
uiParams,
signal,
this.#aborter.signal,
);
}
}
Expand All @@ -1012,8 +1009,6 @@ export class Ddu {
clipboard: Clipboard,
actionHistory: ActionHistory,
): Promise<void> {
const { signal } = this.#aborter;

const itemAction = await getItemAction(
denops,
this.#loader,
Expand Down Expand Up @@ -1139,7 +1134,7 @@ export class Ddu {
ui,
uiOptions,
uiParams,
signal,
this.#aborter.signal,
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions denops/ddu/deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ export {
export {
assertEquals,
equal,
} from "https://deno.land/std@0.222.1/assert/mod.ts";
export { parse, toFileUrl } from "https://deno.land/std@0.222.1/path/mod.ts";
} from "https://deno.land/std@0.223.0/assert/mod.ts";
export { parse, toFileUrl } from "https://deno.land/std@0.223.0/path/mod.ts";
export {
deadline,
DeadlineError,
} from "https://deno.land/std@0.222.1/async/mod.ts";
} from "https://deno.land/std@0.223.0/async/mod.ts";
export { TimeoutError } from "https://deno.land/x/msgpack_rpc@v4.0.1/response_waiter.ts";
export { Lock } from "https://deno.land/x/async@v2.1.0/mod.ts";
export {
basename,
dirname,
SEPARATOR as pathsep,
} from "https://deno.land/std@0.222.1/path/mod.ts";
} from "https://deno.land/std@0.223.0/path/mod.ts";

0 comments on commit 21cb759

Please sign in to comment.