diff options
Diffstat (limited to 'crates/ra_assists/src/introduce_variable.rs')
-rw-r--r-- | crates/ra_assists/src/introduce_variable.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_assists/src/introduce_variable.rs b/crates/ra_assists/src/introduce_variable.rs index 954b97b05..f0e012105 100644 --- a/crates/ra_assists/src/introduce_variable.rs +++ b/crates/ra_assists/src/introduce_variable.rs | |||
@@ -8,7 +8,7 @@ use ra_syntax::{ | |||
8 | 8 | ||
9 | use crate::{AssistCtx, Assist}; | 9 | use crate::{AssistCtx, Assist}; |
10 | 10 | ||
11 | pub(crate) fn introduce_variable(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 11 | pub(crate) fn introduce_variable(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
12 | let node = ctx.covering_node(); | 12 | let node = ctx.covering_node(); |
13 | if !valid_covering_node(node) { | 13 | if !valid_covering_node(node) { |
14 | return None; | 14 | return None; |
@@ -19,7 +19,7 @@ pub(crate) fn introduce_variable(ctx: AssistCtx<impl HirDatabase>) -> Option<Ass | |||
19 | if indent.kind() != WHITESPACE { | 19 | if indent.kind() != WHITESPACE { |
20 | return None; | 20 | return None; |
21 | } | 21 | } |
22 | ctx.build("introduce variable", move |edit| { | 22 | ctx.add_action("introduce variable", move |edit| { |
23 | let mut buf = String::new(); | 23 | let mut buf = String::new(); |
24 | 24 | ||
25 | let cursor_offset = if wrap_in_block { | 25 | let cursor_offset = if wrap_in_block { |
@@ -68,7 +68,9 @@ pub(crate) fn introduce_variable(ctx: AssistCtx<impl HirDatabase>) -> Option<Ass | |||
68 | } | 68 | } |
69 | } | 69 | } |
70 | edit.set_cursor(anchor_stmt.range().start() + cursor_offset); | 70 | edit.set_cursor(anchor_stmt.range().start() + cursor_offset); |
71 | }) | 71 | }); |
72 | |||
73 | ctx.build() | ||
72 | } | 74 | } |
73 | 75 | ||
74 | fn valid_covering_node(node: &SyntaxNode) -> bool { | 76 | fn valid_covering_node(node: &SyntaxNode) -> bool { |