aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/introduce_variable.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-20 10:58:27 +0100
committerAleksey Kladov <[email protected]>2019-07-20 10:58:27 +0100
commitf3bdbec1b68fa0e20f0b7b6c6ef64e1507970b0d (patch)
treef2cb82f74d2d60d5351c3d7c4d8e7bce4d351cab /crates/ra_assists/src/introduce_variable.rs
parent6d5d82e412dea19ea48eecc6f7d5a4aa223a9599 (diff)
rename range -> text_range
Diffstat (limited to 'crates/ra_assists/src/introduce_variable.rs')
-rw-r--r--crates/ra_assists/src/introduce_variable.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_assists/src/introduce_variable.rs b/crates/ra_assists/src/introduce_variable.rs
index ce28132c9..df6c58989 100644
--- a/crates/ra_assists/src/introduce_variable.rs
+++ b/crates/ra_assists/src/introduce_variable.rs
@@ -48,7 +48,7 @@ pub(crate) fn introduce_variable(mut ctx: AssistCtx<impl HirDatabase>) -> Option
48 if !full_stmt.unwrap().has_semi() { 48 if !full_stmt.unwrap().has_semi() {
49 buf.push_str(";"); 49 buf.push_str(";");
50 } 50 }
51 edit.replace(expr.syntax().range(), buf); 51 edit.replace(expr.syntax().text_range(), buf);
52 } else { 52 } else {
53 buf.push_str(";"); 53 buf.push_str(";");
54 54
@@ -66,14 +66,14 @@ pub(crate) fn introduce_variable(mut ctx: AssistCtx<impl HirDatabase>) -> Option
66 buf.push_str(text); 66 buf.push_str(text);
67 } 67 }
68 68
69 edit.target(expr.syntax().range()); 69 edit.target(expr.syntax().text_range());
70 edit.replace(expr.syntax().range(), "var_name".to_string()); 70 edit.replace(expr.syntax().text_range(), "var_name".to_string());
71 edit.insert(anchor_stmt.range().start(), buf); 71 edit.insert(anchor_stmt.text_range().start(), buf);
72 if wrap_in_block { 72 if wrap_in_block {
73 edit.insert(anchor_stmt.range().end(), " }"); 73 edit.insert(anchor_stmt.text_range().end(), " }");
74 } 74 }
75 } 75 }
76 edit.set_cursor(anchor_stmt.range().start() + cursor_offset); 76 edit.set_cursor(anchor_stmt.text_range().start() + cursor_offset);
77 }); 77 });
78 78
79 ctx.build() 79 ctx.build()