use of com.intellij.lang.parameterInfo.CreateParameterInfoContext in project intellij-community by JetBrains.
the class ParameterInfoTest method checkHighlighted.
private void checkHighlighted(int lineIndex) {
MethodParameterInfoHandler handler = new MethodParameterInfoHandler();
CreateParameterInfoContext context = createContext();
PsiExpressionList list = handler.findElementForParameterInfo(context);
Object[] itemsToShow = context.getItemsToShow();
assertEquals(itemsToShow[lineIndex], updateParameterInfo(handler, list, itemsToShow).getHighlightedParameter());
}
use of com.intellij.lang.parameterInfo.CreateParameterInfoContext in project intellij-community by JetBrains.
the class ParameterInfoTest method testAfterGenericsInsideCall.
public void testAfterGenericsInsideCall() {
myFixture.configureByFile(getTestName(false) + ".java");
MethodParameterInfoHandler handler = new MethodParameterInfoHandler();
CreateParameterInfoContext context = new MockCreateParameterInfoContext(getEditor(), getFile());
PsiExpressionList list = handler.findElementForParameterInfo(context);
assertNotNull(list);
Object[] itemsToShow = context.getItemsToShow();
assertNotNull(itemsToShow);
assertEquals(2, itemsToShow.length);
assertTrue(itemsToShow[0] instanceof MethodCandidateInfo);
PsiMethod method = ((MethodCandidateInfo) itemsToShow[0]).getElement();
ParameterInfoUIContextEx parameterContext = ParameterInfoComponent.createContext(itemsToShow, getEditor(), handler, 1);
parameterContext.setUIComponentEnabled(true);
PsiSubstitutor substitutor = ((MethodCandidateInfo) itemsToShow[0]).getSubstitutor();
String presentation = MethodParameterInfoHandler.updateMethodPresentation(method, substitutor, parameterContext);
assertEquals("<html>Class<T> type, <b>boolean tags</b></html>", presentation);
}
use of com.intellij.lang.parameterInfo.CreateParameterInfoContext in project intellij-community by JetBrains.
the class ParameterInfoTest method parameterPresentation.
private String parameterPresentation(int lineIndex, int parameterIndex) {
MethodParameterInfoHandler handler = new MethodParameterInfoHandler();
CreateParameterInfoContext context = createContext();
PsiExpressionList list = handler.findElementForParameterInfo(context);
assertNotNull(list);
Object[] itemsToShow = context.getItemsToShow();
assertNotNull(itemsToShow);
assertTrue(itemsToShow[lineIndex] instanceof MethodCandidateInfo);
PsiMethod method = ((MethodCandidateInfo) itemsToShow[lineIndex]).getElement();
ParameterInfoUIContextEx parameterContext = ParameterInfoComponent.createContext(itemsToShow, getEditor(), handler, parameterIndex);
PsiSubstitutor substitutor = ((MethodCandidateInfo) itemsToShow[lineIndex]).getSubstitutor();
return MethodParameterInfoHandler.updateMethodPresentation(method, substitutor, parameterContext);
}
use of com.intellij.lang.parameterInfo.CreateParameterInfoContext in project intellij-community by JetBrains.
the class ParameterInfoTest method doTest.
private void doTest(String paramsList) {
myFixture.configureByFile(getTestName(false) + ".java");
MethodParameterInfoHandler handler = new MethodParameterInfoHandler();
CreateParameterInfoContext context = new MockCreateParameterInfoContext(getEditor(), getFile());
PsiExpressionList list = handler.findElementForParameterInfo(context);
assertNotNull(list);
Object[] itemsToShow = context.getItemsToShow();
assertNotNull(itemsToShow);
assertTrue(itemsToShow.length > 0);
Object[] params = handler.getParametersForDocumentation(itemsToShow[0], context);
assertNotNull(params);
String joined = StringUtil.join(params, o -> ((PsiParameter) o).getName(), ",");
assertEquals(paramsList, joined);
}
Aggregations