IDEA-112014 Complete Current Statement - doesn't work correctly on a multi-line statement

This commit is contained in:
peter
2013-08-20 11:49:43 +02:00
parent 941dd6fc07
commit 2b8ece109d
4 changed files with 16 additions and 1 deletions

View File

@@ -61,7 +61,9 @@ public class MethodCallFixer implements Fixer {
}
final PsiExpression[] params = args.getExpressions();
if (params.length > 0 && startLine(editor, args) != startLine(editor, params[0])) {
if (params.length > 0 &&
startLine(editor, args) != startLine(editor, params[0]) &&
editor.getCaretModel().getOffset() < params[0].getTextRange().getStartOffset()) {
endOffset = args.getTextRange().getStartOffset() + 1;
}

View File

@@ -0,0 +1,6 @@
class Test {
Object method() {
method(
factory()<caret>
}
}

View File

@@ -0,0 +1,6 @@
class Test {
Object method() {
method(
factory());<caret>
}
}

View File

@@ -205,6 +205,7 @@ public class CompleteStatementTest extends EditorActionTestCase {
public void testIDEADEV40479() throws Exception { doTest(); }
public void testMultilineReturn() throws Exception { doTest(); }
public void testMultilineCall() throws Exception { doTest(); }
public void testIDEADEV13019() throws Exception {
doTestBracesNextLineStyle();