Skip to content

Commit 3827e4f

Browse files
committed
Remove semantic tokens for string interpolations
These cover up string interpolations and thus generally produce a worse highlighting than before.
1 parent 382b174 commit 3827e4f

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

server/src/main/kotlin/org/javacs/kt/semantictokens/SemanticTokens.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,8 @@ private fun elementToken(element: PsiElement, bindingContext: BindingContext): S
187187

188188
// Literals and string interpolations
189189

190-
is KtSimpleNameStringTemplateEntry, is KtBlockStringTemplateEntry ->
190+
is KtSimpleNameStringTemplateEntry ->
191191
SemanticToken(elementRange, SemanticTokenType.INTERPOLATION_ENTRY)
192-
is KtStringTemplateExpression -> SemanticToken(elementRange, SemanticTokenType.STRING)
193192
is PsiLiteralExpression -> {
194193
val tokenType = when (element.type) {
195194
PsiType.INT, PsiType.LONG, PsiType.DOUBLE -> SemanticTokenType.NUMBER

server/src/test/kotlin/org/javacs/kt/SemanticTokensTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ class SemanticTokensTest : SingleFileTestFixture("semantictokens", "SemanticToke
2222
val expectedConst = sequenceOf(
2323
SemanticToken(range(constLine, 5, constLine, 13), SemanticTokenType.PROPERTY, setOf(SemanticTokenModifier.DECLARATION, SemanticTokenModifier.READONLY)), // constant
2424
SemanticToken(range(constLine, 15, constLine, 21), SemanticTokenType.CLASS), // String
25-
SemanticToken(range(constLine, 24, constLine, 40), SemanticTokenType.STRING), // "test $variable"
2625
SemanticToken(range(constLine, 30, constLine, 39), SemanticTokenType.INTERPOLATION_ENTRY), // $variable
2726
SemanticToken(range(constLine, 31, constLine, 39), SemanticTokenType.PROPERTY), // variable
2827
)

0 commit comments

Comments
 (0)