diff --git a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java index 372cb18f942a..c791e1f87dd5 100644 --- a/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/hint/api/impls/MethodParameterInfoHandler.java @@ -140,7 +140,8 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc int currentNumberOfParameters = expressionList.getExpressions().length; PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(context.getProject()); Document document = psiDocumentManager.getCachedDocument(context.getFile()); - if (context.getHighlightedParameter() != null && document != null && psiDocumentManager.isCommitted(document) && + if ((context.getHighlightedParameter() != null || candidates.length == 1) && + document != null && psiDocumentManager.isCommitted(document) && originalNumberOfParameters != currentNumberOfParameters && !(originalNumberOfParameters == 1 && currentNumberOfParameters == 0)) { List hints = expressionList.getUserData(JavaMethodCallElement.COMPLETION_HINTS); if (hints != null) { 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 52a96f95a5ea..93d3b2b585fb 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 @@ -225,6 +225,15 @@ public class CompletionHintsTest extends LightFixtureCompletionTestCase { myFixture.checkResultWithInlays("class C { void m() { System.getProperty( ) } }"); } + public void testHintsDisappearWhenNumberOfParametersIsChangedDirectlyWithNoOverloads() throws Exception { + myFixture.configureByText(JavaFileType.INSTANCE, "class C { void m() { Character.for } }"); + complete("forDigit"); + myFixture.checkResultWithInlays("class C { void m() { Character.forDigit(, ) } }"); + myFixture.performEditorAction(IdeActions.ACTION_EDITOR_DELETE); + waitForAllAsyncStuff(); + myFixture.checkResultWithInlays("class C { void m() { Character.forDigit( ) } }"); + } + public void testCaretIsToTheRightOfHintAfterSmartInnerCompletion() throws Exception { myFixture.configureByText(JavaFileType.INSTANCE, "class C { void m() { System.setPro } }"); complete("setProperty");