@@ -78,7 +78,7 @@ pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext<'_>) -> Optio
7878// data: T,
7979// }
8080//
81- // impl<T: Clone> ${0 :_} for Ctx<T> {}
81+ // impl<T: Clone> ${1 :_} for Ctx<T> {$0 }
8282// ```
8383pub ( crate ) fn generate_trait_impl ( acc : & mut Assists , ctx : & AssistContext < ' _ > ) -> Option < ( ) > {
8484 let nominal = ctx. find_node_at_offset :: < ast:: Adt > ( ) ?;
@@ -102,6 +102,10 @@ pub(crate) fn generate_trait_impl(acc: &mut Assists, ctx: &AssistContext<'_>) ->
102102 if let Some ( trait_) = impl_. trait_ ( ) {
103103 edit. add_placeholder_snippet ( cap, trait_) ;
104104 }
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+ }
105109 }
106110
107111 insert_impl ( impl_, & edit. make_mut ( nominal) ) ;
@@ -278,7 +282,7 @@ mod tests {
278282 r#"
279283 struct Foo {}
280284
281- impl ${0 :_} for Foo {}
285+ impl ${1 :_} for Foo {$0 }
282286 "# ,
283287 ) ;
284288 }
@@ -293,7 +297,7 @@ mod tests {
293297 r#"
294298 struct Foo<T: Clone> {}
295299
296- impl<T: Clone> ${0 :_} for Foo<T> {}
300+ impl<T: Clone> ${1 :_} for Foo<T> {$0 }
297301 "# ,
298302 ) ;
299303 }
@@ -308,7 +312,7 @@ mod tests {
308312 r#"
309313 struct Foo<'a, T: Foo<'a>> {}
310314
311- impl<'a, T: Foo<'a>> ${0 :_} for Foo<'a, T> {}
315+ impl<'a, T: Foo<'a>> ${1 :_} for Foo<'a, T> {$0 }
312316 "# ,
313317 ) ;
314318 }
@@ -326,7 +330,7 @@ mod tests {
326330 struct Foo<'a, T: Foo<'a>> {}
327331
328332 #[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 }
330334 "# ,
331335 ) ;
332336 }
@@ -341,7 +345,7 @@ mod tests {
341345 r#"
342346 struct Defaulted<T = i32> {}
343347
344- impl<T> ${0 :_} for Defaulted<T> {}
348+ impl<T> ${1 :_} for Defaulted<T> {$0 }
345349 "# ,
346350 ) ;
347351 }
@@ -356,7 +360,7 @@ mod tests {
356360 r#"
357361 struct Defaulted<'a, 'b: 'a, T: Debug + Clone + 'a + 'b = String, const S: usize> {}
358362
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 }
360364 "# ,
361365 ) ;
362366 }
@@ -371,7 +375,7 @@ mod tests {
371375 r#"
372376 struct Defaulted<const N: i32 = 0> {}
373377
374- impl<const N: i32> ${0 :_} for Defaulted<N> {}
378+ impl<const N: i32> ${1 :_} for Defaulted<N> {$0 }
375379 "# ,
376380 ) ;
377381 }
@@ -398,10 +402,10 @@ mod tests {
398402 inner: T,
399403 }
400404
401- impl<T> ${0 :_} for Struct<T>
405+ impl<T> ${1 :_} for Struct<T>
402406 where
403407 T: Trait,
404- {
408+ {$0
405409 }
406410 "# ,
407411 ) ;
@@ -476,7 +480,7 @@ mod tests {
476480 mod foo {
477481 struct Bar {}
478482
479- impl ${0 :_} for Bar {}
483+ impl ${1 :_} for Bar {$0 }
480484 }
481485 "# ,
482486 ) ;
0 commit comments