Skip to content

fix(forge_fmt): cwd to the first parent with the foundry.toml file#298

Merged
mochaaP merged 1 commit intonvimtools:mainfrom
gravityblast:main
Sep 10, 2025
Merged

fix(forge_fmt): cwd to the first parent with the foundry.toml file#298
mochaaP merged 1 commit intonvimtools:mainfrom
gravityblast:main

Conversation

@gravityblast
Copy link
Copy Markdown
Contributor

If a foundry/forge project is not in the $ROOT path (e.g. /repo/contracts-project), the forge command runs without loading the configuration from the foundry.toml file, unless a --root PATH is passed as argument.

This happens even if you open the /repo/contracts-project folder directly, because $ROOT is still set to /repo if /repo/.git exists.

This PR adds a dynamic cached cwd for the forge_fmt formatter so that each buffer runs from the foundry project root.

@mochaaP mochaaP merged commit 231ed89 into nvimtools:main Sep 10, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants