Highlight struct field access as a field - #1378
Open
integraledelebesgue wants to merge 1 commit into
Open
Conversation
Member
Author
|
This change is part of the following stack:
Change managed by git-spice. |
This was referenced Jul 24, 2026
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-macro-declaration-name
branch
from
July 24, 2026 11:50
a5eee47 to
1ab9c6e
Compare
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-field-access
branch
from
July 24, 2026 11:50
06ff0df to
a1958f2
Compare
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-macro-declaration-name
branch
from
July 24, 2026 14:24
1ab9c6e to
c9672ca
Compare
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-field-access
branch
from
July 24, 2026 14:24
a1958f2 to
ae1c220
Compare
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-macro-declaration-name
branch
from
August 4, 2026 10:29
c9672ca to
e886929
Compare
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-field-access
branch
from
August 4, 2026 10:29
ae1c220 to
f858ae7
Compare
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-macro-declaration-name
branch
from
August 4, 2026 10:36
e886929 to
6360f02
Compare
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-field-access
branch
from
August 4, 2026 10:36
f858ae7 to
58273e2
Compare
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-macro-declaration-name
branch
from
August 4, 2026 10:41
6360f02 to
b630e6b
Compare
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-field-access
branch
from
August 4, 2026 10:41
58273e2 to
e83f2ba
Compare
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-macro-declaration-name
branch
from
August 5, 2026 09:31
b630e6b to
06e3200
Compare
Base automatically changed from
fix/semantic-highlighting-macro-declaration-name
to
main
August 5, 2026 10:06
The right-hand side of a member access like `p.x` is not a resolved item nor a pattern, so it was left unhighlighted (or painted as the macro inside an inline macro). Resolve it through the semantic member access expression and highlight it as a field. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
integraledelebesgue
force-pushed
the
fix/semantic-highlighting-field-access
branch
from
August 5, 2026 10:15
e83f2ba to
92c617a
Compare
integraledelebesgue
marked this pull request as ready for review
August 5, 2026 10:15
integraledelebesgue
requested review from
maciektr,
piotmag769 and
wawel37
and removed request for
a team and
maciektr
August 5, 2026 10:15
wawel37
approved these changes
Aug 11, 2026
Arcticae
self-requested a review
August 12, 2026 10:34
Arcticae
requested changes
Aug 13, 2026
|
|
||
| /// Resolves the right-hand side of a struct member access expression (e.g. the `x` in `p.x`) | ||
| /// to a [`SemanticTokenKind::Field`]. | ||
| fn from_member_access( |
Member
There was a problem hiding this comment.
This is essentially a copy of what we already have in finder.rs:409 (try_member function). Please try to reuse that, i think it's applicable here.
| let expr_id = db.lookup_expr_by_ptr(function_id, binary_expr.stable_ptr(db).into()).ok()?; | ||
| let member_access = match db.expr_semantic(function_id, expr_id) { | ||
| Expr::MemberAccess(member_access) => member_access, | ||
| Expr::Snapshot(snapshot) => match db.expr_semantic(function_id, snapshot.inner) { |
Member
There was a problem hiding this comment.
we should probably have tests that cover snapshots behavior if we support those paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The right-hand side of a member access like
p.xis not a resolved item nor apattern, so it was left unhighlighted (or painted as the macro inside an inline
macro). Resolve it through the semantic member access expression and highlight it
as a field.