dotnet/roslyn

Move static members has incorrect formatting after moving to nested type

Open

#74.054 aberto em 18 de jun. de 2024

Ver no GitHub
 (0 comments) (0 reactions) (0 assignees)C# (4.257 forks)batch import
Area-IDEhelp wanted

Métricas do repositório

Stars
 (20.414 stars)
Métricas de merge de PR
 (Mesclagem média 6d 17h) (256 fundiu PRs em 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);
    }
}

Guia do colaborador