csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

Fixing issues with weird indent on raw string literals as arguments

Open belav opened this issue 1 year ago • 1 comments

closes #1169

belav avatar Feb 11 '24 22:02 belav

I fixed the extra indent, but there is also the problem of the arguments not breaking properly. It looks like this problem also exists for multiline verbatim strings so it has been here for a while. I have the problem somewhat narrowed down, so hopefully can fix it within this PR

// input/expected output
CallMethod(
    """
    SomeRawString
    """.CallMethod().CallMethod()
);

CallMethod(
    @"
    SomeVerbatimString
    ".CallMethod().CallMethod()
);

// actual output
CallMethod("""
    SomeRawString
    """.CallMethod().CallMethod());

CallMethod(@"
    SomeVerbatimString
    ".CallMethod().CallMethod());

The problem is more apparent with multiple arguments

// input/expected output
CallMethod(
    """
    SomeRawString
    """.CallMethod().CallMethod(),
    []
);

// actual output
CallMethod("""
    SomeRawString
    """.CallMethod().CallMethod(), []);

belav avatar Feb 11 '24 22:02 belav