Field names formatting in highlighting made independent of pesky plugins

This commit is contained in:
Roman Shevchenko
2011-06-02 09:23:14 +04:00
committed by anna
parent 73e9ec3bef
commit d62745a9b0
2 changed files with 7 additions and 1 deletions
@@ -650,6 +650,11 @@ public class HighlightUtil {
PsiFormatUtilBase.SHOW_TYPE);
}
@NotNull
public static String formatField(@NotNull PsiField field) {
return PsiFormatUtil.formatVariable(field, PsiFormatUtilBase.SHOW_CONTAINING_CLASS | PsiFormatUtilBase.SHOW_NAME, PsiSubstitutor.EMPTY);
}
@NotNull
public static String formatType(@Nullable PsiType type) {
if (type == null) return PsiKeyword.NULL;
@@ -2150,6 +2155,7 @@ public class HighlightUtil {
private static String format(PsiElement element) {
if (element instanceof PsiClass) return formatClass((PsiClass)element);
if (element instanceof PsiMethod) return formatMethod((PsiMethod)element);
if (element instanceof PsiField) return formatField((PsiField)element);
return ElementDescriptionUtil.getElementDescription(element, HighlightUsagesDescriptionLocation.INSTANCE);
}
@@ -24,6 +24,6 @@ class Usage {
m(Base1.F); //Base1.m(int)
m(F); //Base2.m(float), float Base2.F
F.class.getName(); // class Base2.F
m(<error descr="Reference to 'IF' is ambiguous, both 'field I1.IF' and 'field I2.IF' match">IF</error>);
m(<error descr="Reference to 'IF' is ambiguous, both 'I1.IF' and 'I2.IF' match">IF</error>);
}
}