diff options
Diffstat (limited to 'crates/ra_assists/src/assists')
-rw-r--r-- | crates/ra_assists/src/assists/add_custom_impl.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/ra_assists/src/assists/add_custom_impl.rs b/crates/ra_assists/src/assists/add_custom_impl.rs index 7e64cd902..037306fd6 100644 --- a/crates/ra_assists/src/assists/add_custom_impl.rs +++ b/crates/ra_assists/src/assists/add_custom_impl.rs | |||
@@ -12,6 +12,23 @@ use ra_syntax::{ | |||
12 | 12 | ||
13 | const DERIVE_TRAIT: &'static str = "derive"; | 13 | const DERIVE_TRAIT: &'static str = "derive"; |
14 | 14 | ||
15 | // Assist: add_custom_impl | ||
16 | // | ||
17 | // Adds impl block for derived trait. | ||
18 | // | ||
19 | // ``` | ||
20 | // #[derive(Deb<|>ug, Display)] | ||
21 | // struct S; | ||
22 | // ``` | ||
23 | // -> | ||
24 | // ``` | ||
25 | // #[derive(Display)] | ||
26 | // struct S; | ||
27 | // | ||
28 | // impl Debug for S { | ||
29 | // | ||
30 | // } | ||
31 | // ``` | ||
15 | pub(crate) fn add_custom_impl(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 32 | pub(crate) fn add_custom_impl(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
16 | let input = ctx.find_node_at_offset::<ast::AttrInput>()?; | 33 | let input = ctx.find_node_at_offset::<ast::AttrInput>()?; |
17 | let attr = input.syntax().parent().and_then(ast::Attr::cast)?; | 34 | let attr = input.syntax().parent().and_then(ast::Attr::cast)?; |