diff options
Diffstat (limited to 'crates/ra_assists/src/add_impl.rs')
-rw-r--r-- | crates/ra_assists/src/add_impl.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_assists/src/add_impl.rs b/crates/ra_assists/src/add_impl.rs index 32fc074a6..b40b9cc0c 100644 --- a/crates/ra_assists/src/add_impl.rs +++ b/crates/ra_assists/src/add_impl.rs | |||
@@ -7,10 +7,10 @@ use ra_syntax::{ | |||
7 | 7 | ||
8 | use crate::{AssistCtx, Assist}; | 8 | use crate::{AssistCtx, Assist}; |
9 | 9 | ||
10 | pub(crate) fn add_impl(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 10 | pub(crate) fn add_impl(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
11 | let nominal = ctx.node_at_offset::<ast::NominalDef>()?; | 11 | let nominal = ctx.node_at_offset::<ast::NominalDef>()?; |
12 | let name = nominal.name()?; | 12 | let name = nominal.name()?; |
13 | ctx.build("add impl", |edit| { | 13 | ctx.add_action("add impl", |edit| { |
14 | edit.target(nominal.syntax().range()); | 14 | edit.target(nominal.syntax().range()); |
15 | let type_params = nominal.type_param_list(); | 15 | let type_params = nominal.type_param_list(); |
16 | let start_offset = nominal.syntax().range().end(); | 16 | let start_offset = nominal.syntax().range().end(); |
@@ -32,7 +32,9 @@ pub(crate) fn add_impl(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | |||
32 | edit.set_cursor(start_offset + TextUnit::of_str(&buf)); | 32 | edit.set_cursor(start_offset + TextUnit::of_str(&buf)); |
33 | buf.push_str("\n}"); | 33 | buf.push_str("\n}"); |
34 | edit.insert(start_offset, buf); | 34 | edit.insert(start_offset, buf); |
35 | }) | 35 | }); |
36 | |||
37 | ctx.build() | ||
36 | } | 38 | } |
37 | 39 | ||
38 | #[cfg(test)] | 40 | #[cfg(test)] |