fix: refine tools (#1706)

* fix: refine tools

* fix: missing break line

* fix: view a in-context file

* fix: remove create_file tests
This commit is contained in:
yetone
2025-03-25 11:17:48 +08:00
committed by GitHub
parent 3a75b7d36f
commit 976fb4177c
6 changed files with 34 additions and 61 deletions

View File

@@ -61,4 +61,15 @@ function M.has_permission_to_access(abs_path)
return not M.is_ignored(abs_path)
end
---@param path string
---@return boolean
function M.already_in_context(path)
local sidebar = require("avante").get()
if sidebar and sidebar.file_selector then
local rel_path = Utils.uniform_path(path)
return vim.tbl_contains(sidebar.file_selector.selected_filepaths, rel_path)
end
return false
end
return M