Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: previewer if cwd is not curr dir #2084

Merged
merged 1 commit into from
Aug 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions lua/telescope/from_entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ function from_entry.path(entry, validate, escape)
end

-- only 0 if neither filereadable nor directory
local invalid = vim.fn.filereadable(path) + vim.fn.isdirectory(path)
if validate and invalid == 0 then
return
if validate then
-- We need to expand for filereadable and isdirectory
-- TODO(conni2461): we are not going to return the expanded path because
-- this would lead to cache misses in the perviewer.
-- Requires overall refactoring in previewer interface
local expanded = vim.fn.expand(path)
if (vim.fn.filereadable(expanded) + vim.fn.isdirectory(expanded)) == 0 then
return
end
end
if escape then
return vim.fn.fnameescape(path)
Expand Down