dotnet/roslyn

Move static members has incorrect formatting after moving to nested type

Open

#74,054 opened on 2024年6月18日

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
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

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

コントリビューターガイド