Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void indentTextBlocks(
StringBuilder output = new StringBuilder(initialLines.get(0).stripLeading());
for (int i = 0; i < lines.size(); i++) {
String line = lines.get(i);
String trimmed = line.stripLeading().stripTrailing();
String trimmed = line.stripTrailing();
output.append(separator);
if (!trimmed.isEmpty()) {
// Don't add incidental leading whitespace to empty lines
Expand All @@ -228,7 +228,7 @@ private void indentTextBlocks(
if (i == lines.size() - 1) {
String withoutDelimiter =
trimmed.substring(0, trimmed.length() - TEXT_BLOCK_DELIMITER.length());
if (!withoutDelimiter.isEmpty()) {
if (!withoutDelimiter.stripLeading().isEmpty()) {
output.append(withoutDelimiter).append('\\').append(separator).append(prefix);
}
// If the trailing line is just """, indenting it more than the prefix of incidental
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public class FormatterIntegrationTest {
"ExpressionSwitch",
"I574",
"I594",
"SwitchComment")
"SwitchComment",
"B380299722")
.putAll(15, "I603")
.putAll(16, "I588", "Sealed")
.putAll(17, "I683", "I684", "I696")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.helloworld;

class Foo {
void foo() {
var bar = """
bar\
bar""";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.helloworld;

class Foo {
void foo() {
var bar =
"""
bar\
bar\
""";
}
}
Loading