Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustfmt config file is not picked up in vs code when the project is in a subdirectory #7227

Closed
AlexAegis opened this issue Jan 10, 2021 · 1 comment
Labels
S-actionable Someone could pick this issue up and work on it right now

Comments

@AlexAegis
Copy link

Consider a freshly cargo init-ed project with an added .rustfmt.toml

.
├── .rustfmt.toml
├── Cargo.toml
└── src
    └── main.rs

In this case the format config is picked up as usual and when formatting main.rs is formatted according to the configuration file.

Now consider a project where this rust project lives in a subdirectory

.
└── project
    ├── .rustfmt.toml
    ├── Cargo.toml
    ├── LICENSE
    └── src
        └── main.rs

In this case the configuration file is not picked up, and I have to symlink it to the root as a workaround or open it separately so that project is the root. I suggest calling rustfmt from the directory of the formatted .rs file instead of the project root.

@lnicola lnicola added the S-actionable Someone could pick this issue up and work on it right now label Jan 10, 2021
@matklad
Copy link
Member

matklad commented May 22, 2021

I think we’ve fixed that at some point: https://github.com/rust-analyzer/rust-analyzer/blob/a99de65573d59d6398f472b0d42daabe9e8a5410/crates/rust-analyzer/src/handlers.rs#L959

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

3 participants