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

Invalid code for comments inside expressions in verbatim interpolated strings #679

Closed
ivan-razorenov opened this issue Jun 1, 2022 · 1 comment · Fixed by #685
Closed
Labels
Milestone

Comments

@ivan-razorenov
Copy link

Reproduction: format

class ClassName
{
    void MethodName()
    {
        return $@"
            {
            // comment
            "hi"
            }
        ";
    }
}

which will produce

class ClassName
{
    void MethodName()
    {
        return $@"
            {
        // comment "hi"}
        ";
    }
}
@belav
Copy link
Owner

belav commented Jun 1, 2022

Not only did I not realize new lines were allowed within an expression in an interpolated verbatim string, but there were apparently no instances of this within all the public repos I test on.
I can have this fixed pretty easily, thanks for reporting it.

belav added a commit that referenced this issue Jun 1, 2022
belav added a commit that referenced this issue Jun 6, 2022
@belav belav added this to the 0.18.0 milestone Jun 6, 2022
@belav belav closed this as completed in #685 Jun 6, 2022
belav added a commit that referenced this issue Jun 6, 2022
* Initial quick fix for interpolated verbatim strings with comments in expression

closes #679

* Adding link for PR to review

* Keep existing breaks in interpolated verbatim strings

* Update Ignored.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants