aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/remove_dbg.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/remove_dbg.rs')
-rw-r--r--crates/ra_assists/src/remove_dbg.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_assists/src/remove_dbg.rs b/crates/ra_assists/src/remove_dbg.rs
index e9d0a635b..db260c6ca 100644
--- a/crates/ra_assists/src/remove_dbg.rs
+++ b/crates/ra_assists/src/remove_dbg.rs
@@ -8,7 +8,7 @@ use ra_syntax::{
8}; 8};
9use crate::{AssistCtx, Assist}; 9use crate::{AssistCtx, Assist};
10 10
11pub(crate) fn remove_dbg(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 11pub(crate) fn remove_dbg(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
12 let macro_call = ctx.node_at_offset::<ast::MacroCall>()?; 12 let macro_call = ctx.node_at_offset::<ast::MacroCall>()?;
13 13
14 if !is_valid_macrocall(macro_call, "dbg")? { 14 if !is_valid_macrocall(macro_call, "dbg")? {
@@ -46,11 +46,13 @@ pub(crate) fn remove_dbg(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
46 macro_args.text().slice(start..end).to_string() 46 macro_args.text().slice(start..end).to_string()
47 }; 47 };
48 48
49 ctx.build("remove dbg!()", |edit| { 49 ctx.add_action("remove dbg!()", |edit| {
50 edit.target(macro_call.syntax().range()); 50 edit.target(macro_call.syntax().range());
51 edit.replace(macro_range, macro_content); 51 edit.replace(macro_range, macro_content);
52 edit.set_cursor(cursor_pos); 52 edit.set_cursor(cursor_pos);
53 }) 53 });
54
55 ctx.build()
54} 56}
55 57
56/// Verifies that the given macro_call actually matches the given name 58/// Verifies that the given macro_call actually matches the given name