Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
morsiu opened this issue Feb 6, 2025 · 0 comments · May be fixed by #3915
Open

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

morsiu opened this issue Feb 6, 2025 · 0 comments · May be fixed by #3915

Comments

@morsiu
Copy link
Contributor

morsiu commented Feb 6, 2025

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.

morsiu added a commit to morsiu/StyleCopAnalyzers that referenced this issue Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant