From d801d7333c0457b1f5a67750818fd26c888b932f Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Tue, 4 Jun 2024 10:00:34 +0900 Subject: [PATCH] Initialize context path --- denops/ddu/context.ts | 5 ++++- denops/ddu/ddu.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/denops/ddu/context.ts b/denops/ddu/context.ts index 1ffc0a8..331286e 100644 --- a/denops/ddu/context.ts +++ b/denops/ddu/context.ts @@ -337,13 +337,16 @@ export class ContextBuilder { ); } + const cwd = await fn.getcwd(denops); + return [ { ...defaultContext(), bufName: await fn.bufname(denops, "%"), bufNr: await fn.bufnr(denops, "%"), - cwd: await fn.getcwd(denops), + cwd, mode: await fn.mode(denops), + path: cwd, winId: await fn.win_getid(denops) as number, }, userOptions, diff --git a/denops/ddu/ddu.ts b/denops/ddu/ddu.ts index 2eeced2..5a73fdf 100644 --- a/denops/ddu/ddu.ts +++ b/denops/ddu/ddu.ts @@ -449,10 +449,10 @@ export class Ddu { sourceOptions, ); - // Get path option, or current directory instead if it is empty. + // Get path option or context path directory instead if it is empty. const path = sourceOptions.path.length > 0 ? sourceOptions.path - : await fn.getcwd(denops); + : this.#context.path; for await (const newItems of itemsStream) { if (!equal(path, this.#context.path)) {