-
Notifications
You must be signed in to change notification settings - Fork 68
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
Conversation
src/test/resources/org/elm/lang/core/parser/fixtures/partial/FieldAccessors.txt
Show resolved
Hide resolved
There was a problem hiding this 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.
src/main/kotlin/org/elm/lang/core/psi/elements/ElmFieldAccessorFunctionExpr.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
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
.