mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
Java: strip trailing whitespace from text-block string template end correctly (IDEA-354777)
GitOrigin-RevId: fa0266faeeaf63b04451b4f068550e22e2cdf8ee
This commit is contained in:
committed by
intellij-monorepo-bot
parent
19bcdae73f
commit
b0b4e53ad2
@@ -144,6 +144,10 @@ public final class PsiFragmentImpl extends LeafPsiElement implements PsiFragment
|
||||
}
|
||||
result.append(c);
|
||||
}
|
||||
if (strip == indent) {
|
||||
int end = result.length();
|
||||
result.delete(end - indent, end);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,24 @@ public class StringTemplateReverseMigrationInspectionTest extends LightJavaCodeI
|
||||
}
|
||||
}""");
|
||||
}
|
||||
|
||||
public void testTrailingWhitespace() {
|
||||
doTest("""
|
||||
class TrailingWhitespace {
|
||||
void foo(String name) {
|
||||
String s = STR.""\"<caret>
|
||||
Hello \\{name}
|
||||
""\";
|
||||
}
|
||||
}
|
||||
""", """
|
||||
class TrailingWhitespace {
|
||||
void foo(String name) {
|
||||
String s = "Hello " + name + "\\n";
|
||||
}
|
||||
}
|
||||
""");
|
||||
}
|
||||
|
||||
public void testOverrideStringProcessor() {
|
||||
doTest("""
|
||||
|
||||
Reference in New Issue
Block a user