Open kendrahavens opened 5 years ago
Closed duplicate developer community feedback
Additional notes:
Today we offer to optional wrapping fixes, but do not have a configuration option to just offer the preferred style all the time:
Without indent
With Indent
Two Options appear in flyout menu:
FWIW, I'm particular and possibly peculiar. For long if statements I tend to want to line up conditionals that match levels. For example:
Visual studio always wants to help me by reformatting these. I want the format of the code to communicate as much about it's structure as possible. In general, people aren't good at turning waggly-snagals (&&, ||, !) into logic. Ok, maybe it's just me, but I'm people too. In any case there should be an opt out for "if you aren't going to format it like I want, then just don't touch it".
When wrapping functions I do something like this:
Note the ending lambda will probably make complex formatting "more complexier"
This same thinking also applies to wrapping long mathematical expressions. That's not super common for me, but if I have to split the line I like wrapping it so that sub-expressions at the same level indent the same using the '=' as the root point (like the || lines up under the 'if' above).
Looks like there's no indentation handling here.
modelBuilder.Entity<MyEntity>()
.Property(e => e.MyProp)
.HasMaxLength(15);
Looks like there's no indentation handling here.
modelBuilder.Entity<MyEntity>() .Property(e => e.MyProp) .HasMaxLength(15);
For the case @alrz mentioned, this is handled nicely on codebeautify.org.
@jmarolf is there some option of looking at how they do this and integrating it in the scope of this issue? It's really the only remaining major issue I'm experiencing with most of the formatting tooling...
For me, I want the ability to wrap this:
var x = y.GroupBy(i => i.Key.Id, i => i.Key.Version).Where(i => i.Count() > 1).ToImmutableArray();
to this:
var x = y
.GroupBy(i => i.Key.Id, i => i.Key.Version)
.Where(i => i.Count() > 1)
.ToImmutableArray();
hadn't seen this flavor called out in this issue so thought I'd add it.
Internal customer ask.
The indent and wrapping behavior on parameters or chained method calls (or any multi-line construct) should be a configuration option and included in editorconfig. There should also be an option to apply these when formatting.