dotnet/roslyn

Formatting fixer doesn't fix formatting diagnostic

Aperta

#72.534 aperta il 13 mar 2024

 (5 commenti) (0 reazioni) (1 assegnatario)C# (4257 fork)batch import
Area-IDEBugFeature - Collection Expressionshelp wanted

Metriche repository

Star
 (20.414 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Considering the following sample:


    class C
    {
        void M()
        {
            string[] x = [
"""
string
""",
"""
string
"""];
        }
    }

A formatting diagnostic is produced following the comma inside the collection expression: image

When invoking the format fixer, nothing happens. When previewing the formatting fix, an empty box is displayed:

image

I still question the choice to produce that diagnostic, given that raw string literals are not prescriptive about whether to indent and some people (like myself) prefer to left indent them for clarity.
But regardless of that design question, I would expect the fixer to be able to fix formatting issues that are reported.

Guida contributor