Closed fiadliel closed 3 months ago
I finally figured out where this issue comes from - it's not helix after all. It looks like rust-analyzer tries to set the working directory to the same path as the file being formatted, to pick up any custom rustfmt.toml
files in that directory.
See https://github.com/rust-lang/rust-analyzer/blob/935883fd826c46e7e7e6de19cf24377c21f1b2ba/crates/rust-analyzer/src/handlers/request.rs#L2188
Thanks again!
Fixes https://github.com/bram209/leptosfmt/issues/113
This adds a basic loop around searching the (canonicalized) current working directory, and its parents, until a file
leptosfmt.toml
is found. This logic is used when an explicit config file is not passed.Allows leptosfmt to be used as a rustfmt override, even where R-A's working directory is some subdirectory of the root.
The idea is similar to what rustfmt does, but does not include some extra places where rustfmt checks (the home directory and a config directory).