-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat: don't show inlay hint when param name is a_b_c
and argument expr is a.b.c
#19039
base: master
Are you sure you want to change the base?
Conversation
How is that common? That seems to be pretty rare. |
I see it quite often with a pattern like |
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.
It does seem rather uncommon (unless your codebase has this specific naming pattern). Though I think itwould be fine to ignore _
and .
generally here when comparing similarity? That is we can just change the eq_ignore_ascii_case
with iterating the chars, ignoring .
and _
chars and then eq_ignore_ascii_case
the characters themselves. That would also work for your use case. (also adjust the comment explaining the heuristics)
@@ -154,6 +156,18 @@ fn is_param_name_suffix_of_fn_name( | |||
} | |||
} | |||
|
|||
/// `a_b_c_d` will match `a.b.c.d` | |||
fn is_param_name_same_as_field_expr(argument: &ast::Expr, param_name: &str) -> bool { |
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 should be part of is_argument_similar_to_param_name
.
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.
It can't as it is: this is iterating the full field expression, whereas is_argument_similar_to_param_name
uses only the last part of the field expr
I can modify it to take the whole expression in that case maybe ?
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.
Ah right, well at least move it to is_argument_expr_similar_to_param_name
I'd say then, though given my other comment that might not be necessary either way
For now this is an exact match, should it be a sub-match starting from the end (
b_c
would match*.b.c
) ?