Skip to content

Commit

Permalink
Use state items
Browse files Browse the repository at this point in the history
  • Loading branch information
Shougo committed Jan 29, 2024
1 parent e9fc861 commit 2e68dd9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion denops/ddu/base/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ export abstract class BaseUi<

refreshItems(_args: RefreshItemsArguments<Params>): void | Promise<void> {}

collapseItem(_args: CollapseItemArguments<Params>): number | Promise<number> {}
collapseItem(
_args: CollapseItemArguments<Params>,
): number | Promise<number> {}

expandItem(_args: ExpandItemArguments<Params>): number | Promise<number> {}

Expand Down
12 changes: 7 additions & 5 deletions denops/ddu/ddu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1242,9 +1242,11 @@ export class Ddu {
this.#options.name,
parent.__sourceName,
);
if (!source) {
const state = this.#gatherStates[index];
if (!source || !state) {
return;
}

const [sourceOptions, sourceParams] = sourceArgs(
source,
this.#options,
Expand Down Expand Up @@ -1287,7 +1289,7 @@ export class Ddu {
denops,
sourceOptions.columns,
columnItems,
this.#items.concat(columnItems),
state.items.concat(columnItems),
);

const filters = sourceOptions.matchers.concat(
Expand Down Expand Up @@ -1438,8 +1440,8 @@ export class Ddu {
this.#options,
this.#options.sources[index],
);

if (!item.treePath) {
const state = this.#gatherStates[index];
if (!item.treePath || !state) {
continue;
}

Expand All @@ -1451,7 +1453,7 @@ export class Ddu {
denops,
sourceOptions.columns,
columnItems,
this.#items.concat(columnItems),
state.items.concat(columnItems),
);

// NOTE: Apply filter for parent item to update highlights and "display".
Expand Down

0 comments on commit 2e68dd9

Please sign in to comment.