IDEA-178462 Parameter info in tooltip for @Deprecated method

This commit is contained in:
Dmitry Batrak
2017-09-08 13:10:46 +03:00
parent e1e3f9c871
commit d64f741ae5
6 changed files with 23 additions and 1 deletions
@@ -630,7 +630,7 @@ public class MethodParameterInfoHandler implements ParameterInfoHandlerWithTabAc
highlightStartOffset,
highlightEndOffset,
!context.isUIComponentEnabled(),
method.isDeprecated() && !context.isSingleParameterInfo(),
method.isDeprecated() && !context.isSingleParameterInfo() && !context.isSingleOverload(),
false,
context.getDefaultParameterColor()
);
@@ -22,6 +22,7 @@ import com.intellij.codeInsight.hint.api.impls.AnnotationParameterInfoHandler;
import com.intellij.codeInsight.hint.api.impls.MethodParameterInfoHandler;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementPresentation;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.lang.parameterInfo.CreateParameterInfoContext;
import com.intellij.lang.parameterInfo.ParameterInfoUIContextEx;
import com.intellij.openapi.util.Disposer;
@@ -296,6 +297,11 @@ public class ParameterInfoTest extends LightCodeInsightFixtureTestCase {
checkHighlighted(0);
}
public void testNoStrikeoutForSingleDeprecatedMethod() {
myFixture.configureByText(JavaFileType.INSTANCE, "class C { void m() { System.runFinalizersOnExit(true<caret>); } }");
assertEquals("<html>boolean value</html>", parameterPresentation(-1));
}
private void checkHighlighted(int lineIndex) {
MethodParameterInfoHandler handler = new MethodParameterInfoHandler();
CreateParameterInfoContext context = createContext();
@@ -29,6 +29,7 @@ public interface ParameterInfoUIContext {
int getCurrentParameterIndex();
PsiElement getParameterOwner();
boolean isSingleOverload();
boolean isSingleParameterInfo();
Color getDefaultParameterColor();
}
@@ -210,6 +210,11 @@ public class ParameterInfoComponent extends JPanel {
return myParameterOwner;
}
@Override
public boolean isSingleOverload() {
return myPanels.length == 1;
}
@Override
public boolean isSingleParameterInfo() {
return mySingleParameterInfo;
@@ -69,6 +69,11 @@ public class MockParameterInfoUIContext<T extends PsiElement> implements Paramet
return myFunction;
}
@Override
public boolean isSingleOverload() {
return false;
}
@Override
public boolean isSingleParameterInfo() {
return false;
@@ -819,6 +819,11 @@ public class PyParameterInfoTest extends LightMarkedTestCase {
return myParameterOwner;
}
@Override
public boolean isSingleOverload() {
return myItemsToShow.length == 1;
}
@Override
public boolean isSingleParameterInfo() {
return false;