New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent Semantic Tokens #525
Comments
anthony-S93
changed the title
The semantic tokens assigned to mutable variables seem inconsistent.
Inconsistent Semantic Tokens
Nov 12, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The semantic tokens assigned to variables in declaration statements are inconsistent with the tokens assigned to those same variables everywhere they are used.
The following sample code illustrates the issue.
Using an inspection tool, I could see that
mutable_variable
was assigned the tokenlsp.type.property.kotlin
in the declaration statement:However,
mutable_variable
was assignedlsp.type.variable
everywhere else (which is obvious from the different highlighting) .I am new to Kotlin, but my intuition tells me that the language server shouldn't treat a variable in a
var
declaration as aproperty
unless the declaration occurs within the context of aclass
. Is this the expected behavior? Or am I completely off base?EDIT:
After a few days of experimentation, I discovered other inconsistencies.
for
loop variables parsed as parameters in thefor
header.Using an inspection tool on the sample code above reveals the following semantic token assignments for various references of the variable
fruit
:Once again, it appears that the language server relies on syntax rather than semantics when assigning tokens to variables.
The text was updated successfully, but these errors were encountered: