mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: don't suggest to "Replace with text block" a text block (IDEA-358449)
GitOrigin-RevId: 4db08b1a6a9e5bb3c957e23af185e6df1f757c47
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3c7271ac4e
commit
0c4fc2ab23
+1
-1
@@ -85,7 +85,7 @@ public final class TextBlockMigrationInspection extends AbstractBaseJavaLocalIns
|
||||
@Override
|
||||
public void visitLiteralExpression(@NotNull PsiLiteralExpression expression) {
|
||||
if (PsiUtil.skipParenthesizedExprUp(expression.getParent()) instanceof PsiPolyadicExpression) return;
|
||||
if (!ExpressionUtils.hasStringType(expression)) return;
|
||||
if (!ExpressionUtils.hasStringType(expression) || expression.isTextBlock()) return;
|
||||
String text = expression.getText();
|
||||
int newLineIdx = getNewLineIndex(text, 0);
|
||||
if (mySuggestLiteralReplacement && newLineIdx != -1 && getNewLineIndex(text, newLineIdx + 1) != -1) {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// "Fix all 'Text block can be used' problems in file" "false"
|
||||
|
||||
class NonStringLiteral {
|
||||
|
||||
void empty() {
|
||||
String textBlock = """<caret>
|
||||
what?
|
||||
""";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user