尝试修复 add file 作为上下文时会找不到文件

This commit is contained in:
zhangkun9038@dingtalk.com 2025-02-17 00:15:56 +08:00
parent 11c0d13b9a
commit 24b9daee42
2 changed files with 3 additions and 1 deletions

@ -58,6 +58,7 @@ end
local function get_project_filepaths() local function get_project_filepaths()
local project_root = Utils.get_project_root() local project_root = Utils.get_project_root()
print("project_root:", project_root)
local files = Utils.scan_directory_respect_gitignore({ directory = project_root, add_dirs = true }) local files = Utils.scan_directory_respect_gitignore({ directory = project_root, add_dirs = true })
files = vim.iter(files):map(function(filepath) return Path:new(filepath):make_relative(project_root) end):totable() files = vim.iter(files):map(function(filepath) return Path:new(filepath):make_relative(project_root) end):totable()

@ -140,7 +140,8 @@ function M.get(opts)
ret = ret ~= "" and ret or vim.uv.cwd() ret = ret ~= "" and ret or vim.uv.cwd()
print("Final Root:", ret) print("Final Root:", ret)
return Utils.is_win() and ret:gsub("/", "\\") or ret --- return Utils.is_win() and ret:gsub("/", "\\") or ret
return ret
end end
function M.git() function M.git()