-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[move-ide] Fixed auto-completion on the dot character #20175
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Skipped Deployments
|
@@ -393,6 +393,7 @@ pub enum Exp_ { | |||
/* is_macro */ Option<Loc>, | |||
Option<Vec<Type>>, | |||
Spanned<Vec<Exp>>, | |||
Loc, // location of the dot |
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.
Put Loc
between the boxed expression and the name.
@@ -336,7 +336,7 @@ pub type LambdaLValues = Spanned<LambdaLValues_>; | |||
#[allow(clippy::large_enum_variant)] | |||
pub enum ExpDotted_ { | |||
Exp(Box<Exp>), | |||
Dot(Box<ExpDotted>, Name), | |||
Dot(Box<ExpDotted>, Name, Loc), |
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.
Loc
in the middle
if context.env.ide_mode() { | ||
if let Some(mdot_loc) = method_dot_loc { | ||
ide_report_autocomplete(context, &mdot_loc, &edotted_ty); | ||
} | ||
} | ||
result |
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 check is redundant.
if context.env.ide_mode() { | |
if let Some(mdot_loc) = method_dot_loc { | |
ide_report_autocomplete(context, &mdot_loc, &edotted_ty); | |
} | |
} | |
result | |
if let Some(mdot_loc) = method_dot_loc { | |
ide_report_autocomplete(context, &mdot_loc, &edotted_ty); | |
} | |
result |
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.
LGTM except for one tiny nit
Description
This PR fixes a certain problem with auto-completion on the
.
character. Previously, once a part of the access chain after the.
was parsed, auto-completion information for the.
character location was no longer generated. This is particularly problematic if someone expects auto-completion in the middle of the function code, for example:It is expected that auto-completion would work correctly after
val.
but previously it did not because this expression was actually parsed asval.SomeStruct
. This PR fixes this:Previously, auto-completion for the
.
location would also not work if what follows the.
is a function call (whether the function being called was resolved correctly or not). It now works correctly in both cases:Test plan
All new and (updated) all tests must pass