Resharper reformats Linq operator for input and selection on one line

When I type in a Linq query type expression like

var stuff = from x in things group x by x.Something into g select g; 

Resharper reformatts it to

 var stuff = from x in things group x by x.Something into g select g; 

And then complains about it because it violates the StyleCop SA1103 rule. Is this a bug in Resharper or is there some combination of settings that I need to change so that it does not reformat it?

Edit

JetBrains has confirmed that this is a bug and has been fixed in version 8.0.

+6
source share
2 answers

After looking at the ReSharper parameters, in the "Code Editing" section there is one parameter β†’ C # β†’ Formatting style β†’ Other, called β€œAlign multi-line constructs, LINQ query”.

It seems that to control the appropriate formatting (disabling it causes a multi-line linq query to not align, but just indent as tabs).

Based on the fact that there is no more detailed control over what happens with into , I would say that this is either a mistake or a missed requirement on their part. Maybe raise a ticket.

Honestly, I was expecting to find something in the Line Breaks and Wrapping section, but there was nothing for linq queries.

ReSharper 7.1.1000.900 on VS 2012

+9
source

The problem seems to be back in R # 8.1 :-( I added a comment to the related Resharper issue ( http://youtrack.jetbrains.com/issue/RSRP-338644 )

0
source

Source: https://habr.com/ru/post/947741/


All Articles