mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 10:39:45 +00:00
fix: generate function by indet token
This commit is contained in:
parent
5248c8950a
commit
cfd41034e2
1 changed files with 29 additions and 1 deletions
|
|
@ -316,7 +316,7 @@ impl FunctionBuilder {
|
|||
let current_module = ctx.sema.scope(call.syntax())?.module();
|
||||
let visibility = calculate_necessary_visibility(current_module, target_module, ctx);
|
||||
|
||||
let fn_name = make::name(&name.text());
|
||||
let fn_name = make::name(name.ident_token()?.text());
|
||||
let mut necessary_generic_params = FxHashSet::default();
|
||||
necessary_generic_params.extend(receiver_ty.generic_params(ctx.db()));
|
||||
let params = fn_args(
|
||||
|
|
@ -3131,4 +3131,32 @@ fn main() {
|
|||
"#,
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_generate_method_by_keyword() {
|
||||
check_assist_not_applicable(
|
||||
generate_function,
|
||||
r#"
|
||||
fn main() {
|
||||
s.super$0();
|
||||
}
|
||||
"#,
|
||||
);
|
||||
check_assist_not_applicable(
|
||||
generate_function,
|
||||
r#"
|
||||
fn main() {
|
||||
s.Self$0();
|
||||
}
|
||||
"#,
|
||||
);
|
||||
check_assist_not_applicable(
|
||||
generate_function,
|
||||
r#"
|
||||
fn main() {
|
||||
s.self$0();
|
||||
}
|
||||
"#,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue