Skip to content
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

Support references to record fields in annotated functions #459

Merged
merged 21 commits into from
Aug 7, 2019

Conversation

ajalt
Copy link
Collaborator

@ajalt ajalt commented Aug 6, 2019

This allows features such as Go To Definition, Rename, Quick Documentation, and Find Usages to work on record fields. This works for records defined in either type aliases or type annotations. It should work for all field names inside of a top-level annotated function, including within nested functions. This includes field access expressions, field accessor functions, and record value expressions that get assigned to a type alias or union.

Only references to unions and type aliases will resolve. Field access of record literals, either in the same function or in another unannotated function, will not resolve. Field access on the parameters of unannotated top-level functions will not resolve.

As part of this change, I removed the pin from the field access expression bnf rule so that the name element is always present. This causes error messages to be slightly more cryptic in some cases, but it also fixes the incorrect parsing of expressions like a .b.

Capture


Capture2


Capture3

@ajalt ajalt requested a review from klazuka August 6, 2019 23:46
Copy link
Collaborator

@klazuka klazuka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feature is amazing. Nice work.

There are a few things that I need to follow-up on related to stub indexing, but I wanted to post my comments now before I eat lunch.

Copy link
Collaborator

@klazuka klazuka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@klazuka klazuka merged commit fa6bff7 into intellij-elm:master Aug 7, 2019
@ajalt ajalt deleted the record-reference branch August 7, 2019 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants