Skip to content

Fix block bodied lambda attribute formatting#12913

Merged
davidwengier merged 6 commits intodotnet:mainfrom
davidwengier:fix-12785-lambda-attribute-formatting
Mar 18, 2026
Merged

Fix block bodied lambda attribute formatting#12913
davidwengier merged 6 commits intodotnet:mainfrom
davidwengier:fix-12785-lambda-attribute-formatting

Conversation

@davidwengier
Copy link
Member

Fixes #12785

Unfortunately the changes here are pretty big, and especially sadly one part we have to specifically check for block bodied lambdas. The upside is that this change also improves formatting for one other case, that is multiline expressions in attributes. Added a bunch of new tests that hopefully cover all of the weird possibilities here. Lambdas continue to be a painful part of formatting, but at least now we're only dealing with the ones the user writes, and not the ones the Razor compiler uses everywhere, which at least means failure modes should be more forgiving.

davidwengier and others added 5 commits March 18, 2026 13:38
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidwengier davidwengier requested a review from a team as a code owner March 18, 2026 02:44
@davidwengier davidwengier merged commit dcfc37e into dotnet:main Mar 18, 2026
10 checks passed
@davidwengier davidwengier deleted the fix-12785-lambda-attribute-formatting branch March 18, 2026 22:00
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formatting fails for block bodied lambdas in event handler attributes

2 participants