feat(file_selector): support customized filepaths resolver (#1294)
This commit is contained in:
@@ -10,6 +10,10 @@ local Utils = require("avante.utils")
|
||||
---@field public filepaths string[]
|
||||
---@field public handler fun(filepaths: string[]|nil): nil
|
||||
|
||||
---@class avante.file_selector.opts.IGetFilepathsParams
|
||||
---@field public cwd string
|
||||
---@field public selected_filepaths string[]
|
||||
|
||||
---@class avante.CoreConfig: avante.Config
|
||||
local M = {}
|
||||
---@class avante.Config
|
||||
|
||||
@@ -166,6 +166,15 @@ end
|
||||
function FileSelector:open() self:show_select_ui() end
|
||||
|
||||
function FileSelector:get_filepaths()
|
||||
if type(Config.file_selector.provider_opts.get_filepaths) == "function" then
|
||||
---@type avante.file_selector.opts.IGetFilepathsParams
|
||||
local params = {
|
||||
cwd = Utils.get_project_root(),
|
||||
selected_filepaths = self.selected_filepaths,
|
||||
}
|
||||
return Config.file_selector.provider_opts.get_filepaths(params)
|
||||
end
|
||||
|
||||
local filepaths = get_project_filepaths()
|
||||
|
||||
table.sort(filepaths, function(a, b)
|
||||
|
||||
Reference in New Issue
Block a user