Search code examples
c#visual-studio-2013resharperstylecop

Method parameters are being separated into new lines


Ever since I installed StyleCop, ReSharper has been forcing method parameters on seperate lines regardless of my settings.

An example is:

return this._context.ContentItems
    .Join(this._context.SiteSchedules, ci => ci.ID, sc => sc.ContentItemID, 
        (ci, sc) => new {SiteSchedule = sc, ContentItem = ci})
    .Join(this._context.Blogs, o => o.ContentItem.ID, b => b.ContentItemID, 
        (o, b) => new { o.ContentItem, o.SiteSchedule, Blog = b })

Gets reformated to:

return this._context.ContentItems
    .Join(
        this._context.SiteSchedules, 
        ci => ci.ID, 
        sc => sc.ContentItemID, 
        (ci, sc) => new { SiteSchedule = sc, ContentItem = ci })
     .Join(
         this._context.Blogs, 
         o => o.ContentItem.ID, 
         b => b.ContentItemID, 
         (o, b) => new { o.ContentItem, o.SiteSchedule, Blog = b })

Searching online I found an option to keep existing line breaks, have turned that on but it still formats it. I have tried setting the Wrap formal parameters to both simple wrap and the default chop if long but none of this work. Is there another option that would interfere with the layout in this manner from either StyleCop or ReSharper?


Solution

  • Finally found the setting that was affecting line breaks. Apparently with the StyleCop installed, I had to uncheck the settings Code Editing | C# | Line Breaks and Wrapping | Line Wrapping -> Wrap long lines