Type inference for id member expressions in completion - #18
Merged
Conversation
Typing `root.` where `id: root` resolves to a specific type now offers that type's properties (including inherited ones via the prototype chain) instead of the generic property list. Implementation: * buildIDTypeIndex walks ui_binding nodes named "id" and records the id → enclosing type. It prefers a ui_object_definition ancestor and falls back to a textual brace-balance scan when the parser error- recovers — which happens in the common case where `.` has no member after it yet. * The ContextProperty branch of Completion consults the index when the identifier before `.` matches an id, and returns typePropertyCompletions in that case. Unknown identifiers fall back to generic properties so existing behavior is unchanged.
cushycush
added a commit
that referenced
this pull request
Apr 17, 2026
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.
Summary
root.whereid: rootresolves to a concrete type now offers that type's properties (plus inherited ones via the prototype chain) instead of the generic property list.ui_object_definition.foo.wherefooisn't an id) fall back to the generic property list, so existing behavior is preserved.Test plan
go test -race ./...identifierBeforeDottoken extraction, end-to-end completion after<id>., and fallback when the identifier isn't a known id.Rectangle { id: root; width: root.| }— completion shows Rectangle+Item properties, not just the generic set.Closes
Last item on the v1.6.0 follow-on roadmap (document links and cross-file go-to-def shipped in #16 / #17).