Skip to content

Commit

Permalink
Restore context.path
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jul 24, 2023
1 parent 6689d0d commit 3f6ba29
Showing 1 changed file with 36 additions and 30 deletions.
66 changes: 36 additions & 30 deletions denops/ddu/ddu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1140,46 +1140,52 @@ export class Ddu {
parent.__expanded = true;

// Set path
const savePath = this.context.path;
sourceOptions.path = parent.treePath ?? parent.word;
this.context.path = sourceOptions.path;

let children: DduItem[] = [];

for await (
const newItems of this.gatherItems(
try {
for await (
const newItems of this.gatherItems(
denops,
index,
source,
sourceOptions,
sourceParams,
this.loader,
parent.__level + 1,
parent,
)
) {
await this.callColumns(
denops,
sourceOptions.columns,
[parent].concat(newItems),
);
children = children.concat(newItems);
}
if (this.shouldStopCurrentContext()) {
return;
}

const filters = sourceOptions.matchers.concat(
sourceOptions.sorters,
).concat(sourceOptions.converters);

children = await this.callFilters(
denops,
index,
source,
sourceOptions,
sourceParams,
this.loader,
parent.__level + 1,
parent,
)
) {
await this.callColumns(
denops,
sourceOptions.columns,
[parent].concat(newItems),
filters,
this.input,
children,
);
children = children.concat(newItems);
}
if (this.shouldStopCurrentContext()) {
return;
} finally {
// Restore path
this.context.path = savePath;
}

const filters = sourceOptions.matchers.concat(
sourceOptions.sorters,
).concat(sourceOptions.converters);

children = await this.callFilters(
denops,
sourceOptions,
filters,
this.input,
children,
);

const [ui, uiOptions, uiParams] = await this.getUi(denops);
if (ui && !this.shouldStopCurrentContext()) {
await ui.expandItem({
Expand Down

0 comments on commit 3f6ba29

Please sign in to comment.