feat: use scan_directory util (#2121)

This commit is contained in:
yetone
2025-06-03 11:51:58 +08:00
committed by GitHub
parent 12d69945c5
commit c8b075333f
2 changed files with 2 additions and 8 deletions

View File

@@ -1,5 +1,4 @@
local Utils = require("avante.utils")
local scan = require("plenary.scandir")
local Config = require("avante.config")
local Selector = require("avante.ui.selector")
@@ -19,12 +18,7 @@ local function has_scheme(path) return path:find("^%w+://") ~= nil end
function FileSelector:process_directory(absolute_path, project_root)
if absolute_path:sub(-1) == Utils.path_sep then absolute_path = absolute_path:sub(1, -2) end
local files = scan.scan_dir(absolute_path, {
hidden = false,
depth = math.huge,
add_dirs = false,
respect_gitignore = true,
})
local files = Utils.scan_directory({ directory = absolute_path, add_dirs = false })
for _, file in ipairs(files) do
local rel_path = Utils.make_relative_path(file, project_root)

View File

@@ -788,7 +788,7 @@ function M.scan_directory(options)
end
cmd_supports_max_depth = false
else
M.error("No search command found")
M.error("No search command found, please install fd or fdfind or rg")
return {}
end
end