mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-inspections] TextBlockMigration: properly escape ending space
GitOrigin-RevId: 8cbd99ecf3b4b9c068e30317e930eae150a007d9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
29e0987c94
commit
26aea361f0
+5
-1
@@ -142,7 +142,11 @@ public class TextBlockMigrationInspection extends AbstractBaseJavaLocalInspectio
|
||||
// append \ + newline at the end of the last line, so we can use closing """ to indent
|
||||
lines[lines.length - 1] += "\\\n";
|
||||
}
|
||||
return "\"\"\"\n" + StringUtil.join(lines) + "\"\"\"";
|
||||
String content = StringUtil.join(lines);
|
||||
if (content.endsWith(" ")) {
|
||||
content = content.substring(0, content.length() - 1) + "\\s";
|
||||
}
|
||||
return "\"\"\"\n" + content + "\"\"\"";
|
||||
}
|
||||
|
||||
private static String @Nullable [] getContentLines(PsiExpression @NotNull [] operands) {
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ class TextBlockMigration {
|
||||
<html> \s
|
||||
<body>
|
||||
</body>
|
||||
</html> """;
|
||||
</html> \s""";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Replace with text block" "true-preview"
|
||||
|
||||
class TextBlockMigration {
|
||||
|
||||
void spaces() {
|
||||
String foobarbaz = """
|
||||
foo
|
||||
bar \s
|
||||
baz \s""";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// "Replace with text block" "true-preview"
|
||||
|
||||
class TextBlockMigration {
|
||||
|
||||
void spaces() {
|
||||
String foobarbaz = """
|
||||
foo
|
||||
bar
|
||||
\s""";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Replace with text block" "true-preview"
|
||||
|
||||
class TextBlockMigration {
|
||||
|
||||
void spaces() {
|
||||
String foobarbaz = "foo<caret>\n" +
|
||||
"bar \n" +
|
||||
"baz ";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Replace with text block" "true-preview"
|
||||
|
||||
class TextBlockMigration {
|
||||
|
||||
void spaces() {
|
||||
String foobarbaz = "foo<caret>\n" +
|
||||
"bar\n" +
|
||||
" ";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user