IDEA-184991 Parameter info popup doesn't highlight current item

This commit is contained in:
peter
2018-01-27 18:01:42 +01:00
parent 66c7be76e9
commit fb752a206f
3 changed files with 33 additions and 0 deletions
@@ -324,6 +324,9 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc
}
context.setUIComponentEnabled(i, enabled);
if (!enabled && context.getHighlightedParameter() == candidate) {
context.setHighlightedParameter(null);
}
if (candidates.length > 1 && enabled) {
if (PsiManager.getInstance(context.getProject()).areElementsEquivalent(chosenMethod, method)) {
chosenInfo = candidate;
@@ -0,0 +1,7 @@
class A {
void foo() {}
void foo(int a, int b, int c) {}
{
foo(<caret>)
}
}
@@ -361,4 +361,27 @@ public class ParameterInfoTest extends LightCodeInsightFixtureTestCase {
myFixture.checkResultByFile(getTestName(false) + "_after.java");
}
public void testHighlightCurrentParameterAfterTypingFirstArgumentOfThree() {
myFixture.configureByFile(getTestName(false) + ".java");
MethodParameterInfoHandler handler = new MethodParameterInfoHandler();
CreateParameterInfoContext context = new MockCreateParameterInfoContext(getEditor(), getFile());
PsiExpressionList argList = handler.findElementForParameterInfo(context);
assertNotNull(argList);
Object[] items = context.getItemsToShow();
assertSize(2, items);
MockUpdateParameterInfoContext updateContext = updateParameterInfo(handler, argList, items);
assertTrue(updateContext.isUIComponentEnabled(0));
assertTrue(updateContext.isUIComponentEnabled(1));
assertEquals(-1, updateContext.getCurrentParameter());
myFixture.type("1, ");
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
handler.updateParameterInfo(argList, updateContext);
assertFalse(updateContext.isUIComponentEnabled(0));
assertTrue(updateContext.isUIComponentEnabled(1));
assertEquals(1, updateContext.getCurrentParameter());
}
}