Skip to content

Enable --wrapstringinterpolation preserve #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

calda
Copy link
Member

@calda calda commented May 16, 2025

By default SwiftFormat will insert linebreaks in multi-line string interpolations. This is allowed by the language and doesn't affect the resulting string values, but in practice produces ugly results that hurts readability.

This PR enables the --wrapstringinterpolation preserve option, which was added in nicklockwood/SwiftFormat#2059.

Since we don't have a style rule specifically discussing line wrapping in string interpolation, and we just got this behavior by default when enabling the SwiftFormat wrapping behavior, I don't feel the need to address this case directly in the style guide.

@@ -42,7 +42,8 @@ namespace :update do
.binaryTarget(
name: "swiftformat",
url: "https://github.com/calda/SwiftFormat-nightly/releases/download/#{latest_version_number}/SwiftFormat.artifactbundle.zip",
checksum: "#{checksum.strip}"),
checksum: "#{checksum.strip}"
),
Copy link
Member Author

Choose a reason for hiding this comment

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

While we're here, update the update:swiftformat rake task to output correctly-formatted code

@calda calda changed the title Cal wrap string interpolation Enable --wrapstringinterpolation preserve May 16, 2025
@calda calda enabled auto-merge (rebase) May 16, 2025 20:35
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.

1 participant