Skip to content

Commit 1399c70

Browse files
committed
修复inlayHint错乱
1 parent b09fd3a commit 1399c70

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

EmmyLua-LS/src/main/kotlin/com/tang/vscode/inlayHint/InlayHintService.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ object InlayHintService {
114114
if (child.node.elementType == LuaTypes.COMMA) {
115115
activeParameter++
116116
nCommas++
117-
} else {
117+
} else if (child.node.elementType == LuaTypes.LITERAL_EXPR
118+
|| child.node.elementType == LuaTypes.TABLE_EXPR
119+
|| child.node.elementType == LuaTypes.CLOSURE_EXPR
120+
|| child.node.elementType == LuaTypes.BINARY_EXPR
121+
|| child.node.elementType == LuaTypes.NAME_EXPR
122+
) {
118123
paramHints.add(RenderRange(child.textRange.toRange(file), null))
119124
literalMap[activeParameter] = paramHints.size - 1;
120125
}
@@ -155,7 +160,7 @@ object InlayHintService {
155160
val inlayHints = mutableListOf<InlayHint>()
156161
if (paramHints.isNotEmpty()) {
157162
for (paramHint in paramHints) {
158-
if(paramHint.hint != null) {
163+
if (paramHint.hint != null) {
159164
val hint = InlayHint(paramHint.range.start, Either.forLeft("${paramHint.hint}:"))
160165
hint.kind = InlayHintKind.Parameter
161166
hint.paddingRight = true
@@ -175,7 +180,7 @@ object InlayHintService {
175180
for (overrideHint in overrideHints) {
176181
val hint = InlayHint(overrideHint.range.end, Either.forLeft(overrideHint.hint))
177182
hint.paddingLeft = true
178-
if(overrideHint.data != null){
183+
if (overrideHint.data != null) {
179184
hint.data = overrideHint.data
180185
}
181186

0 commit comments

Comments
 (0)