Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-469284: Block aligning object initialization does not align property/field-names

$
0
0
Reporter Bendik August Nesbø (XplittR) Bendik August Nesbø (XplittR)
Created Apr 17, 2018 11:24:35 AM
Updated Apr 17, 2018 11:24:35 AM
Subsystem Code Style - Formatter
Assignee Dmitry Osinovsky (Dmitry.Osinovsky)
Priority Normal
State Submitted
Type Bug
Fix version No Fix versions
Affected versions 2018.1.1
Fixed In Version ReSharper Undefined
VsVersion VS 2017 RTM

When using the new block alignment, it does not align the field/propertynames when initializing multiple objects on single lines.
Example input:

var objs = new[]{
  new MyObj {Id = 9, SomeField = "short", SomeValue = true,},
  new MyObj {Id = 10, SomeField = "longer description", SomeValue = true,},
}

Expected formatting, option 1:

var objs = new[]{
  new MyObj {Id = 9,  SomeField = "short",              SomeValue = true,},
  new MyObj {Id = 10, SomeField = "longer description", SomeValue = true,},
}

Expected formatting, option 2:

var objs = new[]{
  new MyObj {Id = 9 , SomeField = "short"             , SomeValue = true,},
  new MyObj {Id = 10, SomeField = "longer description", SomeValue = true,},
}

Actual formatting:

var objs = new[]{
  new MyObj {Id = 9, SomeField  = "short", SomeValue              = true,},
  new MyObj {Id = 10, SomeField = "longer description", SomeValue = true,},
}

As you can see, the formatting does not align the SomeField -names (one space difference), and not the SomeValue-names (multiple spaces difference).
In option 1 (and even more so in option2), it would be very easy to mass-insert a new field-initialization between SomeField and SomeValue


Viewing all articles
Browse latest Browse all 106942

Trending Articles