Skip to content

Commit 4a9779c

Browse files
committed
Extract precedence lists into static variables
1 parent 878d395 commit 4a9779c

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

org.eclipse.lsp4e/src/org/eclipse/lsp4e/ui/AbstractLsp4eLabelProvider.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,28 @@ public abstract class AbstractLsp4eLabelProvider extends LabelProvider {
5656
return LSPImages.imageDescriptorOverlayFromSymbolTag(SymbolTag.Deprecated);
5757
}
5858

59+
private static final List<SymbolTag> VISIBILITY_PRECEDENCE = List.of(
60+
SymbolTag.Public, SymbolTag.Protected, SymbolTag.Package,
61+
SymbolTag.Internal, SymbolTag.File, SymbolTag.Private);;
62+
5963
/**
6064
* Returns a list of visibility {@link SymbolTag}s with decreasing precedence.
6165
* May be overridden by subclasses to change the visibility overlay icons shown.
6266
*
6367
* @return a list of visibility {@link SymbolTag}s
6468
*/
6569
protected List<SymbolTag> getVisibilityPrecedence() {
66-
return List.of(
67-
SymbolTag.Public, SymbolTag.Protected, SymbolTag.Package,
68-
SymbolTag.Internal, SymbolTag.File, SymbolTag.Private);
70+
return VISIBILITY_PRECEDENCE;
6971
}
7072

73+
// In order to keep the number of overlay icons rather small in the UI, we do not show the following symbol tags:
74+
// SymbolTag.Nullable, SymbolTag.NonNull, SymbolTag.Declaration, SymbolTag.Definition
75+
private static final List<SymbolTag> ADDITIONAL_TAGS_PRECEDENCE = List.of(
76+
SymbolTag.Static, SymbolTag.Final, SymbolTag.Abstract,
77+
SymbolTag.Overrides, SymbolTag.Implements, SymbolTag.Virtual, SymbolTag.Sealed,
78+
SymbolTag.Synchronized, SymbolTag.Transient, SymbolTag.Volatile,
79+
SymbolTag.ReadOnly);
80+
7181
/**
7282
* Returns a list of {@link SymbolTag}s excluding visibility and deprecation tags with decreasing precedence.
7383
* May be overridden by subclasses to change the overlay icons shown in addition to visibility and deprecation.
@@ -78,13 +88,7 @@ protected List<SymbolTag> getVisibilityPrecedence() {
7888
* @return a list of {@link SymbolTag}s without visibility and deprecation tags
7989
*/
8090
protected List<SymbolTag> getAdditionalTagsPrecedence() {
81-
// In order to keep the number of overlay icons rather small in the UI, we do not show the following symbol tags:
82-
// SymbolTag.Nullable, SymbolTag.NonNull, SymbolTag.Declaration, SymbolTag.Definition
83-
return List.of(
84-
SymbolTag.Static, SymbolTag.Final, SymbolTag.Abstract,
85-
SymbolTag.Overrides, SymbolTag.Implements, SymbolTag.Virtual, SymbolTag.Sealed,
86-
SymbolTag.Synchronized, SymbolTag.Transient, SymbolTag.Volatile,
87-
SymbolTag.ReadOnly);
91+
return ADDITIONAL_TAGS_PRECEDENCE;
8892
}
8993

9094
/**

0 commit comments

Comments
 (0)