aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/handlers')
-rw-r--r--crates/ra_assists/src/handlers/add_function.rs1
-rw-r--r--crates/ra_assists/src/handlers/fill_match_arms.rs6
-rw-r--r--crates/ra_assists/src/handlers/introduce_variable.rs20
-rw-r--r--crates/ra_assists/src/handlers/raw_string.rs48
4 files changed, 40 insertions, 35 deletions
diff --git a/crates/ra_assists/src/handlers/add_function.rs b/crates/ra_assists/src/handlers/add_function.rs
index 19ce81d99..1cfbd75aa 100644
--- a/crates/ra_assists/src/handlers/add_function.rs
+++ b/crates/ra_assists/src/handlers/add_function.rs
@@ -986,6 +986,7 @@ fn main() {
986", 986",
987 r" 987 r"
988 988
989
989pub(crate) fn bar() { 990pub(crate) fn bar() {
990 ${0:todo!()} 991 ${0:todo!()}
991}", 992}",
diff --git a/crates/ra_assists/src/handlers/fill_match_arms.rs b/crates/ra_assists/src/handlers/fill_match_arms.rs
index 3c12c1daa..64270c86f 100644
--- a/crates/ra_assists/src/handlers/fill_match_arms.rs
+++ b/crates/ra_assists/src/handlers/fill_match_arms.rs
@@ -763,9 +763,9 @@ mod tests {
763fn foo(opt: Option<i32>) { 763fn foo(opt: Option<i32>) {
764 match opt<|> { 764 match opt<|> {
765 } 765 }
766}"#; 766}
767 let before = 767"#;
768 &format!("//- /main.rs crate:main deps:core\n{}{}", before, FamousDefs::FIXTURE); 768 let before = &format!("//- /main.rs crate:main deps:core{}{}", before, FamousDefs::FIXTURE);
769 769
770 check_assist( 770 check_assist(
771 fill_match_arms, 771 fill_match_arms,
diff --git a/crates/ra_assists/src/handlers/introduce_variable.rs b/crates/ra_assists/src/handlers/introduce_variable.rs
index 31d6539f7..88b62278f 100644
--- a/crates/ra_assists/src/handlers/introduce_variable.rs
+++ b/crates/ra_assists/src/handlers/introduce_variable.rs
@@ -226,27 +226,31 @@ fn foo() {
226 mark::check!(test_introduce_var_last_expr); 226 mark::check!(test_introduce_var_last_expr);
227 check_assist( 227 check_assist(
228 introduce_variable, 228 introduce_variable,
229 " 229 r#"
230fn foo() { 230fn foo() {
231 bar(<|>1 + 1<|>) 231 bar(<|>1 + 1<|>)
232}", 232}
233 " 233"#,
234 r#"
234fn foo() { 235fn foo() {
235 let $0var_name = 1 + 1; 236 let $0var_name = 1 + 1;
236 bar(var_name) 237 bar(var_name)
237}", 238}
239"#,
238 ); 240 );
239 check_assist( 241 check_assist(
240 introduce_variable, 242 introduce_variable,
241 " 243 r#"
242fn foo() { 244fn foo() {
243 <|>bar(1 + 1)<|> 245 <|>bar(1 + 1)<|>
244}", 246}
245 " 247"#,
248 r#"
246fn foo() { 249fn foo() {
247 let $0var_name = bar(1 + 1); 250 let $0var_name = bar(1 + 1);
248 var_name 251 var_name
249}", 252}
253"#,
250 ) 254 )
251 } 255 }
252 256
diff --git a/crates/ra_assists/src/handlers/raw_string.rs b/crates/ra_assists/src/handlers/raw_string.rs
index 16002d2ac..d22d0aa55 100644
--- a/crates/ra_assists/src/handlers/raw_string.rs
+++ b/crates/ra_assists/src/handlers/raw_string.rs
@@ -158,16 +158,16 @@ mod test {
158 check_assist( 158 check_assist(
159 make_raw_string, 159 make_raw_string,
160 r#" 160 r#"
161 fn f() { 161fn f() {
162 let s = <|>"random\nstring"; 162 let s = <|>"random\nstring";
163 } 163}
164 "#, 164"#,
165 r##" 165 r##"
166 fn f() { 166fn f() {
167 let s = r#"random 167 let s = r#"random
168string"#; 168string"#;
169 } 169}
170 "##, 170"##,
171 ) 171 )
172 } 172 }
173 173
@@ -193,16 +193,16 @@ string"#;
193 check_assist( 193 check_assist(
194 make_raw_string, 194 make_raw_string,
195 r###" 195 r###"
196 fn f() { 196fn f() {
197 let s = <|>"#random##\nstring"; 197 let s = <|>"#random##\nstring";
198 } 198}
199 "###, 199"###,
200 r####" 200 r####"
201 fn f() { 201fn f() {
202 let s = r#"#random## 202 let s = r#"#random##
203string"#; 203string"#;
204 } 204}
205 "####, 205"####,
206 ) 206 )
207 } 207 }
208 208
@@ -211,16 +211,16 @@ string"#;
211 check_assist( 211 check_assist(
212 make_raw_string, 212 make_raw_string,
213 r###" 213 r###"
214 fn f() { 214fn f() {
215 let s = <|>"#random\"##\nstring"; 215 let s = <|>"#random\"##\nstring";
216 } 216}
217 "###, 217"###,
218 r####" 218 r####"
219 fn f() { 219fn f() {
220 let s = r###"#random"## 220 let s = r###"#random"##
221string"###; 221string"###;
222 } 222}
223 "####, 223"####,
224 ) 224 )
225 } 225 }
226 226