Skip to content

Commit eb22b2a

Browse files
committed
优化hover时的显式
1 parent 5d46780 commit eb22b2a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

EmmyLua-Common/src/main/java/com/tang/intellij/lua/ty/TyRenderer.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ open class TyRenderer : TyVisitor(), ITyRenderer {
100100
"{ ${list.joinToString(", ")} }"
101101
}
102102
clazz.hasFlag(TyFlags.ANONYMOUS_TABLE) -> renderType(Constants.WORD_TABLE)
103-
clazz.isAnonymous -> "[local ${clazz.varName}]"
104-
clazz.isGlobal -> "[global ${clazz.varName}]"
103+
clazz.isAnonymous -> clazz.varName
104+
clazz.isGlobal -> clazz.varName
105105
else -> renderType(clazz.className)
106106
}
107107
}

EmmyLua-LS/src/main/kotlin/com/tang/vscode/documentation/LuaDocumentationProvider.kt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,19 +108,30 @@ class LuaDocumentationProvider : DocumentationProvider {
108108
val context = SearchContext.get(classMember.project)
109109
val parentType = classMember.guessClassType(context)
110110
val ty = classMember.guessType(context)
111-
112111
//base info
113112
if (parentType != null) {
114113
sb.wrapLanguage("lua") {
114+
when (classMember.visibility) {
115+
Visibility.PUBLIC -> {
116+
sb.append("(public) ")
117+
}
118+
Visibility.PRIVATE -> {
119+
sb.append("(private) ")
120+
}
121+
Visibility.PROTECTED -> {
122+
sb.append("(protected) ")
123+
}
124+
}
115125
when (ty) {
116126
is TyFunction -> {
117127
sb.append("function ")
118-
if(parentType.displayName != "_G") {
128+
if (parentType.displayName != "_G") {
119129
renderTy(sb, parentType)
120130
sb.append(if (ty.isColonCall) ":" else ".")
121131
}
122132
sb.append(classMember.name)
123133
renderSignature(sb, ty.mainSignature)
134+
124135
return@wrapLanguage
125136
}
126137
is TyClass -> {

0 commit comments

Comments
 (0)