dotnet/roslyn

Move static members has incorrect formatting after moving to nested type

Open

#74.054 aperta il 18 giu 2024

Vedi su GitHub
 (0 commenti) (0 reazioni) (0 assegnatari)C# (4257 fork)batch import
Area-IDEhelp wanted

Metriche repository

Star
 (20.414 star)
Metriche merge PR
 (Merge medio 6g 17h) (256 PR mergiate in 30 g)

Descrizione

(found in https://github.com/dotnet/roslyn/pull/74037)

Before:

namespace ConsoleApp3;

public static class WorkflowValidations
{
    public static class WorkflowTypes
    {
        public const string FirstType = "firstType";
    }
    private static readonly System.Collections.Generic.List<string> validWorkflowTypes = new System.Collections.Generic.List<string>()
    {
        "firstType"
    };

    //  Moving this method and above dependency into WorkflowTypes static class 
    public static bool IsValidWorkflowType(this string workflowType) => validWorkflowTypes.Contains(workflowType);
}

Trigger move static members, select both members and move to WorkflowTypes, results in correct code, but incorrect formatting

namespace ConsoleApp3;

public static class WorkflowValidations
{
    public static class WorkflowTypes
    {
        public const string FirstType = "firstType";
    private static readonly System.Collections.Generic.List<string> validWorkflowTypes = new System.Collections.Generic.List<string>()
    {
        "firstType"
    };

    //  Moving this method and above dependency into WorkflowTypes static class 
    public static bool IsValidWorkflowType(this string workflowType) => validWorkflowTypes.Contains(workflowType);
    }
}

Guida contributor