[BUG] File paths sent to Claude Code do not respect running Claude from a different CWD
还没有人认领这个 Issue。
评估
调研方向
使用所示的 cwd_provider 重现问题,然后跟踪 ClaudeCodeOpen、ClaudeCodeAdd % 和 ClaudeCodeSend 入口点,以及 claudecode.cwd 周围的路径处理。在 Neovim 的 CWD 与 Claude 配置的 CWD 不同时,比较发送的路径,包括首次发送的情况。完成标准是缓冲区路径和可视选择路径始终相对于 Claude 的 CWD 进行解析。
由索引模型根据 Issue 内容生成。
描述
Bug Description
When using a cwd_provider, buffer paths sent to Claude Code are relative to Neovim's CWD instead of the directory that Claude is running in.
To Reproduce
Steps to reproduce the behavior:
Use a plugin configuration similar to
require("claudecode").setup({
terminal = {
cwd_provider = function(ctx)
-- Prefer repo root; fallback to file's directory
local cwd = require("claudecode.cwd").git_root(ctx.file_dir or ctx.cwd) or ctx.file_dir or ctx.cwd
return cwd
end,
},
})
Using this repository
cd pluginnvim claudecode.lua- Run
ClaudeCodeOpen - Run
ClaudeCodeAdd %or make a visual selection and runClaudeCodeSend
Note that the path sent is claudecode.lua but since Claude Code is running from the git root, it should be plugin/claudecode.lua for Claude to properly resolve it.
Oddly, sometimes, the first time I send the path it works properly but then after that the bug occurs. Not sure why but it might be linked to whether the path is calculated before or after Claude is finished opening?
Expected Behavior
The buffer path sent to Claude is relative to Claude's CWD from the cwd_provider instead of relative to Neovim's CWD.
Environment
- Neovim version: 0.11.4
- Claude Code CLI version: 2.0.26
- OS: MacOS 26.0
- Plugin version: latest git
- 主要语言
- Lua
- 星标
- 3.1k
- 派生
- 217
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
coder/claudecode.nvim 的其他 Issue
-
bug needs-triage
难度 1/5 1 小时以内 新手友好度 88/100
coder/claudecode.nvim#314 ·
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 72/100
coder/claudecode.nvim#313 ·
-
needs-triage
难度 5/5 一周以上 新手友好度 20/100
coder/claudecode.nvim#319 · 1 个 reaction ·
-
bug needs-triage
难度 4/5 3-5 天 新手友好度 35/100
coder/claudecode.nvim#316 · 1 条评论 ·
-
needs-triage
难度 3/5 1-2 天 新手友好度 62/100
coder/claudecode.nvim#309 ·
查看 coder/claudecode.nvim 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
JohnnyMorganz/luau-lsp#1635 ·
维护者通常 1 天内回复
-
mapper bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 74/100
-
Zenmap Crash未关闭Zenmap
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
solana-foundation/pay-kit#341 ·
维护者通常 1 天内回复