From fb8a15b92d3f322f4ef5660af64782df38115580 Mon Sep 17 00:00:00 2001 From: Dmitry Batrak Date: Tue, 24 Jul 2018 10:31:33 +0300 Subject: [PATCH] fix Tab not working to move between completion parameters for a call inside another call --- .../completion/JavaMethodCallElement.java | 2 +- .../completion/CompletionHintsTest.java | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java index 19a6c581a371..0f389d37d475 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallElement.java @@ -327,7 +327,7 @@ public class JavaMethodCallElement extends LookupItem implements Type PsiDocumentManager.getInstance(project).commitDocument(document); MethodParameterInfoHandler handler = new MethodParameterInfoHandler(); - ShowParameterInfoContext infoContext = new ShowParameterInfoContext(editor, project, context.getFile(), braceOffset, braceOffset); + ShowParameterInfoContext infoContext = new ShowParameterInfoContext(editor, project, context.getFile(), offset, braceOffset); if (!methodCall.isValid() || handler.findElementForParameterInfo(infoContext) == null) { document.deleteString(offset, offset + commas.length()); return; diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CompletionHintsTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CompletionHintsTest.java index 57c16765562d..4064e5274355 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CompletionHintsTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/CompletionHintsTest.java @@ -1383,7 +1383,22 @@ public class CompletionHintsTest extends AbstractParameterInfoTestCase { public void testHintsAreNotShownInImproperContext() { configureJava("class C { void m() { int a = Math.ma5; } }"); complete("max(int a, int b)"); - checkResult("class C { void m() { int a = Math.max()5; } }"); + checkResultWithInlays("class C { void m() { int a = Math.max()5; } }"); + } + + public void testConstructorInvocationInsideMethodInvocation() throws Exception { + enableVirtualComma(); + + configureJava("class C { void m() { System.getPro } }"); + complete("getProperty(String key)"); + checkResultWithInlays("class C { void m() { System.getProperty() } }"); + type("new Strin"); + complete("String(byte[] bytes, String charsetName)"); + checkResultWithInlays("class C { void m() { System.getProperty(new String()) } }"); + type("null"); + next(); + waitForAllAsyncStuff(); + checkResultWithInlays("class C { void m() { System.getProperty(new String(null, )) } }"); } private void checkResultWithInlays(String text) {