Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 13, 2025

Testing lambda formatting with comments (Issue #25010)

Comprehensive tests to verify that the formatting issue with comments in lambda expressions has been resolved:

  • Explored repository structure and formatting test infrastructure
  • Created test cases for lambda with comment formatting issue
  • Built the test project successfully
  • Ran tests - all 3 new tests pass, confirming the issue is fixed
  • Verified no regressions in all 516 formatting tests
  • Ran security checks (CodeQL) - no issues detected
  • Verified tests match the exact issue description
  • Updated WorkItem URLs to reference issue Reformatting does not consistently indent comment and succeeding statement #25010

Summary

The issue described in #25010 has been fixed. The tests demonstrate that:

  1. Lambda expressions with comments now format correctly - Comments and subsequent statements maintain consistent indentation
  2. No regressions - All 516 existing formatting tests continue to pass
  3. Control test included - Verified that if-statements with comments format correctly (they were not affected by this issue)

Test Details

Three new tests were added to FormattingTests.cs:

  1. LambdaWithCommentAndStatement - Tests the exact scenario from issue Reformatting does not consistently indent comment and succeeding statement #25010
  2. LambdaWithMultipleCommentsAndStatements - Tests lambdas with multiple statements and comments
  3. IfStatementWithCommentNotAffected - Control test showing if-statements work correctly

All tests verify that when code with improper indentation is formatted, the output has consistent and correct indentation for both comments and statements within lambda expressions.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add formatting tests for inconsistent comment indentation issue Add tests demonstrating lambda comment formatting issue is fixed Nov 13, 2025
Copilot AI requested a review from CyrusNajmabadi November 13, 2025 15:26
Copilot finished work on behalf of CyrusNajmabadi November 13, 2025 15:26
}
""");

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/22713")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot update these urls to #25010

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated all three WorkItem URLs to reference issue #25010 in commit 2e7dd28.

CyrusNajmabadi and others added 2 commits November 13, 2025 16:41
Co-authored-by: CyrusNajmabadi <4564579+CyrusNajmabadi@users.noreply.github.com>
Copilot finished work on behalf of CyrusNajmabadi November 13, 2025 15:49
Copilot AI requested a review from CyrusNajmabadi November 13, 2025 15:49
@CyrusNajmabadi CyrusNajmabadi merged commit 036ef34 into main Nov 13, 2025
26 checks passed
@CyrusNajmabadi CyrusNajmabadi deleted the copilot/add-formatting-tests-issue-15-5-7 branch November 13, 2025 17:53
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Nov 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants