mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PsiFormatUtil: don't show type annotations by default
This commit is contained in:
@@ -25,12 +25,12 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class PsiFormatUtil extends PsiFormatUtilBase {
|
||||
@MagicConstant(flags = {
|
||||
SHOW_MODIFIERS, SHOW_TYPE, TYPE_AFTER, SHOW_CONTAINING_CLASS, SHOW_FQ_NAME, SHOW_NAME, SHOW_MODIFIERS,
|
||||
SHOW_INITIALIZER, SHOW_RAW_TYPE, SHOW_RAW_NON_TOP_TYPE, SHOW_FQ_CLASS_NAMES})
|
||||
SHOW_INITIALIZER, SHOW_RAW_TYPE, SHOW_RAW_NON_TOP_TYPE, SHOW_FQ_CLASS_NAMES, USE_INTERNAL_CANONICAL_TEXT})
|
||||
public @interface FormatVariableOptions { }
|
||||
|
||||
@MagicConstant(flags = {
|
||||
SHOW_MODIFIERS, MODIFIERS_AFTER, SHOW_TYPE, TYPE_AFTER, SHOW_CONTAINING_CLASS, SHOW_FQ_NAME, SHOW_NAME,
|
||||
SHOW_PARAMETERS, SHOW_THROWS, SHOW_RAW_TYPE, SHOW_RAW_NON_TOP_TYPE, SHOW_FQ_CLASS_NAMES})
|
||||
SHOW_PARAMETERS, SHOW_THROWS, SHOW_RAW_TYPE, SHOW_RAW_NON_TOP_TYPE, SHOW_FQ_CLASS_NAMES, USE_INTERNAL_CANONICAL_TEXT})
|
||||
public @interface FormatMethodOptions { }
|
||||
|
||||
@MagicConstant(flags = {
|
||||
@@ -388,7 +388,9 @@ public class PsiFormatUtil extends PsiFormatUtilBase {
|
||||
}
|
||||
}
|
||||
if (type == null) return "null";
|
||||
return (options & SHOW_FQ_CLASS_NAMES) == 0 ? type.getPresentableText() : type.getInternalCanonicalText();
|
||||
return (options & SHOW_FQ_CLASS_NAMES) == 0 ? type.getPresentableText() :
|
||||
(options & USE_INTERNAL_CANONICAL_TEXT) == 0 ? type.getCanonicalText(false) :
|
||||
type.getInternalCanonicalText();
|
||||
}
|
||||
|
||||
public static String formatReference(PsiJavaCodeReferenceElement ref, int options) {
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class HighlightMessageUtil {
|
||||
else if (symbol instanceof PsiMethod) {
|
||||
symbolName = PsiFormatUtil.formatMethod((PsiMethod)symbol,
|
||||
substitutor, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS,
|
||||
PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.SHOW_FQ_CLASS_NAMES);
|
||||
PsiFormatUtilBase.SHOW_TYPE | PsiFormatUtilBase.SHOW_FQ_CLASS_NAMES | PsiFormatUtilBase.USE_INTERNAL_CANONICAL_TEXT);
|
||||
}
|
||||
else if (symbol instanceof PsiVariable) {
|
||||
symbolName = ((PsiVariable)symbol).getName();
|
||||
|
||||
@@ -38,6 +38,7 @@ public abstract class PsiFormatUtilBase {
|
||||
public static final int SHOW_ANONYMOUS_CLASS_VERBOSE = 0x8000; // class
|
||||
public static final int SHOW_RAW_TYPE = 0x10000; //type
|
||||
public static final int SHOW_RAW_NON_TOP_TYPE = 0x20000;
|
||||
public static final int USE_INTERNAL_CANONICAL_TEXT = 0x40000; // variable/method/parameter types
|
||||
public static final int MAX_PARAMS_TO_SHOW = 7;
|
||||
|
||||
protected static void appendSpaceIfNeeded(StringBuilder buffer) {
|
||||
|
||||
Reference in New Issue
Block a user