Option to not break line if the line break does not actually shorten the line.

Completed

I'm seeing this issue with interpolated strings mostly, as they can be long.

 

But, what I see is this:

this.logger.LogInfo($"Some long text that goes past the line break margin");

Turns into:

this.logger.LogInfo(
                              $"Some long text that goes past the line break margin");

Basically - it added an extra line that doesn't add any value.

                         

5 comments
Comment actions Permalink

Hello Allena!

 

Thank you for contacting us.

Please check if ReSharper | Options | Code Editing | C# | Formatting Style | Tabs, Indents, Alignment | Align Multiple Constructs | First Call Argument by '(' is enabled.

Thank you.

0
Comment actions Permalink

Hi Angelina - thanks for getting back to me.

Yes, that is checked - because that is the style I want for breaks and alignments.

See below examples

 

 

 

0
Comment actions Permalink

Hello Allena!

 

Sorry for delay in responding.

Just to make sure I've understood your point correctly:

  • you have Prefer wrap after '(' in invocation and  First Call Argument by '(' enabled
  • in case when breaking after '(' doesn't shorten the string you'd like the option won't be applied

Am I right?

Thank you.

0
Comment actions Permalink

Yes, that is what I'm looking for.

The middle example above just strikes me as pointless, and a waste of a line :-).

0
Comment actions Permalink

Hello!

 

Thank you for the clarification.

I've filed corresponding feature request - https://youtrack.jetbrains.com/issue/RSRP-470640.

You are welcome to comment or vote for it.

Thank you.

0

Please sign in to leave a comment.