-
Notifications
You must be signed in to change notification settings - Fork 492
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
LS: Discover struct members in constructor #6632
base: main
Are you sure you want to change the base?
Conversation
13621f5
to
99cd9f6
Compare
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.
Reviewed 2 of 3 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Arcticae, @Draggu, @orizi, and @piotmag769)
99cd9f6
to
64a30c3
Compare
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.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Arcticae, @Draggu, and @piotmag769)
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.
Reviewed all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Arcticae, @Draggu, and @piotmag769)
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.
Reviewed 2 of 3 files at r1, 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, and @integraledelebesgue)
crates/cairo-lang-language-server/src/lang/inspect/defs.rs
line 383 at r3 (raw file):
let struct_member = ast::StructArgSingle::from_syntax_node(db, struct_member); let ast::OptionStructArgExpr::StructArgExpr(struct_member_expr) = struct_member.arg_expr(db)
OptionStructArgExpr::Empty
is also a valid path here, it mean that the expression looks like this:
let my_field = 5;
MyStruct {
my_field,
}
I think we want to handle it as well
64a30c3
to
e37c2df
Compare
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.
Reviewable status: 3 of 4 files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @mkaput, and @piotmag769)
crates/cairo-lang-language-server/src/lang/inspect/defs.rs
line 383 at r3 (raw file):
Previously, piotmag769 (Piotr Magiera) wrote…
OptionStructArgExpr::Empty
is also a valid path here, it mean that the expression looks like this:let my_field = 5; MyStruct { my_field, }I think we want to handle it as well
I changed the implementation to handle this case. However, OptionStructArgExpr::Empty
doesn't have any useful functions to retrieve ExprId
s etc. thus I had to change the whole implementation to match members by names. Please have a look
e37c2df
to
c3d1b22
Compare
Closes #6537
Changes
struct_var.member
)structs.txt
- covers all struct member hovers scenarios