Skip to content

Commit 851fc38

Browse files
committed
fix: add cwd to fzf-lua config for proper path resolution
fzf-lua's builtin previewer uses opts.cwd to resolve relative paths. Without this, the previewer cannot find files and shows 'Unable to stat file' errors even though the paths are correct. From fzf-lua's entry_to_file(): if cwd and #cwd > 0 and not isURI and not M.is_absolute(stripped) then stripped = M.join({ cwd, stripped }) end This fix ensures relative paths like 'lua/opencode/ui/highlight.lua:37:' are properly resolved by prepending the cwd.
1 parent bdaf9a1 commit 851fc38

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lua/opencode/ui/base_picker.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,8 @@ local function fzf_ui(opts)
211211
_headers = { 'actions' },
212212
-- Enable builtin previewer for file preview support
213213
previewer = opts.preview == 'file' and 'builtin' or nil,
214+
-- Set cwd for fzf-lua to resolve relative paths in preview
215+
cwd = vim.fn.getcwd(),
214216
fn_fzf_index = function(line)
215217
-- Strip the appended file:line:col info before matching
216218
local display_part = line:match('^([^\t]+)') or line

0 commit comments

Comments
 (0)