[BUG] File paths sent to Claude Code do not respect running Claude from a different CWD
- Langage dominant
- Lua
- Étoiles
- 3.1k
- Forks
- 216
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
## 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
1. `cd plugin`
2. `nvim claudecode.lua`
3. Run `ClaudeCodeOpen`
4. Run `ClaudeCodeAdd %` or make a visual selection and run `ClaudeCodeSend`
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
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Reproduisez le problème avec le cwd_provider montré, puis suivez les points d’entrée ClaudeCodeOpen, ClaudeCodeAdd % et ClaudeCodeSend ainsi que la gestion des chemins autour de claudecode.cwd. Comparez les chemins envoyés lorsque le CWD de Neovim diffère du CWD configuré de Claude, y compris le cas du premier envoi. La tâche est terminée lorsque les chemins du tampon et de la sélection visuelle sont résolus de manière cohérente par rapport au CWD de Claude.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- lua
- Domaine
- cli, devtools
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100