You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed a few issues with Salsa's macro that impact the accuracy of rust-analyzer's semantic highlighting. While the syntax theme that I'm using has support for semantic highlighting (so there's more bandwidth for the syntax highlighting to look slightly off), I confirmed the weirdness using a VS Code command called "Developer: Inspect Editor Tokens and Scopes" to determine just exactly how slightly off the different tokens are. Using tests/is_send_sync.rs as an example:
The struct keyword in struct MyInput, struct MyTracked<'db>, and struct MyInterned<'db> is reported as function, not a keyword.
a. The lifetimes in the tracked and interned structs are reported as functions, not lifetimes.
b. the field named field on MyInput is reported to be variable, not a property.
c. The fields on MyTracked and MyInterned are reported to be methods, not fields. Arguably, this is the correct decision!
the tracked function fn test(db: &dyn Database, input: MyInput)'s name ("test") is reported as a struct, not a function.
In tests/input_field_durability.rs on struct MyInput, the field types (bool and usize) are reported as unresolved references, not primitives.
I think it'd be good to resolve these either in Salsa or rust-analyzer since it's part of Salsa's fit-and-finish and these token mismatches might larger, more subtle issues in how rust-analyzer handles Salsa.
On the plus side, go-to-def/find-references on Salsa-annotated functions and structs work!
The text was updated successfully, but these errors were encountered:
Fixing 1 is easy -> #606 (comment)
2 is more tricky, r-a currently ranks tokens by similarity and (I believe) in case of equal ranking it picks the last usage of it (which in this case is from the impl within the function). So we'd need the function definitions name to be moved to the end which isn't really doable with the current scoping tricks used. (arguably r-a should pick the first in this case -> rust-lang/rust-analyzer#18410)
The field types rendering unresolved I don't really understand why that is happening
I noticed a few issues with Salsa's macro that impact the accuracy of rust-analyzer's semantic highlighting. While the syntax theme that I'm using has support for semantic highlighting (so there's more bandwidth for the syntax highlighting to look slightly off), I confirmed the weirdness using a VS Code command called "Developer: Inspect Editor Tokens and Scopes" to determine just exactly how slightly off the different tokens are. Using
tests/is_send_sync.rs
as an example:struct
keyword instruct MyInput
,struct MyTracked<'db>
, andstruct MyInterned<'db>
is reported as function, not a keyword.a. The lifetimes in the tracked and interned structs are reported as functions, not lifetimes.
b. the field named
field
onMyInput
is reported to be variable, not a property.c. The fields on
MyTracked
andMyInterned
are reported to be methods, not fields. Arguably, this is the correct decision!fn test(db: &dyn Database, input: MyInput)
's name ("test") is reported as a struct, not a function.In
tests/input_field_durability.rs
onstruct MyInput
, the field types (bool
andusize
) are reported as unresolved references, not primitives.I think it'd be good to resolve these either in Salsa or rust-analyzer since it's part of Salsa's fit-and-finish and these token mismatches might larger, more subtle issues in how rust-analyzer handles Salsa.
On the plus side, go-to-def/find-references on Salsa-annotated functions and structs work!
The text was updated successfully, but these errors were encountered: