If you use the rust-analyzer extension (which is the recommended extension for Rust nowadays), it will also run rustfmt on save. rustfmt will in turn use its configuration file.
To be honest with you I don't really like this extension because it shows these things:
Unless if I can disable these things from showing up, I would rather use an alternative to only format my code Would you know how to disable those things from showing up?
Now I wanted to know with rust-analyzer specifically, how would I change how text is formated (e.g. braces formatting) because before I believe you were mentioning it for a different extension so I wanted to know for this specific extention the rust-analyzer how would I change it?
I need to target a file called rustfmt. So I am looking for the global configeration. I believe it is stored in %userprofile\AppData but where do I go next to get to the global verison of rustfmt ?
Warning: can't set `brace_style = AlwaysNextLine`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
it turns out I need to enable cargo nightly I will give that a shot
Now my next concern is that in regards to brace_style it works but it doesn't work for if statements. If anything, it forces it to use the typical egyptian style coding.
e.g.
fn main()
{
let mut x = 10;
if x == 10 {
x += 20;
}
}
I am not too sure which specific setting to change.
And in regards to struct_field_align_threshold, while it also works, the problem is that it is only limited to the amount of characters, so for instance if I exceed 20 then it will not format it e.g.
I want it to be infinity instead of having some form of limit and on top of that I want it to add even more spaces after the variable and to add a colon not at the variable but just before the type of variable.
e.g.
struct Color
{
red : u32,
blue : u32,
greenasds : u32,
}
Would you happen to know how I would format it like this?