csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

fix: comment break indentation of simple lambdas

Open TimothyMakkison opened this issue 2 months ago • 2 comments

Fixes #1147, again this is my first time fixing bugs, no idea if I'm doing it right

Lambdas seem pretty all over the place, I'm pretty sure () => has some issues as well

TimothyMakkison avatar Oct 19 '25 20:10 TimothyMakkison

This has possibly a single edge case that it still needs to handle - https://github.com/belav/csharpier-repos/pull/152/files

I think those all are this same issue

// input and expected output
        Assert.Collection(
            outputSteps,
            // First source output for diagnostics is unchanged.
            step => Assert.Equal(IncrementalStepRunReason.Unchanged, step.Reason),
            // Second source output for generated code is changed.
            step => Assert.Equal(IncrementalStepRunReason.Modified, step.Reason)
        );

// current changes cause it to do this
        Assert.Collection(
            outputSteps,
            // First source output for diagnostics is unchanged.
            step =>
                Assert.Equal(IncrementalStepRunReason.Unchanged, step.Reason),
            // Second source output for generated code is changed.
            step =>
                Assert.Equal(IncrementalStepRunReason.Modified, step.Reason)
        );

belav avatar Oct 21 '25 00:10 belav

Okay, I think I've fixed this issue but have replaced it with a new one, see MemberChains.test. I don't think this is a new issue #1613 parenthesized lambda expressions have the same behaviour.

I assume the fix is found in ArgumentListLike.Print but it may be beyond my current understanding, I'd appreciate your help here.

Before

Select______________________________________(superLongName_________________________ =>
    true
);

After

Select______________________________________(superLongName_________________________ => true
); // weird parentheses,

TimothyMakkison avatar Oct 26 '25 23:10 TimothyMakkison