rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

`imports_granularity` not working on global config file

Open laralove143 opened this issue 1 year ago • 8 comments

this is very weird, if my config file is at /Users/lara/Library/Preferences/rustfmt/rustfmt.toml the options are detected (cargo fmt complains it can't set the options on stable), but they don't do anything.. i'm not sure if only imports_granularity is affected

putting the file at /Users/lara/rustfmt.toml or next to Cargo.toml makes it work fine

rustfmt version is rustfmt 1.5.1-nightly (4d6d601c 2022-07-26)

laralove143 avatar Jul 27 '22 14:07 laralove143

I believe this might be a duplicate of #4613

ytmimi avatar Jul 27 '22 14:07 ytmimi

I think the issue is that the Configurations.md is pointing to dirs v1.0.4, but we've since upgraded to dirs v4.0.0. Can you try placing the global config in $HOME/Library/Application Support like the v4.0.0 docs suggest and see if that resolves the issue.

ytmimi avatar Jul 27 '22 15:07 ytmimi

For anyone wanting to work on this we just need to update the link in the first paragraph of the Configurations.md to point at the same version as listed in the Cargo.toml

ytmimi avatar Jul 27 '22 15:07 ytmimi

For what it's worth this was the PR that bumped the version #5237

ytmimi avatar Jul 27 '22 15:07 ytmimi

Hey! Consider this PR :)

aizpurua23a avatar Jul 27 '22 17:07 aizpurua23a

@aizpurua23a thanks for the PR! @laralove143 when you have a moment please confirm that placing your config in $HOME/Library/Application Support resolves the issue.

ytmimi avatar Jul 27 '22 17:07 ytmimi

it doesn't seem to detect the config, its at /Users/lara/Library/Application Support/rustfmt/rustfmt.toml there are nightly options but cargo fmt doesn't complain about anything

laralove143 avatar Jul 29 '22 22:07 laralove143

Can you try running with the --verbose flags? That should tell you which config file, if any, is getting picked up. Remember that rustfmt doesn't (currently) support aggregated configs, so it will just pick up the first one it finds on the probe path. That means that if you have one locally in your project, a parent directory, etc. those will get selected and rustfmt won't look in home directory

calebcartwright avatar Aug 07 '22 01:08 calebcartwright