Skip to content

Commit bdaf9a1

Browse files
committed
fix: use relative path for fzf-lua file preview
fzf-lua's builtin previewer requires relative paths to properly locate files for preview. Changed the field priority to use file_path (relative) before file (absolute) to fix 'Unable to stat file' errors. Field priority for fzf-lua entries: 1. file_path (relative) - preferred 2. path (relative) 3. filename (relative) 4. file (absolute) - fallback
1 parent e02416b commit bdaf9a1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lua/opencode/ui/base_picker.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ local function fzf_ui(opts)
232232
-- For file preview support, append file:line:col format
233233
-- fzf-lua's builtin previewer automatically parses this format
234234
if opts.preview == 'file' and type(item) == 'table' then
235-
local file_path = item.file or item.file_path or item.path or item.filename
235+
-- Use relative path (file_path) for fzf-lua, not absolute (file)
236+
local file_path = item.file_path or item.path or item.filename or item.file
236237
local line = item.line or item.lnum
237238
local col = item.column or item.col
238239

0 commit comments

Comments
 (0)