bug: read_file wrong path
Describe the bug
When I open neovim within a subfolder of a git rep, avante will "lost" a part of the path for the file.
To reproduce
- Use a git repo at
/tmp/repo - Go to a subfolder (
/tmp/repo/example) - Open nvim there on a file
/tmp/repo/example/file. - Use Avante and the
read_filetool. - It will drop a part of the path:
/tmp/repo/fileand warn the the file doesn't exist. (the path within the git repo is lost)
Expected behavior
The full correct path should be used, even when not at the root of the repo.
Installation method
NixOS & NixVim:
programs.nixvim = {
...
plugins = {
...
avante = {
enable = true;
settings = {
claude = {
api_key_name = "cmd:cat /run/secrets/api/anthropic";
model = "claude-3-7-sonnet-20250219";
disable_tools = true;
};
};
};
};
};
Environment
NVIM v0.10.4 Build type: Release LuaJIT 2.1.1713773202 Linux laptop 6.12.11 #1-NixOS SMP PREEMPT_DYNAMIC Thu Jan 23 16:23:05 UTC 2025 x86_64 GNU/Linux
Repro
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
The issue is still there
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
You can set this option to true to solve the problem: https://github.com/yetone/avante.nvim/blob/ef61ba52c0117512a0dfecfaa6392d578de62a87/lua/avante/config.lua#L387
Thank you for your reply. Your solution seems to work but imo doesn't solve the real issue. I din't see why it doesn't work the same way when adding a file and when actually reading it.