This is so with the current release 0.48.18, as well as with the 0.49.0 from the develop branch.
The attached .zip file contains SampleMultilineStrings.swift and run-test.sh to aid in the investigation.
The SampleMultilineStrings.swift contains several sample strings similar to shortSample2 above.
When run as a swift script it prints the line counts for the sample strings:
investigate-squashed-blank-lines % cp SampleMultilineStrings.swift formatted-SampleMultilineStrings.swift
investigate-squashed-blank-lines % swiftformat formatted-SampleMultilineStrings.swift
Running SwiftFormat...
warning: No Swift version was specified, so some formatting features were disabled. Specify the version of Swift you are using with the --swiftversion option, or by adding a .swift-version file to your project.
SwiftFormat completed in 0.1s.
1/1 files formatted.
investigate-squashed-blank-lines % ./formatted-SampleMultilineStrings.swift
running formatted-SampleMultilineStrings.swift...
realLifeSample1 OK
realLifeSample2 FAILED: expected 32 lines, actual 26
shortSample1 OK
shortSample2 FAILED: expected 10 lines, actual 7
shortSample3 FAILED: expected 10 lines, actual 9
shortSample4 OK
shortSample5 FAILED: expected 10 lines, actual 9
shortSample6 OK
The script run-test.sh mechanizes above sequence, for repetitive tests.
That is, multiple blank lines following a
\(someExpression)
get squashed into a single blank line.Example: when you
swiftformat
a file containing this construct ...... the 4 blank lines following
\(interpolated)
get squashed into a single blank line:This is so with the current release
0.48.18
, as well as with the0.49.0
from thedevelop
branch.The attached .zip file contains
SampleMultilineStrings.swift
andrun-test.sh
to aid in the investigation.The
SampleMultilineStrings.swift
contains several sample strings similar toshortSample2
above. When run as a swift script it prints the line counts for the sample strings:The script
run-test.sh
mechanizes above sequence, for repetitive tests.investigate-squashed-blank-lines.zip