Skip to content

Fix: ignore formatting comments in switch sections#1831

Merged
belav merged 3 commits intobelav:mainfrom
ngbrown:bug-1824-ignore-in-switch-section
Mar 14, 2026
Merged

Fix: ignore formatting comments in switch sections#1831
belav merged 3 commits intobelav:mainfrom
ngbrown:bug-1824-ignore-in-switch-section

Conversation

@ngbrown
Copy link
Copy Markdown
Contributor

@ngbrown ngbrown commented Mar 10, 2026

Description

When code is in a switch case statement group (or SyntaxKind.SwitchSection), the ignore comments should work, both range and one-line. This PR adds a failing test, and then resolves the issue.

Related Issue

Fixes #1824

Checklist

  • My code follows the project's code style
    • always var
    • follow existing naming conventions
    • always this.
    • no pointless comments
  • I will not force push after a code review of my PR has started
  • I have added tests that cover my changes

Copy link
Copy Markdown
Owner

@belav belav left a comment

Choose a reason for hiding this comment

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

Looks good, I like that you ensured the // csharpier-ignore would only ignore the first statement in a case section.

@belav belav enabled auto-merge (squash) March 14, 2026 15:16
@belav belav merged commit 99d3f93 into belav:main Mar 14, 2026
7 checks passed
@ngbrown ngbrown deleted the bug-1824-ignore-in-switch-section branch March 14, 2026 15:36
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.

[Bug]: Unable to ignore csharpier formatting within case statement group

2 participants