Skip to content

SA1013 Allow } to start a line in interpolated string #3914

Open
@morsiu

Description

@morsiu

Currently, SA1013 interferes in situations where I would like to split very long interpolated strings into multiple lines, or when tooling like Resharper does that when formatting code.
This can be seen in the following example code:

var message =
    $"This a very long message with id {
        id
    }, that is easier to read when split into multiple lines ({
        numberOfLines
    } lines). Some additional expression to make it even longer: {
        (foobarbaz * xyz) / (foobarbaz + xyz)
    }";

Here, SA1013 generates warnings on lines starting with } (i.e. lines 4, 6 and 8).
The warning is that } should not be preceded by whitespace.
My suggestion is to not generate these warning in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions