diff --git a/builtin/previewer/file.ts b/builtin/previewer/file.ts index f6609a2..2414397 100644 --- a/builtin/previewer/file.ts +++ b/builtin/previewer/file.ts @@ -9,6 +9,7 @@ const decoder = new TextDecoder("utf-8", { fatal: true }); type Detail = { path: string; + previewPath?: string; line?: number; column?: number; }; @@ -23,10 +24,12 @@ type Detail = { */ export function file(): Previewer { return definePreviewer(async (denops, { item }, { signal }) => { + const path = item.detail.previewPath ?? item.detail.path; + // Resolve the absolute path of the file - const abspath = isAbsolute(item.detail.path) - ? item.detail.path - : await fn.fnamemodify(denops, item.detail.path, ":p"); + const abspath = isAbsolute(path) + ? path + : await fn.fnamemodify(denops, path, ":p"); signal?.throwIfAborted(); try {