@@ -7,7 +7,8 @@ import org.eclipse.lsp4j.Range
7
7
import org.javacs.kt.CompiledFile
8
8
import org.javacs.kt.position.range
9
9
import org.javacs.kt.util.preOrderTraversal
10
- import org.jetbrains.kotlin.descriptors.ClassifierDescriptor
10
+ import org.jetbrains.kotlin.descriptors.ClassDescriptor
11
+ import org.jetbrains.kotlin.descriptors.ClassKind
11
12
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
12
13
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
13
14
import org.jetbrains.kotlin.descriptors.VariableDescriptor
@@ -22,6 +23,9 @@ private enum class SemanticTokenType(val typeName: String) {
22
23
FUNCTION (SemanticTokenTypes .Function ),
23
24
PROPERTY (SemanticTokenTypes .Property ),
24
25
ENUM_MEMBER (SemanticTokenTypes .EnumMember ),
26
+ CLASS (SemanticTokenTypes .Class ),
27
+ INTERFACE (SemanticTokenTypes .Interface ),
28
+ ENUM (SemanticTokenTypes .Enum ),
25
29
TYPE (SemanticTokenTypes .Type )
26
30
}
27
31
@@ -84,7 +88,13 @@ private fun elementToken(element: PsiElement, bindingContext: BindingContext): S
84
88
is PropertyDescriptor -> SemanticTokenType .PROPERTY
85
89
is VariableDescriptor -> SemanticTokenType .VARIABLE
86
90
is FunctionDescriptor -> SemanticTokenType .FUNCTION
87
- is ClassifierDescriptor -> SemanticTokenType .TYPE
91
+ is ClassDescriptor -> when (target.kind) {
92
+ ClassKind .CLASS -> SemanticTokenType .CLASS
93
+ ClassKind .OBJECT -> SemanticTokenType .CLASS
94
+ ClassKind .INTERFACE -> SemanticTokenType .INTERFACE
95
+ ClassKind .ENUM_CLASS -> SemanticTokenType .ENUM
96
+ else -> SemanticTokenType .TYPE
97
+ }
88
98
else -> return null
89
99
}
90
100
SemanticToken (elementRange, tokenType)
0 commit comments