@@ -78,7 +78,7 @@ pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext<'_>) -> Optio
78
78
// data: T,
79
79
// }
80
80
//
81
- // impl<T: Clone> ${0 :_} for Ctx<T> {}
81
+ // impl<T: Clone> ${1 :_} for Ctx<T> {$0 }
82
82
// ```
83
83
pub ( crate ) fn generate_trait_impl ( acc : & mut Assists , ctx : & AssistContext < ' _ > ) -> Option < ( ) > {
84
84
let nominal = ctx. find_node_at_offset :: < ast:: Adt > ( ) ?;
@@ -102,6 +102,10 @@ pub(crate) fn generate_trait_impl(acc: &mut Assists, ctx: &AssistContext<'_>) ->
102
102
if let Some ( trait_) = impl_. trait_ ( ) {
103
103
edit. add_placeholder_snippet ( cap, trait_) ;
104
104
}
105
+
106
+ if let Some ( l_curly) = impl_. assoc_item_list ( ) . and_then ( |it| it. l_curly_token ( ) ) {
107
+ edit. add_tabstop_after_token ( cap, l_curly) ;
108
+ }
105
109
}
106
110
107
111
insert_impl ( impl_, & edit. make_mut ( nominal) ) ;
@@ -278,7 +282,7 @@ mod tests {
278
282
r#"
279
283
struct Foo {}
280
284
281
- impl ${0 :_} for Foo {}
285
+ impl ${1 :_} for Foo {$0 }
282
286
"# ,
283
287
) ;
284
288
}
@@ -293,7 +297,7 @@ mod tests {
293
297
r#"
294
298
struct Foo<T: Clone> {}
295
299
296
- impl<T: Clone> ${0 :_} for Foo<T> {}
300
+ impl<T: Clone> ${1 :_} for Foo<T> {$0 }
297
301
"# ,
298
302
) ;
299
303
}
@@ -308,7 +312,7 @@ mod tests {
308
312
r#"
309
313
struct Foo<'a, T: Foo<'a>> {}
310
314
311
- impl<'a, T: Foo<'a>> ${0 :_} for Foo<'a, T> {}
315
+ impl<'a, T: Foo<'a>> ${1 :_} for Foo<'a, T> {$0 }
312
316
"# ,
313
317
) ;
314
318
}
@@ -326,7 +330,7 @@ mod tests {
326
330
struct Foo<'a, T: Foo<'a>> {}
327
331
328
332
#[cfg(feature = "foo")]
329
- impl<'a, T: Foo<'a>> ${0 :_} for Foo<'a, T> {}
333
+ impl<'a, T: Foo<'a>> ${1 :_} for Foo<'a, T> {$0 }
330
334
"# ,
331
335
) ;
332
336
}
@@ -341,7 +345,7 @@ mod tests {
341
345
r#"
342
346
struct Defaulted<T = i32> {}
343
347
344
- impl<T> ${0 :_} for Defaulted<T> {}
348
+ impl<T> ${1 :_} for Defaulted<T> {$0 }
345
349
"# ,
346
350
) ;
347
351
}
@@ -356,7 +360,7 @@ mod tests {
356
360
r#"
357
361
struct Defaulted<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String, const S: usize> {}
358
362
359
- impl<'a, 'b: 'a, T: Debug + Clone + 'a + 'b, const S: usize> ${0 :_} for Defaulted<'a, 'b, T, S> {}
363
+ impl<'a, 'b: 'a, T: Debug + Clone + 'a + 'b, const S: usize> ${1 :_} for Defaulted<'a, 'b, T, S> {$0 }
360
364
"# ,
361
365
) ;
362
366
}
@@ -371,7 +375,7 @@ mod tests {
371
375
r#"
372
376
struct Defaulted<const N: i32 = 0> {}
373
377
374
- impl<const N: i32> ${0 :_} for Defaulted<N> {}
378
+ impl<const N: i32> ${1 :_} for Defaulted<N> {$0 }
375
379
"# ,
376
380
) ;
377
381
}
@@ -398,10 +402,10 @@ mod tests {
398
402
inner: T,
399
403
}
400
404
401
- impl<T> ${0 :_} for Struct<T>
405
+ impl<T> ${1 :_} for Struct<T>
402
406
where
403
407
T: Trait,
404
- {
408
+ {$0
405
409
}
406
410
"# ,
407
411
) ;
@@ -476,7 +480,7 @@ mod tests {
476
480
mod foo {
477
481
struct Bar {}
478
482
479
- impl ${0 :_} for Bar {}
483
+ impl ${1 :_} for Bar {$0 }
480
484
}
481
485
"# ,
482
486
) ;
0 commit comments