Prevent newline when assinging to var?

I have some code that looks liek this

var passwordErrorText = DoSomeWorkWith(Browser).ThenDoSomething()
                                               .ThenDoSomething()                            
                                               .ThenDoSomething()                            
                                               .ThenDoSomething()                            
                                               .ThenDoSomething();


And resahrper keeps formatting it like

var passwordErrorText =
   DoSomeWorkWith(Browser)
          .ThenDoSomething()
          .ThenDoSomething()                            
          .ThenDoSomething()
          .ThenDoSomething()
          .ThenDoSomething();



How can I prevent this newline creation?

3 comments
Comment actions Permalink

Could you please specify the following:

  • lenght of the first line of initial string (with spaces from left border of text editor included);
  • ReSharper | Options | Code Editing | C# | Formatting Style | Line Breaks and Wrapping | Line wrapping | Line Wrapping | checked or unchecked;
  • ReSharper | Options | Code Editing | C# | Formatting Style | Line Breaks and Wrapping | Line wrapping | Line Wrapping | Right margin (column) | the value of the setting?
0
Comment actions Permalink

In my real example (not the contrived one I posted), the length of the first line of the initial string of

        var thing = DoSomething()


is 113 characters (including left margin)

Line wrapping is checked

Right margin column value is 140

If i do the following

        var thing = DoSomething().ThenDoThisOtherThing()


Then the right column value (including all left leading whitespace) is only 124.  I want everything to break after the second method invocation and align to the dots.  Is that possible?

0
Comment actions Permalink

Thanks for the reply! Just forgot to ask about the status of ReSharper | Options | Code Editing | C# | Formatting Style | Line Breaks and Wrapping | Preserve existing formatting | Keep existing line breaks.

0

Please sign in to leave a comment.