Skip to content

Commit 304fbba

Browse files
committed
fix: fix loadUserConfig on Windows
it seems `import` does not accept `C:\path\to\file` so we need to convert it to `file:///C:/path/to/file`.
1 parent bcdf43c commit 304fbba

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

denops/fall/config.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ let actionPickerParams = { ...defaultActionPickerParams };
3636
const itemPickerParamsMap = new Map<string, ItemPickerParams>();
3737

3838
const refineGlobalConfig = buildRefineGlobalConfig(globalConfig);
39+
3940
const refineActionPicker = buildRefineActionPicker(actionPickerParams);
41+
4042
const defineItemPickerFromSource = buildDefineItemPickerFromSource(
4143
itemPickerParamsMap,
4244
);
45+
4346
const defineItemPickerFromCurator = buildDefineItemPickerFromCurator(
4447
itemPickerParamsMap,
4548
);
@@ -52,8 +55,8 @@ function reset(): void {
5255

5356
export async function loadUserConfig(
5457
denops: Denops,
55-
path: string,
56-
{ suffix }: { suffix?: string } = {},
58+
path: URL,
59+
{ reload = false }: { reload?: boolean } = {},
5760
): Promise<void> {
5861
const ctx = {
5962
denops,
@@ -62,8 +65,9 @@ export async function loadUserConfig(
6265
refineActionPicker,
6366
refineGlobalConfig,
6467
};
68+
const suffix = reload ? `#${performance.now()}` : "";
6569
try {
66-
const { main } = await import(`${path}${suffix ?? ""}`);
70+
const { main } = await import(`${path.href}${suffix}`);
6771
reset();
6872
await main(ctx);
6973
} catch (err) {

denops/fall/main/picker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as opt from "jsr:@denops/std@^7.3.2/option";
33
import { collect } from "jsr:@denops/std@^7.3.2/batch";
44
import { ensurePromise } from "jsr:@core/asyncutil@^1.2.0/ensure-promise";
55
import { as, assert, ensure, is } from "jsr:@core/unknownutil@^4.3.0";
6+
import { toFileUrl } from "jsr:@std/path@^1.0.8/to-file-url";
67
import type { Size } from "jsr:@vim-fall/core@^0.2.1/coordinator";
78
import type { DetailUnit } from "jsr:@vim-fall/core@^0.2.1/item";
89

@@ -98,8 +99,7 @@ async function init(
9899
console.error(`Cache reload failed: ${path}\n${decoder.decode(stderr)}`);
99100
}
100101
}
101-
const suffix = reload ? `#${performance.now()}` : undefined;
102-
return (initialized = loadUserConfig(denops, path, { suffix }));
102+
return (initialized = loadUserConfig(denops, toFileUrl(path), { reload }));
103103
}
104104

105105
async function startPicker(

0 commit comments

Comments
 (0)