mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
Java: update "Non-terminal use of '\\s' escape sequence" now that PsiTemplate is not an expression anymore (IDEA-326944)
GitOrigin-RevId: cea018045f87fad01824bf68ebf10ecdb798e39d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5ca7339356
commit
edfa8f41a5
@@ -11,6 +11,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.*;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.PsiReplacementUtil;
|
||||
import com.siyeh.ig.psiutils.TypeUtils;
|
||||
import it.unimi.dsi.fastutil.ints.IntArrayList;
|
||||
import it.unimi.dsi.fastutil.ints.IntList;
|
||||
@@ -108,7 +109,12 @@ public class EscapedSpaceInspection extends AbstractBaseJavaLocalInspectionTool
|
||||
.append(text.length())
|
||||
.pairMap((start, end) -> text.substring(start + 2, end))
|
||||
.joining(" ");
|
||||
element.replace(JavaPsiFacade.getElementFactory(project).createExpressionFromText(newText, null));
|
||||
if (element instanceof PsiFragment) {
|
||||
PsiReplacementUtil.replaceFragment((PsiFragment)element, newText);
|
||||
}
|
||||
else {
|
||||
element.replace(JavaPsiFacade.getElementFactory(project).createExpressionFromText(newText, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,6 @@ class X {
|
||||
String x() {
|
||||
|
||||
return STR."""
|
||||
\{ }"""
|
||||
\{} \{}"""
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,6 @@ class X {
|
||||
String x() {
|
||||
|
||||
return STR."""
|
||||
<caret>\s\{}"""
|
||||
\{}<caret>\s\{}"""
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user