mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
[java-completion] MissingThrowExpressionFixer: avoid completion if it's started on the expression line
Fixes IDEA-367667 Complete current statement action breaks on a new line character GitOrigin-RevId: fed8b5d8d860f491391413383922c112d9649eff
This commit is contained in:
committed by
intellij-monorepo-bot
parent
af80b1afd1
commit
b8792b5e29
@@ -15,9 +15,10 @@ public class MissingThrowExpressionFixer implements Fixer {
|
||||
throws IncorrectOperationException {
|
||||
if (BasicJavaAstTreeUtil.is(astNode, BASIC_THROW_STATEMENT)) {
|
||||
ASTNode expression = BasicJavaAstTreeUtil.getExpression(astNode);
|
||||
if (expression != null &&
|
||||
startLine(editor, astNode) == startLine(editor, expression)) {
|
||||
return;
|
||||
if (expression != null) {
|
||||
int expressionLine = startLine(editor, expression);
|
||||
if (startLine(editor, astNode) == expressionLine) return;
|
||||
if (editor.getDocument().getLineNumber(editor.getCaretModel().getOffset()) == expressionLine) return;
|
||||
}
|
||||
|
||||
final int startOffset = astNode.getTextRange().getStartOffset();
|
||||
|
||||
@@ -85,6 +85,8 @@ public abstract class AbstractBasicCompleteStatementTest extends LightPlatformCo
|
||||
public void testNoErrors() { doTest(); }
|
||||
|
||||
public void testThrow() { doTest(); }
|
||||
|
||||
public void testThrowTwoLinesSemicolon() { doTest(); }
|
||||
|
||||
public void testReturn() { doTest(); }
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
class Scratch {
|
||||
public static void main(String[] args) {
|
||||
throw
|
||||
new <caret>RuntimeException("aaa")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
class Scratch {
|
||||
public static void main(String[] args) {
|
||||
throw
|
||||
new RuntimeException("aaa");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user