Skip to content

Commit a6710c3

Browse files
committed
annoation icon for completion
1 parent 99454b3 commit a6710c3

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/main/java/com/tang/intellij/lua/editor/completion/LuaCommentCompletionContributor.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public LuaCommentCompletionContributor() {
7979
protected void addCompletions(@NotNull CompletionParameters completionParameters, ProcessingContext processingContext, @NotNull CompletionResultSet completionResultSet) {
8080
TokenSet set = LuaSyntaxHighlighter.DOC_KEYWORD_TOKENS;
8181
for (IElementType type : set.getTypes()) {
82-
completionResultSet.addElement(LookupElementBuilder.create(type));
82+
completionResultSet.addElement(LookupElementBuilder.create(type).withIcon(LuaIcons.ANNOTATION));
8383
}
8484
}
8585
});
@@ -148,14 +148,11 @@ protected void addCompletions(@NotNull CompletionParameters completionParameters
148148
LuaDocClassDef classDef = PsiTreeUtil.findChildOfType(comment, LuaDocClassDef.class);
149149
if (classDef != null) {
150150
LuaType classType = classDef.getClassType();
151-
if (classType != null) {
152-
classType.processFields(new SearchContext(classDef.getProject()), (curType, field) -> {
153-
completionResultSet.addElement(LookupElementBuilder.create(field.getFieldName()));
154-
});
155-
}
151+
classType.processFields(new SearchContext(classDef.getProject()), (curType, field) -> {
152+
completionResultSet.addElement(LookupElementBuilder.create(field.getFieldName()));
153+
});
156154
}
157155
}
158156
});
159157
}
160-
161158
}

src/main/java/com/tang/intellij/lua/lang/LuaIcons.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class LuaIcons {
3939
public static final Icon LOCAL_FUNCTION = new LayeredIcon(AllIcons.Nodes.Function, AllIcons.Nodes.C_private);
4040
public static final Icon PARAMETER = AllIcons.Nodes.Parameter;
4141
public static final Icon WORD = AllIcons.Actions.Edit;
42+
public static final Icon ANNOTATION = AllIcons.Css.Atrule;
4243

4344
public static final Icon MODULE = IconLoader.getIcon("/icons/module.png");
4445
}

0 commit comments

Comments
 (0)