Skip to content

Commit ea2c3b8

Browse files
committed
presentable text
1 parent 6da424a commit ea2c3b8

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/main/java/com/tang/intellij/lua/lang/type/LuaType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public String getClassName() {
114114
}
115115

116116
public String getDisplayName() {
117-
return isAnonymous() ? "" : getClassName();
117+
return isAnonymous() ? "Anonymous" : getClassName();
118118
}
119119

120120
void serialize(@NotNull StubOutputStream stubOutputStream) throws IOException {

src/main/java/com/tang/intellij/lua/psi/LuaPsiImplUtil.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,14 @@ public static boolean isStatic(LuaClassMethodDef classMethodDef) {
127127

128128
public static ItemPresentation getPresentation(LuaClassMethodDef classMethodDef) {
129129
return new ItemPresentation() {
130-
@Nullable
131130
@Override
132131
public String getPresentableText() {
133-
return classMethodDef.getName();
132+
LuaType type = classMethodDef.getClassType(new SearchContext(classMethodDef.getProject()));
133+
if (type != null) {
134+
String c = classMethodDef.isStatic() ? "." : ":";
135+
return type.getDisplayName() + c + classMethodDef.getName() + classMethodDef.getParamSignature();
136+
}
137+
return classMethodDef.getName() + classMethodDef.getParamSignature();
134138
}
135139

136140
@NotNull
@@ -175,10 +179,9 @@ public static String getName(LuaGlobalFuncDef globalFuncDef) {
175179

176180
public static ItemPresentation getPresentation(LuaGlobalFuncDef globalFuncDef) {
177181
return new ItemPresentation() {
178-
@Nullable
179182
@Override
180183
public String getPresentableText() {
181-
return globalFuncDef.getName();
184+
return globalFuncDef.getName() + globalFuncDef.getParamSignature();
182185
}
183186

184187
@NotNull
@@ -566,10 +569,14 @@ public static LuaTypeSet guessType(LuaTableField tableField, SearchContext conte
566569
return null;
567570
}
568571

569-
public static String getFieldName(LuaTableField tableField) {
572+
public static String getName(LuaTableField tableField) {
570573
LuaTableFieldStub stub = tableField.getStub();
571574
if (stub != null)
572575
return stub.getFieldName();
576+
return getName((PsiNameIdentifierOwner) tableField);
577+
}
578+
579+
public static String getFieldName(LuaTableField tableField) {
573580
return getName(tableField);
574581
}
575582

0 commit comments

Comments
 (0)