Skip to content

Seems like incorrect break for chained property and method calls #956

@kazrac

Description

@kazrac

In https://playground.csharpier.com/ I have played around with chains and following does not seem right:
Input:

someLongNameField
    .Method0()
    .Property0
    .Property1
    .Property2
    .Method1()
    .Property3
    .Array1[1]
    .Property4
    .Property5
    .Method2()
    .Method3("some input")
    .Method2()
    .Property6
    .Property7
    .Array2[2]
    .Property8
    .Method4("some input")
    .Property9
    .Property10;

output:

someLongNameField.Method0().Property0.Property1.Property2.Method1().Property3.Array1[
    1
].Property4.Property5
    .Method2()
    .Method3("some input")
    .Method2()
    .Property6.Property7.Array2[2].Property8
    .Method4("some input")
    .Property9.Property10;

property and method chains are broken differently.

Other example:
input

			return _someResolver
				.Resolve(
					(
						raw
							.Settings
							.AttributeTemplate
							.Settings
							.OutputSettings[raw.TestFramework]
							.AttributeTemplate
							.Settings
							.AttributeTemplate
							.Settings
							.OutputSettings[raw.TestFramework]
							.AttributeTemplate,
						new
						{
							ClassName = className,
							TestClassName = raw.MethodSymbol.ContainingType.Name,
							TestName = raw.MethodSymbol.Name
						})
				);

output:

return _someResolver.Resolve(
    (
        raw.Settings.AttributeTemplate.Settings.OutputSettings[raw.TestFramework]
            .AttributeTemplate
            .Settings
            .AttributeTemplate
            .Settings
            .OutputSettings[raw.TestFramework].AttributeTemplate,
        new
        {
            ClassName = className,
            TestClassName = raw.MethodSymbol.ContainingType.Name,
            TestName = raw.MethodSymbol.Name
        }
    )
);

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions