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

internal: use current folder's rustfmt.toml with all rustfmt configurations #15564

Conversation

davidbarsky
Copy link
Contributor

Introduction

Resolves #15540. I moved the chdir functionality outside of the match to ensure that this functionality wouldn’t fall through again. As part of this PR, I also changed from_proto::file_range to accept a TextDocumentIdentifier by reference instead of by value, but I can undo this change if desired.

Testing

I added a rustfmt.toml will the contents below at crates/rust-analyzer/rustfmt.toml:


reorder_modules = false
use_small_heuristics = "Max"
# this is the only difference from the `rustfmt.toml` at the root of the repo
tab_spaces = 8

In addition, I've also added "rust-analyzer.rustfmt.overrideCommand": ["rustfmt"] to my VS Code configuration.

With the above changes, saving crates/rust-analyzer/src/handlers/request.rs results in 8-space indentation. Meanwhile, saving crates/toolchain/src/lib.rs does not result in any formatting changes.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 6, 2023
@Veykril
Copy link
Member

Veykril commented Sep 6, 2023

Thanks!
@bors r+

@bors
Copy link
Collaborator

bors commented Sep 6, 2023

📌 Commit 42f77f8 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Sep 6, 2023

⌛ Testing commit 42f77f8 with merge a843e46...

@bors
Copy link
Collaborator

bors commented Sep 6, 2023

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing a843e46 to master...

@bors bors merged commit a843e46 into rust-lang:master Sep 6, 2023
10 checks passed
@davidbarsky davidbarsky deleted the davidbarsky/use-current-subcrates-rustfmt-toml-with-custom-command branch September 6, 2023 20:37
@RalfJung
Copy link
Member

I'm afraid this has caused new problems: #15595

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

invoking rustfmt uses the project-wide rustfmt.toml, not the one for the current subcrate
5 participants