fix: apply non-existent file (#1224)
This commit is contained in:
parent
987275c64a
commit
26e40e5483
@ -254,9 +254,12 @@ local function transform_result_content(selected_files, result_content, prev_fil
|
|||||||
|
|
||||||
if not the_matched_file then
|
if not the_matched_file then
|
||||||
if not PPath:new(filepath):exists() then
|
if not PPath:new(filepath):exists() then
|
||||||
Utils.warn("File not found: " .. filepath)
|
the_matched_file = {
|
||||||
goto continue
|
filepath = filepath,
|
||||||
end
|
content = "",
|
||||||
|
file_type = nil,
|
||||||
|
}
|
||||||
|
else
|
||||||
if not PPath:new(filepath):is_file() then
|
if not PPath:new(filepath):is_file() then
|
||||||
Utils.warn("Not a file: " .. filepath)
|
Utils.warn("Not a file: " .. filepath)
|
||||||
goto continue
|
goto continue
|
||||||
@ -273,6 +276,7 @@ local function transform_result_content(selected_files, result_content, prev_fil
|
|||||||
file_type = nil,
|
file_type = nil,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local file_content = vim.split(the_matched_file.content, "\n")
|
local file_content = vim.split(the_matched_file.content, "\n")
|
||||||
if start_line ~= 0 or end_line ~= 0 then break end
|
if start_line ~= 0 or end_line ~= 0 then break end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user