mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
IDEA-184991 Parameter info popup doesn't highlight current item
This commit is contained in:
+3
@@ -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;
|
||||
|
||||
+7
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user