dotnet/roslyn

Move static members has incorrect formatting after moving to nested type

Open

#74,054 opened on Jun 18, 2024

View on GitHub
 (0 comments) (0 reactions) (0 assignees)C# (4,257 forks)batch import
Area-IDEhelp wanted

Repository metrics

Stars
 (20,414 stars)
PR merge metrics
 (Avg merge 6d 17h) (256 merged PRs in 30d)

Description

(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);
    }
}

Contributor guide