Skip to content

Fix disable:next handling in multiline strings - #2646

Merged
nicklockwood merged 3 commits into
nicklockwood:developfrom
EhsanAzish80:fix-disable-next-multiline-string
Sep 2, 2026
Merged

Fix disable:next handling in multiline strings#2646
nicklockwood merged 3 commits into
nicklockwood:developfrom
EhsanAzish80:fix-disable-next-multiline-string

Conversation

@EhsanAzish80

@EhsanAzish80 EhsanAzish80 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #2645.

disable:next was consumed by the first physical line break inside a multiline string, allowing disabled rules such as wrap to run on the remaining string contents.

This change evaluates rule enablement within multiline strings from the opening delimiter, including content inside string interpolation scopes. The directive therefore applies to the entire multiline string while formatting resumes normally afterward.

Added focused regression coverage that reproduces the unwanted wrapping and verifies formatting resumes after the string.

Testing:

  • Full test suite: 5,930 tests passed with zero failures
  • Changed files pass SwiftFormat lint

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.45%. Comparing base (dac0c06) to head (7981f2f).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2646   +/-   ##
========================================
  Coverage    95.44%   95.45%           
========================================
  Files          177      177           
  Lines        27073    27095   +22     
========================================
+ Hits         25841    25864   +23     
+ Misses        1232     1231    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread Sources/Formatter.swift Outdated
@nicklockwood
nicklockwood merged commit 3d203dc into nicklockwood:develop Sep 2, 2026
16 checks passed
@nicklockwood

Copy link
Copy Markdown
Owner

@EhsanAzish80 thanks! and sorry for the delay in review

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.

3 participants