Skip to content

Commit d135cab

Browse files
Merge pull request #20858 from A4-Tacks/inlay-suffix-underscore
Support underscore suffix parameter hide inlayHints
2 parents 0138b82 + 700748e commit d135cab

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

crates/ide/src/inlay_hints/param_name.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ fn should_hide_param_name_hint(
124124
// hide when:
125125
// - the parameter name is a suffix of the function's name
126126
// - the argument is a qualified constructing or call expression where the qualifier is an ADT
127-
// - exact argument<->parameter match(ignoring leading underscore) or parameter is a prefix/suffix
128-
// of argument with _ splitting it off
127+
// - exact argument<->parameter match(ignoring leading and trailing underscore) or
128+
// parameter is a prefix/suffix of argument with _ splitting it off
129129
// - param starts with `ra_fixture`
130130
// - param is a well known name in a unary function
131131

132-
let param_name = param_name.trim_start_matches('_');
132+
let param_name = param_name.trim_matches('_');
133133
if param_name.is_empty() {
134134
return true;
135135
}
@@ -540,6 +540,8 @@ fn enum_matches_param_name(completion_kind: CompletionKind) {}
540540
fn foo(param: u32) {}
541541
fn bar(param_eter: u32) {}
542542
fn baz(a_d_e: u32) {}
543+
fn far(loop_: u32) {}
544+
fn faz(r#loop: u32) {}
543545
544546
enum CompletionKind {
545547
Keyword,
@@ -590,6 +592,9 @@ fn main() {
590592
let param_eter2 = 0;
591593
bar(param_eter2);
592594
//^^^^^^^^^^^ param_eter
595+
let loop_level = 0;
596+
far(loop_level);
597+
faz(loop_level);
593598
594599
non_ident_pat((0, 0));
595600

0 commit comments

Comments
 (0)