csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

String Concatentation (or binary expression) should indent in method invocation

Open belav opened this issue 4 years ago • 4 comments

class ClassName
{
    void MethodName()
    {
        var result = await ProcessUtil.RunAsync(
            commonTestArgs
            + " --TestCaseFilter:\"Quarantined!=true|Quarantined=false\"              ",
            environmentVariables: EnvironmentVariables
        );
    }
}
// should be
class ClassName
{
    void MethodName()
    {
        var result = await ProcessUtil.RunAsync(
            commonTestArgs
                + " --TestCaseFilter:\"Quarantined!=true|Quarantined=false\"              ",
            environmentVariables: EnvironmentVariables
        );
    }
}

belav avatar Jun 26 '21 15:06 belav

Should we because we don't indent other binary operators such as && or ||?

respel avatar Jun 26 '21 17:06 respel

I think we'd want to indent other binary operators as well. Prettier does this

callMethod(
  first____________,
  secondWithAdd +
    someLongName__________________________________________________________,
  thirdWithAnd &&
    someLongName__________________________________________________________
);

belav avatar Jun 27 '21 16:06 belav

SwitchExpressions will hopefully be handled by this too

return someValue switch
{
    OneMore
      => "someStrings"
      + "moreStrings"
      + "andMoreStrings_________________________________________"
};

// should be
return someValue switch
{
    OneMore
      => "someStrings"
          + "moreStrings"
          + "andMoreStrings_________________________________________"
};

// or if possible use an align 2 somehow instead of an indent
return someValue switch
{
    OneMore
      => "someStrings"
        + "moreStrings"
        + "andMoreStrings_________________________________________"
};

belav avatar Jul 11 '21 18:07 belav

#37 handled most of this, but if we want the align 2 called out in the above comment, we'll have to do some additional work.

belav avatar Jul 19 '21 16:07 belav