Skip to content

Commit bf79322

Browse files
committed
Fix restoreTree()
1 parent 8bb7ad0 commit bf79322

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

denops/ddu/ddu.ts

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
import { defaultSourceOptions } from "./base/source.ts";
2525
import type { BaseSource } from "./base/source.ts";
2626
import type { Loader } from "./loader.ts";
27-
import { convertUserString, printError, treePath2Filename } from "./utils.ts";
27+
import { convertTreePath, convertUserString, printError, treePath2Filename } from "./utils.ts";
2828
import type {
2929
AvailableSourceInfo,
3030
GatherStateAbortable,
@@ -723,6 +723,10 @@ export class Ddu {
723723
items: allItems,
724724
});
725725

726+
if (restoreTree) {
727+
await this.restoreTree(denops, { preventRedraw: true, signal });
728+
}
729+
726730
const searchPath = this.#searchPath;
727731

728732
let searchTargetItem: DduItem | undefined;
@@ -771,10 +775,6 @@ export class Ddu {
771775
}
772776
}));
773777

774-
if (restoreTree) {
775-
this.restoreTree(denops, { preventRedraw: true, signal });
776-
}
777-
778778
if (this.#context.done && this.#options.profile) {
779779
await printError(
780780
denops,
@@ -1926,14 +1926,6 @@ function chompTreePath(treePath?: TreePath): TreePath {
19261926
return treePath;
19271927
}
19281928

1929-
function convertTreePath(treePath?: TreePath): string[] {
1930-
return typeof treePath === "string"
1931-
? treePath.split(pathsep)
1932-
: !treePath
1933-
? []
1934-
: treePath;
1935-
}
1936-
19371929
function isParentPath(checkPath: string[], searchPath: string[]) {
19381930
return checkPath !== searchPath &&
19391931
searchPath.join(pathsep).startsWith(checkPath.join(pathsep) + pathsep);

denops/ddu/utils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ export function treePath2Filename(treePath: TreePath): string {
3535
return typeof treePath === "string" ? treePath : treePath.join(pathsep);
3636
}
3737

38+
export function convertTreePath(treePath?: TreePath): string[] {
39+
return typeof treePath === "string"
40+
? treePath.split(pathsep)
41+
: !treePath
42+
? []
43+
: treePath;
44+
}
45+
3846
export async function safeStat(path: string): Promise<Deno.FileInfo | null> {
3947
// NOTE: Deno.stat() may be failed
4048
try {

0 commit comments

Comments
 (0)