4

Which setting(s) in Resharper 8 are reformatting my object initializer like this? (i.e. with the comma on it's own line).

var snowDepthProcessor = new DataProcessor<SnowDepthModel>
{
    Name = "Snow Depth"
    ,
    DataRetriever = snowReportRetriever
    ,
    Parser = new SnowDepthParser()
    ,
    ...
};

I've tried every combination of settings I can find/think of; I do want the lines chopped but I don't want the comma to be on its own line.

Jaroslav Kadlec
  • 2,505
  • 4
  • 32
  • 43
David Hayes
  • 7,402
  • 14
  • 50
  • 62
  • 1
    What version of Resharper are you using? – Peter Ritchie Aug 12 '13 at 17:20
  • 8 (it's in the title), I'll add it to the question too – David Hayes Aug 12 '13 at 22:02
  • :) I don't read titles... What do you have set for Right Margin in the Line Breaks and Wrapping settings (under Line Wrapping subheading)? – Peter Ritchie Aug 12 '13 at 22:32
  • 1
    I tried a lot of settings combinations and didn't find out it for your issue. Could you upload your ReSharper settings somewhere? P.S. If you place commas in the end of the line and then invoke code format, do ReSharper place each comma on its own line? – rpeshkov Aug 12 '13 at 23:24
  • 1
    Still seeing this in Resharper 9 even if I reset to the default settings – David Hayes Jan 15 '15 at 23:40

1 Answers1

0

I share your pain. I've to admit my solution is just partial because it needs change style from what you'd like to use to

List<string> demo = new List<string>
{
    "a",
    "b",
    "c"
}

Then formatting is not changed. I'd also much rather use syntax you've described so I've created R# ticket https://youtrack.jetbrains.com/issue/RSRP-453704 but until it's resolved this is only way how suppress that (it behave in same way even in latest R#10)

EDIT: Good news. Seems to be fixed since R# 2017.1

Jaroslav Kadlec
  • 2,505
  • 4
  • 32
  • 43