From 72b9a4fbd3c12f3250b9157a1d44230e04ec8b22 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Wed, 6 Jan 2021 20:15:48 +0000 Subject: Change <|> to $0 - Rebase --- crates/ide/src/call_hierarchy.rs | 22 +-- crates/ide/src/diagnostics.rs | 44 +++--- crates/ide/src/diagnostics/field_shorthand.rs | 8 +- crates/ide/src/doc_links.rs | 16 +- crates/ide/src/expand_macro.rs | 12 +- crates/ide/src/extend_selection.rs | 108 ++++++------- crates/ide/src/fixture.rs | 12 +- crates/ide/src/fn_references.rs | 6 +- crates/ide/src/goto_definition.rs | 144 ++++++++--------- crates/ide/src/goto_implementation.rs | 16 +- crates/ide/src/goto_type_definition.rs | 12 +- crates/ide/src/hover.rs | 216 +++++++++++++------------- crates/ide/src/join_lines.rs | 124 +++++++-------- crates/ide/src/matching_brace.rs | 10 +- crates/ide/src/parent_module.rs | 8 +- crates/ide/src/references.rs | 74 ++++----- crates/ide/src/references/rename.rs | 92 +++++------ crates/ide/src/runnables.rs | 18 +-- crates/ide/src/syntax_tree.rs | 20 +-- crates/ide/src/typing.rs | 30 ++-- crates/ide/src/typing/on_enter.rs | 18 +-- 21 files changed, 505 insertions(+), 505 deletions(-) (limited to 'crates/ide') diff --git a/crates/ide/src/call_hierarchy.rs b/crates/ide/src/call_hierarchy.rs index 3c2d39f5d..4d8983cb2 100644 --- a/crates/ide/src/call_hierarchy.rs +++ b/crates/ide/src/call_hierarchy.rs @@ -178,7 +178,7 @@ mod tests { //- /lib.rs fn callee() {} fn caller() { - call<|>ee(); + call$0ee(); } "#, "callee Function FileId(0) 0..14 3..9", @@ -192,7 +192,7 @@ fn caller() { check_hierarchy( r#" //- /lib.rs -fn call<|>ee() {} +fn call$0ee() {} fn caller() { callee(); } @@ -210,7 +210,7 @@ fn caller() { //- /lib.rs fn callee() {} fn caller() { - call<|>ee(); + call$0ee(); callee(); } "#, @@ -227,7 +227,7 @@ fn caller() { //- /lib.rs fn callee() {} fn caller1() { - call<|>ee(); + call$0ee(); } fn caller2() { @@ -250,7 +250,7 @@ fn caller2() { //- /lib.rs cfg:test fn callee() {} fn caller1() { - call<|>ee(); + call$0ee(); } #[cfg(test)] @@ -281,7 +281,7 @@ mod foo; use foo::callee; fn caller() { - call<|>ee(); + call$0ee(); } //- /foo/mod.rs @@ -299,7 +299,7 @@ pub fn callee() {} r#" //- /lib.rs fn callee() {} -fn call<|>er() { +fn call$0er() { callee(); callee(); } @@ -318,7 +318,7 @@ fn call<|>er() { mod foo; use foo::callee; -fn call<|>er() { +fn call$0er() { callee(); } @@ -337,7 +337,7 @@ pub fn callee() {} r#" //- /lib.rs fn caller1() { - call<|>er2(); + call$0er2(); } fn caller2() { @@ -365,7 +365,7 @@ fn a() { fn b() {} fn main() { - a<|>() + a$0() } "#, "a Function FileId(0) 0..18 3..4", @@ -376,7 +376,7 @@ fn main() { check_hierarchy( r#" fn a() { - b<|>() + b$0() } fn b() {} diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index 79d126ff2..6931a6190 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs @@ -315,7 +315,7 @@ fn div(x: i32, y: i32) -> Result { if y == 0 { return Err(()); } - x / y<|> + x / y$0 } //- /core/lib.rs crate:core pub mod result { @@ -346,7 +346,7 @@ fn div(x: T) -> Result { if x == 0 { return Err(7); } - <|>x + $0x } //- /core/lib.rs crate:core pub mod result { @@ -379,7 +379,7 @@ fn div(x: i32, y: i32) -> MyResult { if y == 0 { return Err(()); } - x <|>/ y + x $0/ y } //- /core/lib.rs crate:core pub mod result { @@ -444,7 +444,7 @@ pub mod result { struct TestStruct { one: i32, two: i64 } fn test_fn() { - let s = TestStruct {<|>}; + let s = TestStruct {$0}; } "#, r#" @@ -464,7 +464,7 @@ fn test_fn() { struct TestStruct { one: i32 } impl TestStruct { - fn test_fn() { let s = Self {<|>}; } + fn test_fn() { let s = Self {$0}; } } "#, r#" @@ -487,7 +487,7 @@ enum Expr { impl Expr { fn new_bin(lhs: Box, rhs: Box) -> Expr { - Expr::Bin {<|> } + Expr::Bin {$0 } } } "#, @@ -512,7 +512,7 @@ impl Expr { struct TestStruct { one: i32, two: i64 } fn test_fn() { - let s = TestStruct{ two: 2<|> }; + let s = TestStruct{ two: 2$0 }; } "#, r" @@ -608,7 +608,7 @@ fn here() {} macro_rules! id { ($($tt:tt)*) => { $($tt)*}; } fn main() { - let _x = id![Foo { a: <|>42 }]; + let _x = id![Foo { a: $042 }]; } pub struct Foo { pub a: i32, pub b: i32 } @@ -663,7 +663,7 @@ mod a { check_fix( r" mod b {} - use {<|>b}; + use {$0b}; ", r" mod b {} @@ -673,7 +673,7 @@ mod a { check_fix( r" mod b {} - use {b<|>}; + use {b$0}; ", r" mod b {} @@ -683,7 +683,7 @@ mod a { check_fix( r" mod a { mod c {} } - use a::{c<|>}; + use a::{c$0}; ", r" mod a { mod c {} } @@ -693,7 +693,7 @@ mod a { check_fix( r" mod a {} - use a::{self<|>}; + use a::{self$0}; ", r" mod a {} @@ -703,7 +703,7 @@ mod a { check_fix( r" mod a { mod c {} mod d { mod e {} } } - use a::{c, d::{e<|>}}; + use a::{c, d::{e$0}}; ", r" mod a { mod c {} mod d { mod e {} } } @@ -717,7 +717,7 @@ mod a { check_fix( r" fn main() { - Foo { bar: 3, baz<|>: false}; + Foo { bar: 3, baz$0: false}; } struct Foo { bar: i32 @@ -743,7 +743,7 @@ struct Foo { mod foo; fn main() { - foo::Foo { bar: 3, <|>baz: false}; + foo::Foo { bar: 3, $0baz: false}; } //- /foo.rs struct Foo { @@ -777,7 +777,7 @@ struct Foo { fn test_rename_incorrect_case() { check_fix( r#" -pub struct test_struct<|> { one: i32 } +pub struct test_struct$0 { one: i32 } pub fn some_fn(val: test_struct) -> test_struct { test_struct { one: val.one + 1 } @@ -794,7 +794,7 @@ pub fn some_fn(val: TestStruct) -> TestStruct { check_fix( r#" -pub fn some_fn(NonSnakeCase<|>: u8) -> u8 { +pub fn some_fn(NonSnakeCase$0: u8) -> u8 { NonSnakeCase } "#, @@ -807,7 +807,7 @@ pub fn some_fn(non_snake_case: u8) -> u8 { check_fix( r#" -pub fn SomeFn<|>(val: u8) -> u8 { +pub fn SomeFn$0(val: u8) -> u8 { if val != 0 { SomeFn(val - 1) } else { val } } "#, @@ -821,7 +821,7 @@ pub fn some_fn(val: u8) -> u8 { check_fix( r#" fn some_fn() { - let whatAWeird_Formatting<|> = 10; + let whatAWeird_Formatting$0 = 10; another_func(whatAWeird_Formatting); } "#, @@ -839,7 +839,7 @@ fn some_fn() { check_no_diagnostics( r#" fn foo() { - const ANOTHER_ITEM<|>: &str = "some_item"; + const ANOTHER_ITEM$0: &str = "some_item"; } "#, ); @@ -852,7 +852,7 @@ fn foo() { pub struct TestStruct; impl TestStruct { - pub fn SomeFn<|>() -> TestStruct { + pub fn SomeFn$0() -> TestStruct { TestStruct } } @@ -871,7 +871,7 @@ impl TestStruct { #[test] fn test_single_incorrect_case_diagnostic_in_function_name_issue_6970() { - let input = r#"fn FOO<|>() {}"#; + let input = r#"fn FOO$0() {}"#; let expected = r#"fn foo() {}"#; let (analysis, file_position) = fixture::position(input); diff --git a/crates/ide/src/diagnostics/field_shorthand.rs b/crates/ide/src/diagnostics/field_shorthand.rs index f41bcd619..16c6ea827 100644 --- a/crates/ide/src/diagnostics/field_shorthand.rs +++ b/crates/ide/src/diagnostics/field_shorthand.rs @@ -120,7 +120,7 @@ fn main() { A { 0: 0 } } struct A { a: &'static str } fn main() { let a = "haha"; - A { a<|>: a } + A { a$0: a } } "#, r#" @@ -138,7 +138,7 @@ struct A { a: &'static str, b: &'static str } fn main() { let a = "haha"; let b = "bb"; - A { a<|>: a, b } + A { a$0: a, b } } "#, r#" @@ -171,7 +171,7 @@ fn f(a: A) { let A { 0: 0 } = a; } r#" struct A { a: &'static str } fn f(a: A) { - let A { a<|>: a } = a; + let A { a$0: a } = a; } "#, r#" @@ -186,7 +186,7 @@ fn f(a: A) { r#" struct A { a: &'static str, b: &'static str } fn f(a: A) { - let A { a<|>: a, b } = a; + let A { a$0: a, b } = a; } "#, r#" diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 367fac05e..1ff818de2 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -464,7 +464,7 @@ mod tests { fn test_doc_url_struct() { check( r#" -pub struct Fo<|>o; +pub struct Fo$0o; "#, expect![[r#"https://docs.rs/test/*/test/struct.Foo.html"#]], ); @@ -474,7 +474,7 @@ pub struct Fo<|>o; fn test_doc_url_fn() { check( r#" -pub fn fo<|>o() {} +pub fn fo$0o() {} "#, expect![[r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"##]], ); @@ -487,7 +487,7 @@ pub fn fo<|>o() {} pub struct Foo; impl Foo { - pub fn met<|>hod() {} + pub fn met$0hod() {} } "#, @@ -500,7 +500,7 @@ impl Foo { check( r#" pub trait Bar { - fn met<|>hod() {} + fn met$0hod() {} } "#, @@ -513,7 +513,7 @@ pub trait Bar { check( r#" pub trait Foo { - fn met<|>hod(); + fn met$0hod(); } "#, @@ -526,7 +526,7 @@ pub trait Foo { check( r#" pub struct Foo { - pub fie<|>ld: () + pub fie$0ld: () } "#, @@ -539,7 +539,7 @@ pub struct Foo { check( r#" pub mod foo { - pub mod ba<|>r {} + pub mod ba$0r {} } "#, expect![[r#"https://docs.rs/test/*/test/foo/bar/index.html"#]], @@ -564,7 +564,7 @@ pub mod wrapper { } fn foo() { - let bar: wrapper::It<|>em; + let bar: wrapper::It$0em; } "#, expect![[r#"https://docs.rs/test/*/test/wrapper/module/struct.Item.html"#]], diff --git a/crates/ide/src/expand_macro.rs b/crates/ide/src/expand_macro.rs index 8d75e0f05..ffb3a6f7d 100644 --- a/crates/ide/src/expand_macro.rs +++ b/crates/ide/src/expand_macro.rs @@ -144,7 +144,7 @@ macro_rules! foo { macro_rules! baz { () => { foo!(); } } -f<|>oo!(); +f$0oo!(); "#, expect![[r#" foo @@ -165,7 +165,7 @@ macro_rules! foo { } } } -f<|>oo!(); +f$0oo!(); "#, expect![[r#" foo @@ -192,7 +192,7 @@ macro_rules! match_ast { } fn main() { - mat<|>ch_ast! { + mat$0ch_ast! { match container { ast::TraitDef(it) => {}, ast::ImplDef(it) => {}, @@ -226,7 +226,7 @@ macro_rules! match_ast { fn main() { let p = f(|it| { - let res = mat<|>ch_ast! { match c {}}; + let res = mat$0ch_ast! { match c {}}; Some(res) })?; } @@ -250,7 +250,7 @@ macro_rules! foo { } fn main() { - let res = fo<|>o!(); + let res = fo$0o!(); } "#, expect![[r#" @@ -272,7 +272,7 @@ macro_rules! foo { } fn main() { - let res = fo<|>o!(); + let res = fo$0o!(); } "#, expect![[r#" diff --git a/crates/ide/src/extend_selection.rs b/crates/ide/src/extend_selection.rs index 6f3022dfd..56418c960 100644 --- a/crates/ide/src/extend_selection.rs +++ b/crates/ide/src/extend_selection.rs @@ -334,29 +334,29 @@ mod tests { #[test] fn test_extend_selection_arith() { - do_check(r#"fn foo() { <|>1 + 1 }"#, &["1", "1 + 1", "{ 1 + 1 }"]); + do_check(r#"fn foo() { $01 + 1 }"#, &["1", "1 + 1", "{ 1 + 1 }"]); } #[test] fn test_extend_selection_list() { - do_check(r#"fn foo(<|>x: i32) {}"#, &["x", "x: i32"]); - do_check(r#"fn foo(<|>x: i32, y: i32) {}"#, &["x", "x: i32", "x: i32, "]); - do_check(r#"fn foo(<|>x: i32,y: i32) {}"#, &["x", "x: i32", "x: i32,", "(x: i32,y: i32)"]); - do_check(r#"fn foo(x: i32, <|>y: i32) {}"#, &["y", "y: i32", ", y: i32"]); - do_check(r#"fn foo(x: i32, <|>y: i32, ) {}"#, &["y", "y: i32", "y: i32, "]); - do_check(r#"fn foo(x: i32,<|>y: i32) {}"#, &["y", "y: i32", ",y: i32"]); + do_check(r#"fn foo($0x: i32) {}"#, &["x", "x: i32"]); + do_check(r#"fn foo($0x: i32, y: i32) {}"#, &["x", "x: i32", "x: i32, "]); + do_check(r#"fn foo($0x: i32,y: i32) {}"#, &["x", "x: i32", "x: i32,", "(x: i32,y: i32)"]); + do_check(r#"fn foo(x: i32, $0y: i32) {}"#, &["y", "y: i32", ", y: i32"]); + do_check(r#"fn foo(x: i32, $0y: i32, ) {}"#, &["y", "y: i32", "y: i32, "]); + do_check(r#"fn foo(x: i32,$0y: i32) {}"#, &["y", "y: i32", ",y: i32"]); - do_check(r#"const FOO: [usize; 2] = [ 22<|> , 33];"#, &["22", "22 , "]); - do_check(r#"const FOO: [usize; 2] = [ 22 , 33<|>];"#, &["33", ", 33"]); - do_check(r#"const FOO: [usize; 2] = [ 22 , 33<|> ,];"#, &["33", "33 ,", "[ 22 , 33 ,]"]); + do_check(r#"const FOO: [usize; 2] = [ 22$0 , 33];"#, &["22", "22 , "]); + do_check(r#"const FOO: [usize; 2] = [ 22 , 33$0];"#, &["33", ", 33"]); + do_check(r#"const FOO: [usize; 2] = [ 22 , 33$0 ,];"#, &["33", "33 ,", "[ 22 , 33 ,]"]); - do_check(r#"fn main() { (1, 2<|>) }"#, &["2", ", 2", "(1, 2)"]); + do_check(r#"fn main() { (1, 2$0) }"#, &["2", ", 2", "(1, 2)"]); do_check( r#" const FOO: [usize; 2] = [ 22, - <|>33, + $033, ]"#, &["33", "33,"], ); @@ -365,7 +365,7 @@ const FOO: [usize; 2] = [ r#" const FOO: [usize; 2] = [ 22 - , 33<|>, + , 33$0, ]"#, &["33", "33,"], ); @@ -376,7 +376,7 @@ const FOO: [usize; 2] = [ do_check( r#" impl S { -<|> fn foo() { +$0 fn foo() { } }"#, @@ -393,7 +393,7 @@ struct A; /// bla /// bla struct B { - <|> + $0 } "#, &["\n \n", "{\n \n}", "/// bla\n/// bla\nstruct B {\n \n}"], @@ -407,7 +407,7 @@ struct B { fn bar(){} // fn foo() { -// 1 + <|>1 +// 1 + $01 // } // fn foo(){} @@ -419,7 +419,7 @@ fn bar(){} r#" // #[derive(Debug, Clone, Copy, PartialEq, Eq)] // pub enum Direction { -// <|> Next, +// $0 Next, // Prev // } "#, @@ -433,27 +433,27 @@ fn bar(){} r#" /* foo -_bar1<|>*/ +_bar1$0*/ "#, &["_bar1", "/*\nfoo\n_bar1*/"], ); - do_check(r#"//!<|>foo_2 bar"#, &["foo_2", "//!foo_2 bar"]); + do_check(r#"//!$0foo_2 bar"#, &["foo_2", "//!foo_2 bar"]); - do_check(r#"/<|>/foo bar"#, &["//foo bar"]); + do_check(r#"/$0/foo bar"#, &["//foo bar"]); } #[test] fn test_extend_selection_prefer_idents() { do_check( r#" -fn main() { foo<|>+bar;} +fn main() { foo$0+bar;} "#, &["foo", "foo+bar"], ); do_check( r#" -fn main() { foo+<|>bar;} +fn main() { foo+$0bar;} "#, &["bar", "foo+bar"], ); @@ -461,18 +461,18 @@ fn main() { foo+<|>bar;} #[test] fn test_extend_selection_prefer_lifetimes() { - do_check(r#"fn foo<<|>'a>() {}"#, &["'a", "<'a>"]); - do_check(r#"fn foo<'a<|>>() {}"#, &["'a", "<'a>"]); + do_check(r#"fn foo<$0'a>() {}"#, &["'a", "<'a>"]); + do_check(r#"fn foo<'a$0>() {}"#, &["'a", "<'a>"]); } #[test] fn test_extend_selection_select_first_word() { - do_check(r#"// foo bar b<|>az quxx"#, &["baz", "// foo bar baz quxx"]); + do_check(r#"// foo bar b$0az quxx"#, &["baz", "// foo bar baz quxx"]); do_check( r#" impl S { fn foo() { -// hel<|>lo world +// hel$0lo world } } "#, @@ -486,7 +486,7 @@ fn foo() { r#" fn bar(){} -" fn f<|>oo() {" +" fn f$0oo() {" "#, &["foo", "\" fn foo() {\""], ); @@ -499,7 +499,7 @@ fn bar(){} fn foo() where R: req::Request + 'static, - R::Params: DeserializeOwned<|> + panic::UnwindSafe + 'static, + R::Params: DeserializeOwned$0 + panic::UnwindSafe + 'static, R::Result: Serialize + 'static, "#, &[ @@ -510,26 +510,26 @@ fn foo() "R::Params: DeserializeOwned + panic::UnwindSafe + 'static,", ], ); - do_check(r#"fn foo() where T: <|>Copy"#, &["Copy"]); - do_check(r#"fn foo() where T: <|>Copy + Display"#, &["Copy", "Copy + "]); - do_check(r#"fn foo() where T: <|>Copy +Display"#, &["Copy", "Copy +"]); - do_check(r#"fn foo() where T: <|>Copy+Display"#, &["Copy", "Copy+"]); - do_check(r#"fn foo() where T: Copy + <|>Display"#, &["Display", "+ Display"]); - do_check(r#"fn foo() where T: Copy + <|>Display + Sync"#, &["Display", "Display + "]); - do_check(r#"fn foo() where T: Copy +<|>Display"#, &["Display", "+Display"]); + do_check(r#"fn foo() where T: $0Copy"#, &["Copy"]); + do_check(r#"fn foo() where T: $0Copy + Display"#, &["Copy", "Copy + "]); + do_check(r#"fn foo() where T: $0Copy +Display"#, &["Copy", "Copy +"]); + do_check(r#"fn foo() where T: $0Copy+Display"#, &["Copy", "Copy+"]); + do_check(r#"fn foo() where T: Copy + $0Display"#, &["Display", "+ Display"]); + do_check(r#"fn foo() where T: Copy + $0Display + Sync"#, &["Display", "Display + "]); + do_check(r#"fn foo() where T: Copy +$0Display"#, &["Display", "+Display"]); } #[test] fn test_extend_trait_bounds_list_inline() { - do_check(r#"fn fooCopy>() {}"#, &["Copy"]); - do_check(r#"fn fooCopy + Display>() {}"#, &["Copy", "Copy + "]); - do_check(r#"fn fooCopy +Display>() {}"#, &["Copy", "Copy +"]); - do_check(r#"fn fooCopy+Display>() {}"#, &["Copy", "Copy+"]); - do_check(r#"fn fooDisplay>() {}"#, &["Display", "+ Display"]); - do_check(r#"fn fooDisplay + Sync>() {}"#, &["Display", "Display + "]); - do_check(r#"fn fooDisplay>() {}"#, &["Display", "+Display"]); + do_check(r#"fn foo() {}"#, &["Copy"]); + do_check(r#"fn foo() {}"#, &["Copy", "Copy + "]); + do_check(r#"fn foo() {}"#, &["Copy", "Copy +"]); + do_check(r#"fn foo() {}"#, &["Copy", "Copy+"]); + do_check(r#"fn foo() {}"#, &["Display", "+ Display"]); + do_check(r#"fn foo() {}"#, &["Display", "Display + "]); + do_check(r#"fn foo() {}"#, &["Display", "+Display"]); do_check( - r#"fn foo + Display, U: Copy>() {}"#, + r#"fn foo() {}"#, &[ "Copy", "Copy + ", @@ -544,19 +544,19 @@ fn foo() #[test] fn test_extend_selection_on_tuple_in_type() { do_check( - r#"fn main() { let _: (krate, <|>_crate_def_map, module_id) = (); }"#, + r#"fn main() { let _: (krate, $0_crate_def_map, module_id) = (); }"#, &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], ); // white space variations do_check( - r#"fn main() { let _: (krate,<|>_crate_def_map,module_id) = (); }"#, + r#"fn main() { let _: (krate,$0_crate_def_map,module_id) = (); }"#, &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], ); do_check( r#" fn main() { let _: ( krate, - _crate<|>_def_map, + _crate$0_def_map, module_id ) = (); }"#, &[ @@ -570,19 +570,19 @@ fn main() { let _: ( #[test] fn test_extend_selection_on_tuple_in_rvalue() { do_check( - r#"fn main() { let var = (krate, _crate_def_map<|>, module_id); }"#, + r#"fn main() { let var = (krate, _crate_def_map$0, module_id); }"#, &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], ); // white space variations do_check( - r#"fn main() { let var = (krate,_crate<|>_def_map,module_id); }"#, + r#"fn main() { let var = (krate,_crate$0_def_map,module_id); }"#, &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], ); do_check( r#" fn main() { let var = ( krate, - _crate_def_map<|>, + _crate_def_map$0, module_id ); }"#, &[ @@ -596,19 +596,19 @@ fn main() { let var = ( #[test] fn test_extend_selection_on_tuple_pat() { do_check( - r#"fn main() { let (krate, _crate_def_map<|>, module_id) = var; }"#, + r#"fn main() { let (krate, _crate_def_map$0, module_id) = var; }"#, &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], ); // white space variations do_check( - r#"fn main() { let (krate,_crate<|>_def_map,module_id) = var; }"#, + r#"fn main() { let (krate,_crate$0_def_map,module_id) = var; }"#, &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], ); do_check( r#" fn main() { let ( krate, - _crate_def_map<|>, + _crate_def_map$0, module_id ) = var; }"#, &[ @@ -623,7 +623,7 @@ fn main() { let ( fn extend_selection_inside_macros() { do_check( r#"macro_rules! foo { ($item:item) => {$item} } - foo!{fn hello(na<|>me:usize){}}"#, + foo!{fn hello(na$0me:usize){}}"#, &[ "name", "name:usize", @@ -640,7 +640,7 @@ fn main() { let ( do_check( r#" macro_rules! foo2 { ($item:item) => {$item} } macro_rules! foo { ($item:item) => {foo2!($item);} } - foo!{fn hello(na<|>me:usize){}}"#, + foo!{fn hello(na$0me:usize){}}"#, &[ "name", "name:usize", diff --git a/crates/ide/src/fixture.rs b/crates/ide/src/fixture.rs index eb57f9224..cc8218885 100644 --- a/crates/ide/src/fixture.rs +++ b/crates/ide/src/fixture.rs @@ -20,12 +20,12 @@ pub(crate) fn files(ra_fixture: &str) -> (Analysis, Vec) { (host.analysis(), change_fixture.files) } -/// Creates analysis from a multi-file fixture, returns positions marked with <|>. +/// Creates analysis from a multi-file fixture, returns positions marked with $0. pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) { let mut host = AnalysisHost::default(); let change_fixture = ChangeFixture::parse(ra_fixture); host.db.apply_change(change_fixture.change); - let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); + let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); let offset = match range_or_offset { RangeOrOffset::Range(_) => panic!(), RangeOrOffset::Offset(it) => it, @@ -33,12 +33,12 @@ pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) { (host.analysis(), FilePosition { file_id, offset }) } -/// Creates analysis for a single file, returns range marked with a pair of <|>. +/// Creates analysis for a single file, returns range marked with a pair of $0. pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) { let mut host = AnalysisHost::default(); let change_fixture = ChangeFixture::parse(ra_fixture); host.db.apply_change(change_fixture.change); - let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); + let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); let range = match range_or_offset { RangeOrOffset::Range(it) => it, RangeOrOffset::Offset(_) => panic!(), @@ -46,12 +46,12 @@ pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) { (host.analysis(), FileRange { file_id, range }) } -/// Creates analysis from a multi-file fixture, returns positions marked with <|>. +/// Creates analysis from a multi-file fixture, returns positions marked with $0. pub(crate) fn annotations(ra_fixture: &str) -> (Analysis, FilePosition, Vec<(FileRange, String)>) { let mut host = AnalysisHost::default(); let change_fixture = ChangeFixture::parse(ra_fixture); host.db.apply_change(change_fixture.change); - let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); + let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); let offset = match range_or_offset { RangeOrOffset::Range(_) => panic!(), RangeOrOffset::Offset(it) => it, diff --git a/crates/ide/src/fn_references.rs b/crates/ide/src/fn_references.rs index 5cbbe306e..f6e5a522b 100644 --- a/crates/ide/src/fn_references.rs +++ b/crates/ide/src/fn_references.rs @@ -34,7 +34,7 @@ mod tests { fn test_find_all_methods() { let (analysis, pos) = fixture::position( r#" - fn private_fn() {<|>} + fn private_fn() {$0} pub fn pub_fn() {} @@ -51,7 +51,7 @@ mod tests { let (analysis, pos) = fixture::position( r#" trait Foo { - fn bar() {<|>} + fn bar() {$0} fn baz() {} } "#, @@ -67,7 +67,7 @@ mod tests { r#" //- /lib.rs #[test] - fn foo() {<|>} + fn foo() {$0} pub fn pub_fn() {} diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 912144f8b..95b4cb9e3 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs @@ -166,7 +166,7 @@ mod tests { check( r#" //- /main.rs crate:main deps:std - extern crate std<|>; + extern crate std$0; //- /std/lib.rs crate:std // empty //^ file @@ -179,7 +179,7 @@ mod tests { check( r#" //- /main.rs crate:main deps:std - extern crate std as abc<|>; + extern crate std as abc$0; //- /std/lib.rs crate:std // empty //^ file @@ -193,7 +193,7 @@ mod tests { r#" struct Foo; //^^^ -enum E { X(Foo<|>) } +enum E { X(Foo$0) } "#, ); } @@ -204,7 +204,7 @@ enum E { X(Foo<|>) } r#" struct Foo; //^^^ -enum E { X(<|>Foo) } +enum E { X($0Foo) } "#, ); } @@ -217,7 +217,7 @@ enum E { X(<|>Foo) } use a::Foo; mod a; mod b; -enum E { X(Foo<|>) } +enum E { X(Foo$0) } //- /a.rs struct Foo; @@ -233,7 +233,7 @@ struct Foo; check( r#" //- /lib.rs -mod <|>foo; +mod $0foo; //- /foo.rs // empty @@ -244,7 +244,7 @@ mod <|>foo; check( r#" //- /lib.rs -mod <|>foo; +mod $0foo; //- /foo/mod.rs // empty @@ -260,7 +260,7 @@ mod <|>foo; macro_rules! foo { () => { () } } //^^^ fn bar() { - <|>foo!(); + $0foo!(); } "#, ); @@ -273,7 +273,7 @@ fn bar() { //- /lib.rs use foo::foo; fn bar() { - <|>foo!(); + $0foo!(); } //- /foo/lib.rs @@ -289,7 +289,7 @@ macro_rules! foo { () => { () } } check( r#" //- /lib.rs -use foo::foo<|>; +use foo::foo$0; //- /foo/lib.rs #[macro_export] @@ -312,7 +312,7 @@ define_fn!(foo); //^^^ fn bar() { - <|>foo(); + $0foo(); } "#, ); @@ -331,7 +331,7 @@ macro_rules! define_fn { //^^^^^^^^^^^^^ fn bar() { - <|>foo(); + $0foo(); } "#, ); @@ -347,7 +347,7 @@ macro_rules! foo {() => {0}} fn bar() { match (0,1) { - (<|>foo!(), _) => {} + ($0foo!(), _) => {} } } "#, @@ -363,7 +363,7 @@ macro_rules! foo {() => {0}} //^^^ fn bar() { match 0 { - <|>foo!() => {} + $0foo!() => {} } } "#, @@ -375,7 +375,7 @@ fn bar() { check( r#" //- /lib.rs crate:main deps:foo -use foo as bar<|>; +use foo as bar$0; //- /foo/lib.rs crate:foo // empty @@ -389,7 +389,7 @@ use foo as bar<|>; check( r#" //- /lib.rs crate:main deps:foo -use foo::foo as bar<|>; +use foo::foo as bar$0; //- /foo/lib.rs crate:foo #[macro_export] @@ -410,7 +410,7 @@ impl Foo { } fn bar(foo: &Foo) { - foo.frobnicate<|>(); + foo.frobnicate$0(); } "#, ); @@ -425,7 +425,7 @@ struct Foo { } //^^^^ fn bar(foo: &Foo) { - foo.spam<|>; + foo.spam$0; } "#, ); @@ -442,7 +442,7 @@ struct Foo { fn bar() -> Foo { Foo { - spam<|>: 0, + spam$0: 0, } } "#, @@ -459,7 +459,7 @@ struct Foo { } //^^^^ fn bar(foo: Foo) -> Foo { - let Foo { spam<|>: _, } = foo + let Foo { spam$0: _, } = foo } "#, ); @@ -474,7 +474,7 @@ struct Foo { spam: u32 } //^^^^ fn bar() -> Foo { - Foo { spam<|>: m!() } + Foo { spam$0: m!() } } ", ); @@ -489,7 +489,7 @@ struct Foo(u32); fn bar() { let foo = Foo(0); - foo.<|>0; + foo.$00; } "#, ); @@ -505,7 +505,7 @@ impl Foo { } //^^^^^^^^^^ fn bar(foo: &Foo) { - Foo::frobnicate<|>(); + Foo::frobnicate$0(); } "#, ); @@ -520,7 +520,7 @@ trait Foo { } //^^^^^^^^^^ fn bar() { - Foo::frobnicate<|>(); + Foo::frobnicate$0(); } "#, ); @@ -537,7 +537,7 @@ trait Trait { impl Trait for Foo {} fn bar() { - Foo::frobnicate<|>(); + Foo::frobnicate$0(); } "#, ); @@ -551,7 +551,7 @@ struct Foo; impl Foo { //^^^ pub fn new() -> Self { - Self<|> {} + Self$0 {} } } "#, @@ -561,7 +561,7 @@ impl Foo { struct Foo; impl Foo { //^^^ - pub fn new() -> Self<|> { + pub fn new() -> Self$0 { Self {} } } @@ -573,7 +573,7 @@ impl Foo { enum Foo { A } impl Foo { //^^^ - pub fn new() -> Self<|> { + pub fn new() -> Self$0 { Foo::A } } @@ -585,7 +585,7 @@ impl Foo { enum Foo { A } impl Foo { //^^^ - pub fn thing(a: &Self<|>) { + pub fn thing(a: &Self$0) { } } "#, @@ -603,7 +603,7 @@ trait Make { impl Make for Foo { //^^^ fn new() -> Self { - Self<|> {} + Self$0 {} } } "#, @@ -617,7 +617,7 @@ trait Make { } impl Make for Foo { //^^^ - fn new() -> Self<|> { + fn new() -> Self$0 { Self {} } } @@ -629,7 +629,7 @@ impl Make for Foo { fn goto_def_when_used_on_definition_name_itself() { check( r#" -struct Foo<|> { value: u32 } +struct Foo$0 { value: u32 } //^^^ "#, ); @@ -637,21 +637,21 @@ struct Foo<|> { value: u32 } check( r#" struct Foo { - field<|>: string, + field$0: string, } //^^^^^ "#, ); check( r#" -fn foo_test<|>() { } +fn foo_test$0() { } //^^^^^^^^ "#, ); check( r#" -enum Foo<|> { Variant } +enum Foo$0 { Variant } //^^^ "#, ); @@ -660,7 +660,7 @@ enum Foo<|> { Variant } r#" enum Foo { Variant1, - Variant2<|>, + Variant2$0, //^^^^^^^^ Variant3, } @@ -669,35 +669,35 @@ enum Foo { check( r#" -static INNER<|>: &str = ""; +static INNER$0: &str = ""; //^^^^^ "#, ); check( r#" -const INNER<|>: &str = ""; +const INNER$0: &str = ""; //^^^^^ "#, ); check( r#" -type Thing<|> = Option<()>; +type Thing$0 = Option<()>; //^^^^^ "#, ); check( r#" -trait Foo<|> { } +trait Foo$0 { } //^^^ "#, ); check( r#" -mod bar<|> { } +mod bar$0 { } //^^^ "#, ); @@ -714,7 +714,7 @@ fn foo() {} //^^^ id! { fn bar() { - fo<|>o(); + fo$0o(); } } mod confuse_index { fn foo(); } @@ -743,7 +743,7 @@ pub mod __export { fn foo() -> i8 {} //^^^ fn test() { - format!("{}", fo<|>o()) + format!("{}", fo$0o()) } "#, ); @@ -761,7 +761,7 @@ macro_rules! include {} //^^^^^^^^^^^^^^^^^^^ fn f() { - foo<|>(); + foo$0(); } mod confuse_index { @@ -778,7 +778,7 @@ fn foo() {} fn goto_for_type_param() { check( r#" -struct Foo { t: <|>T } +struct Foo { t: $0T } //^ "#, ); @@ -796,7 +796,7 @@ fn foo() { let x = 1; //^ id!({ - let y = <|>x; + let y = $0x; let z = y; }); } @@ -814,7 +814,7 @@ fn foo() { id!({ let y = x; //^ - let z = <|>y; + let z = $0y; }); } "#, @@ -829,7 +829,7 @@ fn main() { fn foo() { let x = 92; //^ - <|>x; + $0x; } } "#, @@ -843,7 +843,7 @@ fn main() { fn bar() { macro_rules! foo { () => { () } } //^^^ - <|>foo!(); + $0foo!(); } "#, ); @@ -857,7 +857,7 @@ struct Foo { x: i32 } fn main() { let x = 92; //^ - Foo { x<|> }; + Foo { x$0 }; } "#, ) @@ -872,7 +872,7 @@ enum Foo { } //^ fn baz(foo: Foo) { match foo { - Foo::Bar { x<|> } => x + Foo::Bar { x$0 } => x }; } "#, @@ -887,7 +887,7 @@ enum Foo { Bar } //^^^ impl Foo { fn baz(self) { - match self { Self::Bar<|> => {} } + match self { Self::Bar$0 => {} } } } "#, @@ -902,7 +902,7 @@ enum Foo { Bar { val: i32 } } //^^^ impl Foo { fn baz(self) -> i32 { - match self { Self::Bar<|> { val } => {} } + match self { Self::Bar$0 { val } => {} } } } "#, @@ -916,7 +916,7 @@ impl Foo { enum Foo { Bar } //^^^ impl Foo { - fn baz(self) { Self::Bar<|>; } + fn baz(self) { Self::Bar$0; } } "#, ); @@ -929,7 +929,7 @@ impl Foo { enum Foo { Bar { val: i32 } } //^^^ impl Foo { - fn baz(self) { Self::Bar<|> {val: 4}; } + fn baz(self) { Self::Bar$0 {val: 4}; } } "#, ); @@ -939,7 +939,7 @@ impl Foo { fn goto_def_for_type_alias_generic_parameter() { check( r#" -type Alias = T<|>; +type Alias = T$0; //^ "#, ) @@ -950,7 +950,7 @@ type Alias = T<|>; check( r#" //- /lib.rs -foo::module<|>::mac!(); +foo::module$0::mac!(); //- /foo/lib.rs pub mod module { @@ -972,7 +972,7 @@ trait Iterator { //^^^^ } -fn f() -> impl Iterator = u8> {} +fn f() -> impl Iterator {} "#, ); } @@ -987,7 +987,7 @@ trait Iterator { type B; } -fn f() -> impl Iterator = u8, B = ()> {} +fn f() -> impl Iterator {} "#, ); check( @@ -998,7 +998,7 @@ trait Iterator { //^ } -fn f() -> impl Iterator = ()> {} +fn f() -> impl Iterator {} "#, ); } @@ -1012,7 +1012,7 @@ trait Iterator { //^^^^ } -fn g() -> <() as Iterator = ()>>::Item {} +fn g() -> <() as Iterator>::Item {} "#, ); } @@ -1027,7 +1027,7 @@ trait Iterator { type B; } -fn g() -> <() as Iterator = (), B = u8>>::B {} +fn g() -> <() as Iterator>::B {} "#, ); check( @@ -1038,7 +1038,7 @@ trait Iterator { //^ } -fn g() -> <() as Iterator = u8>>::A {} +fn g() -> <() as Iterator>::A {} "#, ); } @@ -1052,7 +1052,7 @@ struct Foo {} impl Foo { fn bar(self: &Foo) { //^^^^ - let foo = sel<|>f; + let foo = sel$0f; } }"#, ) @@ -1065,7 +1065,7 @@ impl Foo { struct Foo {} impl Foo { - fn bar(&self<|>) { + fn bar(&self$0) { //^^^^ } }"#, @@ -1076,7 +1076,7 @@ impl Foo { fn goto_lifetime_param_on_decl() { check( r#" -fn foo<'foobar<|>>(_: &'foobar ()) { +fn foo<'foobar$0>(_: &'foobar ()) { //^^^^^^^ }"#, ) @@ -1086,7 +1086,7 @@ fn foo<'foobar<|>>(_: &'foobar ()) { fn goto_lifetime_param_decl() { check( r#" -fn foo<'foobar>(_: &'foobar<|> ()) { +fn foo<'foobar>(_: &'foobar$0 ()) { //^^^^^^^ }"#, ) @@ -1097,7 +1097,7 @@ fn foo<'foobar>(_: &'foobar<|> ()) { check( r#" fn foo<'foobar>(_: &'foobar ()) { - fn foo<'foobar>(_: &'foobar<|> ()) {} + fn foo<'foobar>(_: &'foobar$0 ()) {} //^^^^^^^ }"#, ) @@ -1108,13 +1108,13 @@ fn foo<'foobar>(_: &'foobar ()) { fn goto_lifetime_hrtb() { check( r#"trait Foo {} -fn foo() where for<'a> T: Foo<&'a<|> (u8, u16)>, {} +fn foo() where for<'a> T: Foo<&'a$0 (u8, u16)>, {} //^^ "#, ); check( r#"trait Foo {} -fn foo() where for<'a<|>> T: Foo<&'a (u8, u16)>, {} +fn foo() where for<'a$0> T: Foo<&'a (u8, u16)>, {} //^^ "#, ); @@ -1125,7 +1125,7 @@ fn foo() where for<'a<|>> T: Foo<&'a (u8, u16)>, {} fn goto_lifetime_hrtb_for_type() { check( r#"trait Foo {} -fn foo() where T: for<'a> Foo<&'a<|> (u8, u16)>, {} +fn foo() where T: for<'a> Foo<&'a$0 (u8, u16)>, {} //^^ "#, ); @@ -1139,7 +1139,7 @@ fn foo<'foo>(_: &'foo ()) { 'foo: { //^^^^ 'bar: loop { - break 'foo<|>; + break 'foo$0; } } }"#, diff --git a/crates/ide/src/goto_implementation.rs b/crates/ide/src/goto_implementation.rs index da9378a97..761a98b2c 100644 --- a/crates/ide/src/goto_implementation.rs +++ b/crates/ide/src/goto_implementation.rs @@ -107,7 +107,7 @@ mod tests { fn goto_implementation_works() { check( r#" -struct Foo<|>; +struct Foo$0; impl Foo {} //^^^ "#, @@ -118,7 +118,7 @@ impl Foo {} fn goto_implementation_works_multiple_blocks() { check( r#" -struct Foo<|>; +struct Foo$0; impl Foo {} //^^^ impl Foo {} @@ -131,7 +131,7 @@ impl Foo {} fn goto_implementation_works_multiple_mods() { check( r#" -struct Foo<|>; +struct Foo$0; mod a { impl super::Foo {} //^^^^^^^^^^ @@ -149,7 +149,7 @@ mod b { check( r#" //- /lib.rs -struct Foo<|>; +struct Foo$0; mod a; mod b; //- /a.rs @@ -166,7 +166,7 @@ impl crate::Foo {} fn goto_implementation_for_trait() { check( r#" -trait T<|> {} +trait T$0 {} struct Foo; impl T for Foo {} //^^^ @@ -179,7 +179,7 @@ impl T for Foo {} check( r#" //- /lib.rs -trait T<|> {}; +trait T$0 {}; struct Foo; mod a; mod b; @@ -199,7 +199,7 @@ impl crate::T for crate::Foo {} r#" //- /lib.rs trait T {} -struct Foo<|>; +struct Foo$0; impl Foo {} //^^^ impl T for Foo {} @@ -216,7 +216,7 @@ impl T for &Foo {} r#" #[derive(Copy)] //^^^^^^^^^^^^^^^ -struct Foo<|>; +struct Foo$0; mod marker { trait Copy {} diff --git a/crates/ide/src/goto_type_definition.rs b/crates/ide/src/goto_type_definition.rs index 7e84e06be..369a59820 100644 --- a/crates/ide/src/goto_type_definition.rs +++ b/crates/ide/src/goto_type_definition.rs @@ -76,7 +76,7 @@ mod tests { struct Foo; //^^^ fn foo() { - let f: Foo; f<|> + let f: Foo; f$0 } "#, ); @@ -89,7 +89,7 @@ fn foo() { struct Foo; //^^^ fn foo() { - let f: &Foo; f<|> + let f: &Foo; f$0 } "#, ); @@ -103,7 +103,7 @@ macro_rules! id { ($($tt:tt)*) => { $($tt)* } } struct Foo {} //^^^ id! { - fn bar() { let f<|> = Foo {}; } + fn bar() { let f$0 = Foo {}; } } "#, ); @@ -115,7 +115,7 @@ id! { r#" struct Foo; //^^^ -fn foo(<|>f: Foo) {} +fn foo($0f: Foo) {} "#, ); } @@ -129,7 +129,7 @@ struct Foo; struct Bar(Foo); fn foo() { let bar = Bar(Foo); - bar.<|>0; + bar.$00; } "#, ); @@ -142,7 +142,7 @@ fn foo() { struct Foo; //^^^ impl Foo { - fn f(&self<|>) {} + fn f(&self$0) {} } "#, ) diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index a12a2475e..8cb4a51d8 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -457,7 +457,7 @@ mod tests { pub fn foo() -> u32 { 1 } fn main() { - let foo_test = foo()<|>; + let foo_test = foo()$0; } "#, expect![[r#" @@ -476,7 +476,7 @@ fn main() { pub fn foo() -> u32 { 1 } fn main() { - let foo_test = foo()<|>; + let foo_test = foo()$0; } "#, expect![[r#" @@ -506,7 +506,7 @@ fn main() { Option::Some(*memo + value) }; let number = 5u32; - let mut iter<|> = scan(OtherStruct { i: num }, closure, number); + let mut iter$0 = scan(OtherStruct { i: num }, closure, number); } "#, expect![[r#" @@ -526,7 +526,7 @@ fn main() { r#" pub fn foo() -> u32 { 1 } -fn main() { let foo_test = fo<|>o(); } +fn main() { let foo_test = fo$0o(); } "#, expect![[r#" *foo* @@ -558,7 +558,7 @@ mod a; mod b; mod c; -fn main() { let foo_test = fo<|>o(); } +fn main() { let foo_test = fo$0o(); } "#, expect![[r#" *foo* @@ -575,7 +575,7 @@ fn main() { let foo_test = fo<|>o(); } r#" pub fn foo<'a, T: AsRef>(b: &'a T) -> &'a str { } -fn main() { let foo_test = fo<|>o(); } +fn main() { let foo_test = fo$0o(); } "#, expect![[r#" *foo* @@ -595,7 +595,7 @@ fn main() { let foo_test = fo<|>o(); } fn hover_shows_fn_signature_on_fn_name() { check( r#" -pub fn foo<|>(a: u32, b: u32) -> u32 {} +pub fn foo$0(a: u32, b: u32) -> u32 {} fn main() { } "#, @@ -623,7 +623,7 @@ fn main() { } /// # /// foo(Path::new("hello, world!")) /// ``` -pub fn foo<|>(_: &Path) {} +pub fn foo$0(_: &Path) {} fn main() { } "#, @@ -656,7 +656,7 @@ fn main() { } check( r##" #[doc = r#"Raw string doc attr"#] -pub fn foo<|>(_: &Path) {} +pub fn foo$0(_: &Path) {} fn main() { } "##, @@ -686,7 +686,7 @@ fn main() { } struct Foo { field_a: u32 } fn main() { - let foo = Foo { field_a<|>: 0, }; + let foo = Foo { field_a$0: 0, }; } "#, expect![[r#" @@ -705,7 +705,7 @@ fn main() { // Hovering over the field in the definition check( r#" -struct Foo { field_a<|>: u32 } +struct Foo { field_a$0: u32 } fn main() { let foo = Foo { field_a: 0 }; @@ -728,7 +728,7 @@ fn main() { #[test] fn hover_const_static() { check( - r#"const foo<|>: u32 = 123;"#, + r#"const foo$0: u32 = 123;"#, expect![[r#" *foo* @@ -742,7 +742,7 @@ fn main() { "#]], ); check( - r#"static foo<|>: u32 = 456;"#, + r#"static foo$0: u32 = 456;"#, expect![[r#" *foo* @@ -764,7 +764,7 @@ fn main() { struct Test { k: K, t: T } fn main() { - let zz<|> = Test { t: 23u8, k: 33 }; + let zz$0 = Test { t: 23u8, k: 33 }; }"#, expect![[r#" *zz* @@ -783,7 +783,7 @@ fn main() { enum Option { Some(T) } use Option::Some; -fn main() { So<|>me(12); } +fn main() { So$0me(12); } "#, expect![[r#" *Some* @@ -803,7 +803,7 @@ fn main() { So<|>me(12); } enum Option { Some(T) } use Option::Some; -fn main() { let b<|>ar = Some(12); } +fn main() { let b$0ar = Some(12); } "#, expect![[r#" *bar* @@ -821,7 +821,7 @@ fn main() { let b<|>ar = Some(12); } r#" enum Option { /// The None variant - Non<|>e + Non$0e } "#, expect![[r#" @@ -848,7 +848,7 @@ enum Option { Some(T) } fn main() { - let s = Option::Som<|>e(12); + let s = Option::Som$0e(12); } "#, expect![[r#" @@ -872,7 +872,7 @@ fn main() { #[test] fn hover_for_local_variable() { check( - r#"fn func(foo: i32) { fo<|>o; }"#, + r#"fn func(foo: i32) { fo$0o; }"#, expect![[r#" *foo* @@ -886,7 +886,7 @@ fn main() { #[test] fn hover_for_local_variable_pat() { check( - r#"fn func(fo<|>o: i32) {}"#, + r#"fn func(fo$0o: i32) {}"#, expect![[r#" *foo* @@ -900,7 +900,7 @@ fn main() { #[test] fn hover_local_var_edge() { check( - r#"fn func(foo: i32) { if true { <|>foo; }; }"#, + r#"fn func(foo: i32) { if true { $0foo; }; }"#, expect![[r#" *foo* @@ -914,7 +914,7 @@ fn main() { #[test] fn hover_for_param_edge() { check( - r#"fn func(<|>foo: i32) {}"#, + r#"fn func($0foo: i32) {}"#, expect![[r#" *foo* @@ -934,7 +934,7 @@ fn main() { trait DerefMut { type Target: ?Sized; } - fn f(_x<|>: impl Deref + DerefMut) {}"#, + fn f(_x$0: impl Deref + DerefMut) {}"#, expect![[r#" *_x* @@ -955,7 +955,7 @@ impl Thing { fn new() -> Thing { Thing { x: 0 } } } -fn main() { let foo_<|>test = Thing::new(); } +fn main() { let foo_$0test = Thing::new(); } "#, expect![[r#" *foo_test* @@ -979,7 +979,7 @@ mod wrapper { } } -fn main() { let foo_test = wrapper::Thing::new<|>(); } +fn main() { let foo_test = wrapper::Thing::new$0(); } "#, expect![[r#" *new* @@ -1006,7 +1006,7 @@ impl X { fn main() { match 1 { - X::C<|> => {}, + X::C$0 => {}, 2 => {}, _ => {} }; @@ -1032,7 +1032,7 @@ fn main() { r#" struct Thing { x: u32 } impl Thing { - fn new() -> Self { Self<|> { x: 0 } } + fn new() -> Self { Self$0 { x: 0 } } } "#, expect![[r#" @@ -1051,7 +1051,7 @@ impl Thing { r#" struct Thing { x: u32 } impl Thing { - fn new() -> Self<|> { Self { x: 0 } } + fn new() -> Self$0 { Self { x: 0 } } } "#, expect![[r#" @@ -1070,7 +1070,7 @@ impl Thing { r#" enum Thing { A } impl Thing { - pub fn new() -> Self<|> { Thing::A } + pub fn new() -> Self$0 { Thing::A } } "#, expect![[r#" @@ -1089,7 +1089,7 @@ impl Thing { r#" enum Thing { A } impl Thing { - pub fn thing(a: Self<|>) {} + pub fn thing(a: Self$0) {} } "#, expect![[r#" @@ -1114,7 +1114,7 @@ fn x() {} fn y() { let x = 0i32; - x<|>; + x$0; } "#, expect![[r#" @@ -1133,7 +1133,7 @@ fn y() { r#" macro_rules! foo { () => {} } -fn f() { fo<|>o!(); } +fn f() { fo$0o!(); } "#, expect![[r#" *foo* @@ -1152,7 +1152,7 @@ fn f() { fo<|>o!(); } #[test] fn test_hover_tuple_field() { check( - r#"struct TS(String, i32<|>);"#, + r#"struct TS(String, i32$0);"#, expect![[r#" *i32* @@ -1170,7 +1170,7 @@ fn f() { fo<|>o!(); } macro_rules! id { ($($tt:tt)*) => { $($tt)* } } fn foo() {} id! { - fn bar() { fo<|>o(); } + fn bar() { fo$0o(); } } "#, expect![[r#" @@ -1192,7 +1192,7 @@ id! { check( r#" macro_rules! id { ($($tt:tt)*) => { $($tt)* } } -fn foo(bar:u32) { let a = id!(ba<|>r); } +fn foo(bar:u32) { let a = id!(ba$0r); } "#, expect![[r#" *bar* @@ -1210,7 +1210,7 @@ fn foo(bar:u32) { let a = id!(ba<|>r); } r#" macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } -fn foo(bar:u32) { let a = id!(ba<|>r); } +fn foo(bar:u32) { let a = id!(ba$0r); } "#, expect![[r#" *bar* @@ -1229,7 +1229,7 @@ fn foo(bar:u32) { let a = id!(ba<|>r); } macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } fn bar() -> u32 { 0 } -fn foo() { let a = id!([0u32, bar(<|>)] ); } +fn foo() { let a = id!([0u32, bar($0)] ); } "#, expect![[r#" *bar()* @@ -1247,7 +1247,7 @@ fn foo() { let a = id!([0u32, bar(<|>)] ); } macro_rules! arr { ($($tt:tt)*) => { [$($tt)*)] } } fn foo() { let mastered_for_itunes = ""; - let _ = arr!("Tr<|>acks", &mastered_for_itunes); + let _ = arr!("Tr$0acks", &mastered_for_itunes); } "#, expect![[r#" @@ -1268,7 +1268,7 @@ macro_rules! assert {} fn bar() -> bool { true } fn foo() { - assert!(ba<|>r()); + assert!(ba$0r()); } "#, expect![[r#" @@ -1293,7 +1293,7 @@ fn foo() { macro_rules! format {} fn foo() { - format!("hel<|>lo {}", 0); + format!("hel$0lo {}", 0); } "#, ); @@ -1306,7 +1306,7 @@ fn foo() { /// <- `\u{3000}` here fn foo() { } -fn bar() { fo<|>o(); } +fn bar() { fo$0o(); } ", expect![[r#" *foo* @@ -1329,7 +1329,7 @@ fn bar() { fo<|>o(); } #[test] fn test_hover_function_show_qualifiers() { check( - r#"async fn foo<|>() {}"#, + r#"async fn foo$0() {}"#, expect![[r#" *foo* @@ -1343,7 +1343,7 @@ fn bar() { fo<|>o(); } "#]], ); check( - r#"pub const unsafe fn foo<|>() {}"#, + r#"pub const unsafe fn foo$0() {}"#, expect![[r#" *foo* @@ -1357,7 +1357,7 @@ fn bar() { fo<|>o(); } "#]], ); check( - r#"pub(crate) async unsafe extern "C" fn foo<|>() {}"#, + r#"pub(crate) async unsafe extern "C" fn foo$0() {}"#, expect![[r#" *foo* @@ -1375,7 +1375,7 @@ fn bar() { fo<|>o(); } #[test] fn test_hover_trait_show_qualifiers() { check_actions( - r"unsafe trait foo<|>() {}", + r"unsafe trait foo$0() {}", expect![[r#" [ Implementation( @@ -1396,7 +1396,7 @@ fn bar() { fo<|>o(); } check( r#" //- /main.rs crate:main deps:std -extern crate st<|>d; +extern crate st$0d; //- /std/lib.rs crate:std //! Standard library for this test //! @@ -1414,7 +1414,7 @@ extern crate st<|>d; check( r#" //- /main.rs crate:main deps:std -extern crate std as ab<|>c; +extern crate std as ab$0c; //- /std/lib.rs crate:std //! Standard library for this test //! @@ -1435,7 +1435,7 @@ extern crate std as ab<|>c; fn test_hover_mod_with_same_name_as_function() { check( r#" -use self::m<|>y::Bar; +use self::m$0y::Bar; mod my { pub struct Bar; } fn my() {} @@ -1461,7 +1461,7 @@ fn my() {} /// bar docs struct Bar; -fn foo() { let bar = Ba<|>r; } +fn foo() { let bar = Ba$0r; } "#, expect![[r#" *Bar* @@ -1488,7 +1488,7 @@ fn foo() { let bar = Ba<|>r; } #[doc = "bar docs"] struct Bar; -fn foo() { let bar = Ba<|>r; } +fn foo() { let bar = Ba$0r; } "#, expect![[r#" *Bar* @@ -1517,7 +1517,7 @@ fn foo() { let bar = Ba<|>r; } #[doc = "bar docs 2"] struct Bar; -fn foo() { let bar = Ba<|>r; } +fn foo() { let bar = Ba$0r; } "#, expect![[r#" *Bar* @@ -1545,7 +1545,7 @@ fn foo() { let bar = Ba<|>r; } r#" pub struct Foo; /// [Foo](struct.Foo.html) -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1571,7 +1571,7 @@ pub struct B<|>ar r#" pub struct Foo; /// [struct Foo](struct.Foo.html) -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1599,7 +1599,7 @@ pub struct B<|>ar pub struct Foo; pub struct Bar { /// [Foo](struct.Foo.html) - fie<|>ld: () + fie$0ld: () } "#, expect![[r#" @@ -1628,7 +1628,7 @@ pub mod foo { pub struct Foo; } /// [Foo](foo::Foo) -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1658,7 +1658,7 @@ pub mod foo { pub struct Foo; } /// [Foo](foo::Foo) -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1684,7 +1684,7 @@ pub struct B<|>ar r#" pub struct Foo; /// [Foo] -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1710,7 +1710,7 @@ pub struct B<|>ar r#" pub struct Foo; /// [`Foo`] -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1737,7 +1737,7 @@ pub struct B<|>ar pub struct Foo; fn Foo() {} /// [Foo()] -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1763,7 +1763,7 @@ pub struct B<|>ar r#" pub struct Foo; /// [`struct Foo`] -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1789,7 +1789,7 @@ pub struct B<|>ar r#" pub struct Foo; /// [`struct@Foo`] -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1817,7 +1817,7 @@ pub struct Foo; /// [my Foo][foo] /// /// [foo]: Foo -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1843,7 +1843,7 @@ pub struct B<|>ar r#" pub struct Foo; /// [external](https://www.google.com) -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1870,7 +1870,7 @@ pub struct B<|>ar r#" pub struct Foo; /// [baz](Baz) -pub struct B<|>ar +pub struct B$0ar "#, expect![[r#" *Bar* @@ -1896,7 +1896,7 @@ pub struct B<|>ar r#" enum E { /// [E] - V<|> { field: i32 } + V$0 { field: i32 } } "#, expect![[r#" @@ -1923,7 +1923,7 @@ enum E { r#" struct S { /// [`S`] - field<|>: i32 + field$0: i32 } "#, expect![[r#" @@ -1969,7 +1969,7 @@ struct S { /// /// [`Result`]: ../../std/result/enum.Result.html /// [^example]: https://www.example.com/ -pub fn fo<|>o() {} +pub fn fo$0o() {} "#, expect![[r#" *foo* @@ -2026,7 +2026,7 @@ macro_rules! bar { bar!(); -fn foo() { let bar = Bar; bar.fo<|>o(); } +fn foo() { let bar = Bar; bar.fo$0o(); } "#, expect![[r#" *foo* @@ -2064,7 +2064,7 @@ macro_rules! bar { bar!(); -fn foo() { let bar = Bar; bar.fo<|>o(); } +fn foo() { let bar = Bar; bar.fo$0o(); } "#, expect![[r#" *foo* @@ -2087,7 +2087,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } #[test] fn test_hover_trait_has_impl_action() { check_actions( - r#"trait foo<|>() {}"#, + r#"trait foo$0() {}"#, expect![[r#" [ Implementation( @@ -2106,7 +2106,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } #[test] fn test_hover_struct_has_impl_action() { check_actions( - r"struct foo<|>() {}", + r"struct foo$0() {}", expect![[r#" [ Implementation( @@ -2125,7 +2125,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } #[test] fn test_hover_union_has_impl_action() { check_actions( - r#"union foo<|>() {}"#, + r#"union foo$0() {}"#, expect![[r#" [ Implementation( @@ -2144,7 +2144,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } #[test] fn test_hover_enum_has_impl_action() { check_actions( - r"enum foo<|>() { A, B }", + r"enum foo$0() { A, B }", expect![[r#" [ Implementation( @@ -2163,7 +2163,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } #[test] fn test_hover_self_has_impl_action() { check_actions( - r#"struct foo where Self<|>:;"#, + r#"struct foo where Self$0:;"#, expect![[r#" [ Implementation( @@ -2184,7 +2184,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } check_actions( r#" #[test] -fn foo_<|>test() {} +fn foo_$0test() {} "#, expect![[r#" [ @@ -2219,7 +2219,7 @@ fn foo_<|>test() {} fn test_hover_test_mod_has_action() { check_actions( r#" -mod tests<|> { +mod tests$0 { #[test] fn foo_test() {} } @@ -2254,7 +2254,7 @@ mod tests<|> { r#" struct S{ f1: u32 } -fn main() { let s<|>t = S{ f1:0 }; } +fn main() { let s$0t = S{ f1:0 }; } "#, expect![[r#" [ @@ -2287,7 +2287,7 @@ fn main() { let s<|>t = S{ f1:0 }; } struct Arg(u32); struct S{ f1: T } -fn main() { let s<|>t = S{ f1:Arg(0) }; } +fn main() { let s$0t = S{ f1:Arg(0) }; } "#, expect![[r#" [ @@ -2333,7 +2333,7 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; } struct Arg(u32); struct S{ f1: T } -fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; } +fn main() { let s$0t = S{ f1: S{ f1: Arg(0) } }; } "#, expect![[r#" [ @@ -2382,7 +2382,7 @@ mod M { pub struct C(u32); } -fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } +fn main() { let s$0t = (A(1), B(2), M::C(3) ); } "#, expect![[r#" [ @@ -2441,7 +2441,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } trait Foo {} fn foo() -> impl Foo {} -fn main() { let s<|>t = foo(); } +fn main() { let s$0t = foo(); } "#, expect![[r#" [ @@ -2475,7 +2475,7 @@ trait Foo {} struct S; fn foo() -> impl Foo {} -fn main() { let s<|>t = foo(); } +fn main() { let s$0t = foo(); } "#, expect![[r#" [ @@ -2522,7 +2522,7 @@ trait Foo {} trait Bar {} fn foo() -> impl Foo + Bar {} -fn main() { let s<|>t = foo(); } +fn main() { let s$0t = foo(); } "#, expect![[r#" [ @@ -2572,7 +2572,7 @@ struct S2 {} fn foo() -> impl Foo + Bar {} -fn main() { let s<|>t = foo(); } +fn main() { let s$0t = foo(); } "#, expect![[r#" [ @@ -2642,7 +2642,7 @@ fn main() { let s<|>t = foo(); } check_actions( r#" trait Foo {} -fn foo(ar<|>g: &impl Foo) {} +fn foo(ar$0g: &impl Foo) {} "#, expect![[r#" [ @@ -2676,7 +2676,7 @@ trait Foo {} trait Bar {} struct S{} -fn foo(ar<|>g: &impl Foo + Bar) {} +fn foo(ar$0g: &impl Foo + Bar) {} "#, expect![[r#" [ @@ -2734,7 +2734,7 @@ fn foo(ar<|>g: &impl Foo + Bar) {} r#" struct S; fn foo() { - let fo<|>o = async { S }; + let fo$0o = async { S }; } #[prelude_import] use future::*; @@ -2786,7 +2786,7 @@ mod future { r#" trait Foo {} struct S {} -fn foo(ar<|>g: &impl Foo) {} +fn foo(ar$0g: &impl Foo) {} "#, expect![[r#" [ @@ -2836,7 +2836,7 @@ impl Foo for S {} struct B{} fn foo() -> B {} -fn main() { let s<|>t = foo(); } +fn main() { let s$0t = foo(); } "#, expect![[r#" [ @@ -2880,7 +2880,7 @@ fn main() { let s<|>t = foo(); } check_actions( r#" trait Foo {} -fn foo(ar<|>g: &dyn Foo) {} +fn foo(ar$0g: &dyn Foo) {} "#, expect![[r#" [ @@ -2912,7 +2912,7 @@ fn foo(ar<|>g: &dyn Foo) {} r#" trait Foo {} struct S {} -fn foo(ar<|>g: &dyn Foo) {} +fn foo(ar$0g: &dyn Foo) {} "#, expect![[r#" [ @@ -2960,7 +2960,7 @@ trait DynTrait {} struct B {} struct S {} -fn foo(a<|>rg: &impl ImplTrait>>>) {} +fn foo(a$0rg: &impl ImplTrait>>>) {} "#, expect![[r#" [ @@ -3041,7 +3041,7 @@ impl Foo for S { type Item = Bar; } fn test() -> impl Foo { S {} } -fn main() { let s<|>t = test().get(); } +fn main() { let s$0t = test().get(); } "#, expect![[r#" [ @@ -3074,7 +3074,7 @@ fn main() { let s<|>t = test().get(); } struct Bar; struct Foo; -impl Foo> {} +impl Foo {} "#, expect![[r#" [ @@ -3106,7 +3106,7 @@ impl Foo> {} r#" trait Foo {} -fn foo(t: T<|>){} +fn foo(t: T$0){} "#, expect![[r#" [ @@ -3146,7 +3146,7 @@ pub mod wrapper { } //- /main.rs crate:main deps:name-with-dashes -fn main() { let foo_test = name_with_dashes::wrapper::Thing::new<|>(); } +fn main() { let foo_test = name_with_dashes::wrapper::Thing::new$0(); } "#, expect![[r#" *new* @@ -3172,7 +3172,7 @@ struct S { fn main() { let s = S { f: 0 }; - let S { f<|> } = &s; + let S { f$0 } = &s; } "#, expect![[r#" @@ -3191,7 +3191,7 @@ fn main() { r#" struct Foo {} impl Foo { - fn bar(&sel<|>f) {} + fn bar(&sel$0f) {} } "#, expect![[r#" @@ -3210,7 +3210,7 @@ impl Foo { struct Arc(T); struct Foo {} impl Foo { - fn bar(sel<|>f: Arc) {} + fn bar(sel$0f: Arc) {} } "#, expect![[r#" @@ -3227,7 +3227,7 @@ impl Foo { check( r#" /// Be quick; -mod Foo<|> { +mod Foo$0 { //! time is mana /// This comment belongs to the function @@ -3258,7 +3258,7 @@ mod Foo<|> { check( r#" #[doc = "Be quick;"] -mod Foo<|> { +mod Foo$0 { #![doc = "time is mana"] #[doc = "This comment belongs to the function"] @@ -3289,7 +3289,7 @@ mod Foo<|> { check_hover_no_result( r#" fn no_hover() { - // no<|>hover + // no$0hover } "#, ); @@ -3300,7 +3300,7 @@ fn no_hover() { check( r#" fn foo() { - 'label<|>: loop {} + 'label$0: loop {} } "#, expect![[r#" @@ -3316,7 +3316,7 @@ fn foo() { #[test] fn hover_lifetime() { check( - r#"fn foo<'lifetime>(_: &'lifetime<|> ()) {}"#, + r#"fn foo<'lifetime>(_: &'lifetime$0 ()) {}"#, expect![[r#" *'lifetime* @@ -3335,7 +3335,7 @@ struct Foo(T); trait Copy {} trait Clone {} trait Sized {} -impl Foo> where T: Sized {} +impl Foo where T: Sized {} "#, expect![[r#" *T* @@ -3348,7 +3348,7 @@ impl Foo> where T: Sized {} check( r#" struct Foo(T); -impl Foo> {} +impl Foo {} "#, expect![[r#" *T* @@ -3362,7 +3362,7 @@ impl Foo> {} check( r#" struct Foo(T); -impl Foo> {} +impl Foo {} "#, expect![[r#" *T* @@ -3379,7 +3379,7 @@ impl Foo> {} check( r#" struct Foo; -impl Foo> {} +impl Foo {} "#, expect![[r#" *LEN* diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs index b5a6f66fd..296893d2f 100644 --- a/crates/ide/src/join_lines.rs +++ b/crates/ide/src/join_lines.rs @@ -104,7 +104,7 @@ fn remove_newline(edit: &mut TextEditBuilder, token: &SyntaxToken, offset: TextS // Special case that turns something like: // // ``` - // my_function({<|> + // my_function({$0 // // }) // ``` @@ -116,7 +116,7 @@ fn remove_newline(edit: &mut TextEditBuilder, token: &SyntaxToken, offset: TextS // ditto for // // ``` - // use foo::{<|> + // use foo::{$0 // bar // }; // ``` @@ -222,13 +222,13 @@ mod tests { check_join_lines( r" fn foo() { - <|>foo(1, + $0foo(1, ) } ", r" fn foo() { - <|>foo(1) + $0foo(1) } ", ); @@ -239,14 +239,14 @@ fn foo() { check_join_lines( r" pub fn reparse(&self, edit: &AtomTextEdit) -> File { - <|>self.incremental_reparse(edit).unwrap_or_else(|| { + $0self.incremental_reparse(edit).unwrap_or_else(|| { self.full_reparse(edit) }) } ", r" pub fn reparse(&self, edit: &AtomTextEdit) -> File { - <|>self.incremental_reparse(edit).unwrap_or_else(|| self.full_reparse(edit)) + $0self.incremental_reparse(edit).unwrap_or_else(|| self.full_reparse(edit)) } ", ); @@ -257,13 +257,13 @@ pub fn reparse(&self, edit: &AtomTextEdit) -> File { check_join_lines( r" fn foo() { - foo(<|>{ + foo($0{ 92 }) }", r" fn foo() { - foo(<|>92) + foo($092) }", ); } @@ -274,7 +274,7 @@ fn foo() { fn foo() { loop { match x { - 92 => <|>{ + 92 => $0{ continue; } } @@ -285,7 +285,7 @@ fn foo() { fn foo() { loop { match x { - 92 => <|>continue, + 92 => $0continue, } } } @@ -299,7 +299,7 @@ fn foo() { r" fn foo(e: Result) { match e { - Ok(u) => <|>{ + Ok(u) => $0{ u.foo() } Err(v) => v, @@ -308,7 +308,7 @@ fn foo(e: Result) { r" fn foo(e: Result) { match e { - Ok(u) => <|>u.foo(), + Ok(u) => $0u.foo(), Err(v) => v, } }", @@ -321,7 +321,7 @@ fn foo(e: Result) { r" fn foo() { match ty { - <|> Some(ty) => { + $0 Some(ty) => { match ty { _ => false, } @@ -333,7 +333,7 @@ fn foo() { r" fn foo() { match ty { - <|> Some(ty) => match ty { + $0 Some(ty) => match ty { _ => false, }, _ => true, @@ -350,7 +350,7 @@ fn foo() { r" fn foo(e: Result) { match e { - Ok(u) => <|>{ + Ok(u) => $0{ u.foo() }, Err(v) => v, @@ -359,7 +359,7 @@ fn foo(e: Result) { r" fn foo(e: Result) { match e { - Ok(u) => <|>u.foo(), + Ok(u) => $0u.foo(), Err(v) => v, } }", @@ -370,7 +370,7 @@ fn foo(e: Result) { r" fn foo(e: Result) { match e { - Ok(u) => <|>{ + Ok(u) => $0{ u.foo() } , Err(v) => v, @@ -379,7 +379,7 @@ fn foo(e: Result) { r" fn foo(e: Result) { match e { - Ok(u) => <|>u.foo() , + Ok(u) => $0u.foo() , Err(v) => v, } }", @@ -390,7 +390,7 @@ fn foo(e: Result) { r" fn foo(e: Result) { match e { - Ok(u) => <|>{ + Ok(u) => $0{ u.foo() } , @@ -400,7 +400,7 @@ fn foo(e: Result) { r" fn foo(e: Result) { match e { - Ok(u) => <|>u.foo() + Ok(u) => $0u.foo() , Err(v) => v, } @@ -414,13 +414,13 @@ fn foo(e: Result) { check_join_lines( r" fn foo() { - let x = (<|>{ + let x = ($0{ 4 },); }", r" fn foo() { - let x = (<|>4,); + let x = ($04,); }", ); @@ -428,13 +428,13 @@ fn foo() { check_join_lines( r" fn foo() { - let x = (<|>{ + let x = ($0{ 4 } ,); }", r" fn foo() { - let x = (<|>4 ,); + let x = ($04 ,); }", ); @@ -442,14 +442,14 @@ fn foo() { check_join_lines( r" fn foo() { - let x = (<|>{ + let x = ($0{ 4 } ,); }", r" fn foo() { - let x = (<|>4 + let x = ($04 ,); }", ); @@ -460,11 +460,11 @@ fn foo() { // No space after the '{' check_join_lines( r" -<|>use syntax::{ +$0use syntax::{ TextSize, TextRange, };", r" -<|>use syntax::{TextSize, TextRange, +$0use syntax::{TextSize, TextRange, };", ); } @@ -475,11 +475,11 @@ fn foo() { check_join_lines( r" use syntax::{ -<|> TextSize, TextRange +$0 TextSize, TextRange };", r" use syntax::{ -<|> TextSize, TextRange};", +$0 TextSize, TextRange};", ); } @@ -489,11 +489,11 @@ use syntax::{ check_join_lines( r" use syntax::{ -<|> TextSize, TextRange, +$0 TextSize, TextRange, };", r" use syntax::{ -<|> TextSize, TextRange};", +$0 TextSize, TextRange};", ); } @@ -502,14 +502,14 @@ use syntax::{ check_join_lines( r" use syntax::{ - algo::<|>{ + algo::$0{ find_token_at_offset, }, ast, };", r" use syntax::{ - algo::<|>find_token_at_offset, + algo::$0find_token_at_offset, ast, };", ); @@ -520,13 +520,13 @@ use syntax::{ check_join_lines( r" fn foo() { - // Hello<|> + // Hello$0 // world! } ", r" fn foo() { - // Hello<|> world! + // Hello$0 world! } ", ); @@ -537,13 +537,13 @@ fn foo() { check_join_lines( r" fn foo() { - /// Hello<|> + /// Hello$0 /// world! } ", r" fn foo() { - /// Hello<|> world! + /// Hello$0 world! } ", ); @@ -554,13 +554,13 @@ fn foo() { check_join_lines( r" fn foo() { - //! Hello<|> + //! Hello$0 //! world! } ", r" fn foo() { - //! Hello<|> world! + //! Hello$0 world! } ", ); @@ -571,13 +571,13 @@ fn foo() { check_join_lines( r" fn foo() { - // Hello<|> + // Hello$0 /* world! */ } ", r" fn foo() { - // Hello<|> world! */ + // Hello$0 world! */ } ", ); @@ -588,7 +588,7 @@ fn foo() { check_join_lines( r" fn foo() { - // The<|> + // The$0 /* quick brown fox! */ @@ -596,7 +596,7 @@ fn foo() { ", r" fn foo() { - // The<|> quick + // The$0 quick brown fox! */ } @@ -621,10 +621,10 @@ fn foo() { check_join_lines_sel( r" fn foo() { - <|>foo(1, + $0foo(1, 2, 3, - <|>) + $0) } ", r" @@ -639,9 +639,9 @@ fn foo() { fn test_join_lines_selection_struct() { check_join_lines_sel( r" -struct Foo <|>{ +struct Foo $0{ f: u32, -}<|> +}$0 ", r" struct Foo { f: u32 } @@ -654,9 +654,9 @@ struct Foo { f: u32 } check_join_lines_sel( r" fn foo() { - join(<|>type_params.type_params() + join($0type_params.type_params() .filter_map(|it| it.name()) - .map(|it| it.text())<|>) + .map(|it| it.text())$0) }", r" fn foo() { @@ -671,9 +671,9 @@ fn foo() { r" pub fn handle_find_matching_brace() { params.offsets - .map(|offset| <|>{ + .map(|offset| $0{ world.analysis().matching_brace(&file, offset).unwrap_or(offset) - }<|>) + }$0) .collect(); }", r" @@ -691,7 +691,7 @@ pub fn handle_find_matching_brace() { r" fn main() { let _ = { - // <|>foo + // $0foo // bar 92 }; @@ -700,7 +700,7 @@ fn main() { r" fn main() { let _ = { - // <|>foo bar + // $0foo bar 92 }; } @@ -712,12 +712,12 @@ fn main() { fn join_lines_mandatory_blocks_block() { check_join_lines( r" -<|>fn foo() { +$0fn foo() { 92 } ", r" -<|>fn foo() { 92 +$0fn foo() { 92 } ", ); @@ -725,14 +725,14 @@ fn main() { check_join_lines( r" fn foo() { - <|>if true { + $0if true { 92 } } ", r" fn foo() { - <|>if true { 92 + $0if true { 92 } } ", @@ -741,14 +741,14 @@ fn foo() { check_join_lines( r" fn foo() { - <|>loop { + $0loop { 92 } } ", r" fn foo() { - <|>loop { 92 + $0loop { 92 } } ", @@ -757,14 +757,14 @@ fn foo() { check_join_lines( r" fn foo() { - <|>unsafe { + $0unsafe { 92 } } ", r" fn foo() { - <|>unsafe { 92 + $0unsafe { 92 } } ", diff --git a/crates/ide/src/matching_brace.rs b/crates/ide/src/matching_brace.rs index d70248afe..1bfa1439d 100644 --- a/crates/ide/src/matching_brace.rs +++ b/crates/ide/src/matching_brace.rs @@ -58,15 +58,15 @@ mod tests { assert_eq_text!(after, &actual); } - do_check("struct Foo { a: i32, }<|>", "struct Foo <|>{ a: i32, }"); - do_check("fn main() { |x: i32|<|> x * 2;}", "fn main() { <|>|x: i32| x * 2;}"); - do_check("fn main() { <|>|x: i32| x * 2;}", "fn main() { |x: i32<|>| x * 2;}"); + do_check("struct Foo { a: i32, }$0", "struct Foo $0{ a: i32, }"); + do_check("fn main() { |x: i32|$0 x * 2;}", "fn main() { $0|x: i32| x * 2;}"); + do_check("fn main() { $0|x: i32| x * 2;}", "fn main() { |x: i32$0| x * 2;}"); { mark::check!(pipes_not_braces); do_check( - "fn main() { match 92 { 1 | 2 |<|> 3 => 92 } }", - "fn main() { match 92 { 1 | 2 |<|> 3 => 92 } }", + "fn main() { match 92 { 1 | 2 |$0 3 => 92 } }", + "fn main() { match 92 { 1 | 2 |$0 3 => 92 } }", ); } } diff --git a/crates/ide/src/parent_module.rs b/crates/ide/src/parent_module.rs index be344a09b..d343638fb 100644 --- a/crates/ide/src/parent_module.rs +++ b/crates/ide/src/parent_module.rs @@ -74,7 +74,7 @@ mod tests { //- /lib.rs mod foo; //- /foo.rs - <|>// empty + $0// empty ", ); let nav = analysis.parent_module(pos).unwrap().pop().unwrap(); @@ -90,7 +90,7 @@ mod tests { mod foo; //- /foo.rs - mod <|>bar; + mod $0bar; //- /foo/bar.rs // empty @@ -107,7 +107,7 @@ mod tests { //- /lib.rs mod foo { mod bar { - mod baz { <|> } + mod baz { $0 } } } ", @@ -123,7 +123,7 @@ mod tests { //- /main.rs mod foo; //- /foo.rs -<|> +$0 "#, ); assert_eq!(analysis.crate_for(file_id).unwrap().len(), 1); diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index fa58fc319..c95ed669c 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs @@ -331,7 +331,7 @@ mod tests { fn test_struct_literal_after_space() { check( r#" -struct Foo <|>{ +struct Foo $0{ a: i32, } impl Foo { @@ -354,7 +354,7 @@ fn main() { fn test_struct_literal_before_space() { check( r#" -struct Foo<|> {} +struct Foo$0 {} fn main() { let f: Foo; f = Foo {}; @@ -373,7 +373,7 @@ struct Foo<|> {} fn test_struct_literal_with_generic_type() { check( r#" -struct Foo <|>{} +struct Foo $0{} fn main() { let f: Foo::; f = Foo {}; @@ -391,7 +391,7 @@ struct Foo <|>{} fn test_struct_literal_for_tuple() { check( r#" -struct Foo<|>(i32); +struct Foo$0(i32); fn main() { let f: Foo; @@ -410,7 +410,7 @@ fn main() { fn test_enum_after_space() { check( r#" -enum Foo <|>{ +enum Foo $0{ A, B, } @@ -431,7 +431,7 @@ fn main() { fn test_enum_before_space() { check( r#" -enum Foo<|> { +enum Foo$0 { A, B, } @@ -453,7 +453,7 @@ fn main() { fn test_enum_with_generic_type() { check( r#" -enum Foo <|>{ +enum Foo $0{ A(T), B, } @@ -474,7 +474,7 @@ fn main() { fn test_enum_for_tuple() { check( r#" -enum Foo<|>{ +enum Foo$0{ A(i8), B(i8), } @@ -498,7 +498,7 @@ fn main() { fn main() { let mut i = 1; let j = 1; - i = i<|> + j; + i = i$0 + j; { i = 0; @@ -522,7 +522,7 @@ fn main() { check( r#" fn foo() { - let spam<|> = 92; + let spam$0 = 92; spam + spam } fn bar() { @@ -543,7 +543,7 @@ fn bar() { fn test_find_all_refs_for_param_inside() { check( r#" -fn foo(i : u32) -> u32 { i<|> } +fn foo(i : u32) -> u32 { i$0 } "#, expect![[r#" i ValueParam FileId(0) 7..8 Other @@ -557,7 +557,7 @@ fn foo(i : u32) -> u32 { i<|> } fn test_find_all_refs_for_fn_param() { check( r#" -fn foo(i<|> : u32) -> u32 { i } +fn foo(i$0 : u32) -> u32 { i } "#, expect![[r#" i ValueParam FileId(0) 7..8 Other @@ -573,7 +573,7 @@ fn foo(i<|> : u32) -> u32 { i } r#" //- /lib.rs struct Foo { - pub spam<|>: u32, + pub spam$0: u32, } fn main(s: Foo) { @@ -594,7 +594,7 @@ fn main(s: Foo) { r#" struct Foo; impl Foo { - fn f<|>(&self) { } + fn f$0(&self) { } } "#, expect![[r#" @@ -610,7 +610,7 @@ impl Foo { r#" enum Foo { A, - B<|>, + B$0, C, } "#, @@ -627,7 +627,7 @@ enum Foo { r#" enum Foo { A, - B { field<|>: u8 }, + B { field$0: u8 }, C, } "#, @@ -669,7 +669,7 @@ pub struct Bar { } fn f() { - let i = foo::Foo<|> { n: 5 }; + let i = foo::Foo$0 { n: 5 }; } "#, expect![[r#" @@ -689,7 +689,7 @@ fn f() { check( r#" //- /lib.rs -mod foo<|>; +mod foo$0; use foo::Foo; @@ -726,7 +726,7 @@ fn f() { } //- /foo/some.rs -pub(super) struct Foo<|> { +pub(super) struct Foo$0 { pub n: u32, } "#, @@ -746,7 +746,7 @@ pub(super) struct Foo<|> { mod foo; mod bar; - pub fn quux<|>() {} + pub fn quux$0() {} //- /foo.rs fn f() { super::quux(); } @@ -782,7 +782,7 @@ pub(super) struct Foo<|> { check( r#" #[macro_export] -macro_rules! m1<|> { () => (()) } +macro_rules! m1$0 { () => (()) } fn foo() { m1(); @@ -803,7 +803,7 @@ fn foo() { check( r#" fn foo() { - let mut i<|> = 0; + let mut i$0 = 0; i = i + 1; } "#, @@ -826,7 +826,7 @@ struct S { fn foo() { let mut s = S{f: 0}; - s.f<|> = 0; + s.f$0 = 0; } "#, expect![[r#" @@ -843,7 +843,7 @@ fn foo() { check( r#" fn foo() { - let i<|>; + let i$0; i = 1; } "#, @@ -863,7 +863,7 @@ mod foo { pub struct Foo; impl Foo { - pub fn new<|>() -> Foo { Foo } + pub fn new$0() -> Foo { Foo } } } @@ -886,7 +886,7 @@ fn main() { //- /lib.rs mod foo { mod bar; } -fn f<|>() {} +fn f$0() {} //- /foo/bar.rs use crate::f; @@ -907,7 +907,7 @@ fn g() { f(); } check( r#" struct S { - field<|>: u8, + field$0: u8, } fn f(s: S) { @@ -930,7 +930,7 @@ fn f(s: S) { r#" enum En { Variant { - field<|>: u8, + field$0: u8, } } @@ -955,7 +955,7 @@ fn f(e: En) { mod m { pub enum En { Variant { - field<|>: u8, + field$0: u8, } } } @@ -980,7 +980,7 @@ struct Foo { bar: i32 } impl Foo { fn foo(self) { - let x = self<|>.bar; + let x = self$0.bar; if true { let _ = match () { () => self, @@ -1032,7 +1032,7 @@ impl Foo { r#" trait Foo<'a> {} impl<'a> Foo<'a> for &'a () {} -fn foo<'a, 'b: 'a>(x: &'a<|> ()) -> &'a () where &'a (): Foo<'a> { +fn foo<'a, 'b: 'a>(x: &'a$0 ()) -> &'a () where &'a (): Foo<'a> { fn bar<'a>(_: &'a ()) {} x } @@ -1053,7 +1053,7 @@ fn foo<'a, 'b: 'a>(x: &'a<|> ()) -> &'a () where &'a (): Foo<'a> { fn test_find_lifetimes_type_alias() { check( r#" -type Foo<'a, T> where T: 'a<|> = &'a T; +type Foo<'a, T> where T: 'a$0 = &'a T; "#, expect![[r#" 'a LifetimeParam FileId(0) 9..11 9..11 Lifetime @@ -1072,7 +1072,7 @@ trait Foo<'a> { fn foo() -> &'a (); } impl<'a> Foo<'a> for &'a () { - fn foo() -> &'a<|> () { + fn foo() -> &'a$0 () { unimplemented!() } } @@ -1093,7 +1093,7 @@ impl<'a> Foo<'a> for &'a () { r#" macro_rules! foo {($i:ident) => {$i} } fn main() { - let a<|> = "test"; + let a$0 = "test"; foo!(a); } "#, @@ -1112,7 +1112,7 @@ fn main() { macro_rules! foo {($i:ident) => {$i} } fn main() { let a = "test"; - foo!(a<|>); + foo!(a$0); } "#, expect![[r#" @@ -1130,7 +1130,7 @@ fn main() { fn foo<'a>() -> &'a () { 'a: loop { 'b: loop { - continue 'a<|>; + continue 'a$0; } break 'a; } @@ -1149,7 +1149,7 @@ fn foo<'a>() -> &'a () { fn test_find_const_param() { check( r#" -fn foo: usize>() -> usize { +fn foo() -> usize { FOO } "#, diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 854bf194e..53d79333c 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs @@ -493,19 +493,19 @@ mod tests { #[test] fn test_rename_to_underscore() { - check("_", r#"fn main() { let i<|> = 1; }"#, r#"fn main() { let _ = 1; }"#); + check("_", r#"fn main() { let i$0 = 1; }"#, r#"fn main() { let _ = 1; }"#); } #[test] fn test_rename_to_raw_identifier() { - check("r#fn", r#"fn main() { let i<|> = 1; }"#, r#"fn main() { let r#fn = 1; }"#); + check("r#fn", r#"fn main() { let i$0 = 1; }"#, r#"fn main() { let r#fn = 1; }"#); } #[test] fn test_rename_to_invalid_identifier1() { check( "invalid!", - r#"fn main() { let i<|> = 1; }"#, + r#"fn main() { let i$0 = 1; }"#, "error: Invalid name `invalid!`: not an identifier", ); } @@ -514,7 +514,7 @@ mod tests { fn test_rename_to_invalid_identifier2() { check( "multiple tokens", - r#"fn main() { let i<|> = 1; }"#, + r#"fn main() { let i$0 = 1; }"#, "error: Invalid name `multiple tokens`: not an identifier", ); } @@ -523,7 +523,7 @@ mod tests { fn test_rename_to_invalid_identifier3() { check( "let", - r#"fn main() { let i<|> = 1; }"#, + r#"fn main() { let i$0 = 1; }"#, "error: Invalid name `let`: not an identifier", ); } @@ -532,7 +532,7 @@ mod tests { fn test_rename_to_invalid_identifier_lifetime() { check( "'foo", - r#"fn main() { let i<|> = 1; }"#, + r#"fn main() { let i$0 = 1; }"#, "error: Invalid name `'foo`: not an identifier", ); } @@ -541,7 +541,7 @@ mod tests { fn test_rename_to_invalid_identifier_lifetime2() { check( "foo", - r#"fn main<'a>(_: &'a<|> ()) {}"#, + r#"fn main<'a>(_: &'a$0 ()) {}"#, "error: Invalid name `foo`: not a lifetime identifier", ); } @@ -554,7 +554,7 @@ mod tests { fn main() { let mut i = 1; let j = 1; - i = i<|> + j; + i = i$0 + j; { i = 0; } @@ -579,7 +579,7 @@ fn main() { fn test_rename_unresolved_reference() { check( "new_name", - r#"fn main() { let _ = unresolved_ref<|>; }"#, + r#"fn main() { let _ = unresolved_ref$0; }"#, "error: No references found at position", ); } @@ -591,7 +591,7 @@ fn main() { r#" macro_rules! foo {($i:ident) => {$i} } fn main() { - let a<|> = "test"; + let a$0 = "test"; foo!(a); } "#, @@ -613,7 +613,7 @@ fn main() { macro_rules! foo {($i:ident) => {$i} } fn main() { let a = "test"; - foo!(a<|>); + foo!(a$0); } "#, r#" @@ -634,7 +634,7 @@ fn main() { macro_rules! define_fn {($id:ident) => { fn $id{} }} define_fn!(foo); fn main() { - fo<|>o(); + fo$0o(); } "#, r#" @@ -653,7 +653,7 @@ fn main() { "bar", r#" macro_rules! define_fn {($id:ident) => { fn $id{} }} -define_fn!(fo<|>o); +define_fn!(fo$0o); fn main() { foo(); } @@ -670,17 +670,17 @@ fn main() { #[test] fn test_rename_for_param_inside() { - check("j", r#"fn foo(i : u32) -> u32 { i<|> }"#, r#"fn foo(j : u32) -> u32 { j }"#); + check("j", r#"fn foo(i : u32) -> u32 { i$0 }"#, r#"fn foo(j : u32) -> u32 { j }"#); } #[test] fn test_rename_refs_for_fn_param() { - check("j", r#"fn foo(i<|> : u32) -> u32 { i }"#, r#"fn foo(j : u32) -> u32 { j }"#); + check("j", r#"fn foo(i$0 : u32) -> u32 { i }"#, r#"fn foo(j : u32) -> u32 { j }"#); } #[test] fn test_rename_for_mut_param() { - check("j", r#"fn foo(mut i<|> : u32) -> u32 { i }"#, r#"fn foo(mut j : u32) -> u32 { j }"#); + check("j", r#"fn foo(mut i$0 : u32) -> u32 { i }"#, r#"fn foo(mut j : u32) -> u32 { j }"#); } #[test] @@ -688,7 +688,7 @@ fn main() { check( "j", r#" -struct Foo { i<|>: i32 } +struct Foo { i$0: i32 } impl Foo { fn new(i: i32) -> Self { @@ -714,7 +714,7 @@ impl Foo { check( "j", r#" -struct Foo { i<|>: i32 } +struct Foo { i$0: i32 } impl Foo { fn new(i: i32) -> Self { @@ -743,7 +743,7 @@ impl Foo { struct Foo { i: i32 } impl Foo { - fn new(i<|>: i32) -> Self { + fn new(i$0: i32) -> Self { Self { i } } } @@ -765,7 +765,7 @@ impl Foo { check( "j", r#" -struct Foo { i<|>: i32 } +struct Foo { i$0: i32 } struct Bar { i: i32 } impl Bar { @@ -794,7 +794,7 @@ impl Bar { r#" struct Foo { i: i32 } -fn baz(i<|>: i32) -> Self { +fn baz(i$0: i32) -> Self { let x = Foo { i }; { let i = 0; @@ -825,7 +825,7 @@ fn baz(j: i32) -> Self { mod bar; //- /bar.rs -mod foo<|>; +mod foo$0; //- /bar/foo.rs // empty @@ -883,7 +883,7 @@ fn main() {} pub struct FooContent; //- /bar.rs -use crate::foo<|>::FooContent; +use crate::foo$0::FooContent; "#, expect![[r#" RangeInfo { @@ -943,7 +943,7 @@ use crate::foo<|>::FooContent; "foo2", r#" //- /lib.rs -mod fo<|>o; +mod fo$0o; //- /foo/mod.rs // emtpy "#, @@ -992,7 +992,7 @@ mod fo<|>o; "bar", r#" //- /lib.rs -mod outer { mod fo<|>o; } +mod outer { mod fo$0o; } //- /outer/foo.rs // emtpy @@ -1041,7 +1041,7 @@ mod outer { mod fo<|>o; } check( "baz", r#" -mod <|>foo { pub fn bar() {} } +mod $0foo { pub fn bar() {} } fn main() { foo::bar(); } "#, @@ -1065,7 +1065,7 @@ fn f() { } //- /bar.rs -pub mod foo<|>; +pub mod foo$0; //- /bar/foo.rs // pub fn fun() {} @@ -1128,7 +1128,7 @@ pub mod foo<|>; "Baz", r#" mod foo { - pub enum Foo { Bar<|> } + pub enum Foo { Bar$0 } } fn func(f: foo::Foo) { @@ -1157,7 +1157,7 @@ fn func(f: foo::Foo) { "baz", r#" mod foo { - pub struct Foo { pub bar<|>: uint } + pub struct Foo { pub bar$0: uint } } fn foo(f: foo::Foo) { @@ -1184,7 +1184,7 @@ fn foo(f: foo::Foo) { struct Foo { i: i32 } impl Foo { - fn f(foo<|>: &mut Foo) -> i32 { + fn f(foo$0: &mut Foo) -> i32 { foo.i } } @@ -1205,7 +1205,7 @@ impl Foo { struct Foo { i: i32 } impl Foo { - fn f(foo<|>: Foo) -> i32 { + fn f(foo$0: Foo) -> i32 { foo.i } } @@ -1229,7 +1229,7 @@ impl Foo { r#" struct Foo { i: i32 } -fn f(foo<|>: &mut Foo) -> i32 { +fn f(foo$0: &mut Foo) -> i32 { foo.i } "#, @@ -1242,7 +1242,7 @@ struct Foo { i: i32 } struct Bar; impl Bar { - fn f(foo<|>: &mut Foo) -> i32 { + fn f(foo$0: &mut Foo) -> i32 { foo.i } } @@ -1258,7 +1258,7 @@ impl Bar { r#" struct Foo { i: i32 } impl Foo { - fn f(x: (), foo<|>: &mut Foo) -> i32 { + fn f(x: (), foo$0: &mut Foo) -> i32 { foo.i } } @@ -1274,7 +1274,7 @@ impl Foo { r#" struct Foo { i: i32 } impl &Foo { - fn f(foo<|>: &Foo) -> i32 { + fn f(foo$0: &Foo) -> i32 { foo.i } } @@ -1298,7 +1298,7 @@ impl &Foo { struct Foo { i: i32 } impl Foo { - fn f(&mut <|>self) -> i32 { + fn f(&mut $0self) -> i32 { self.i } } @@ -1323,7 +1323,7 @@ impl Foo { struct Foo { i: i32 } impl Foo { - fn f(<|>self) -> i32 { + fn f($0self) -> i32 { self.i } } @@ -1350,7 +1350,7 @@ struct Foo { i: i32 } impl Foo { fn f(&self) -> i32 { let self_var = 1; - self<|>.i + self$0.i } } "#, @@ -1373,7 +1373,7 @@ impl Foo { check( "bar", r#" -struct Foo { i<|>: i32 } +struct Foo { i$0: i32 } fn foo(bar: i32) -> Foo { Foo { i: bar } @@ -1394,7 +1394,7 @@ fn foo(bar: i32) -> Foo { check( "baz", r#" -struct Foo { i<|>: i32 } +struct Foo { i$0: i32 } fn foo(foo: Foo) { let Foo { i: baz } = foo; @@ -1433,7 +1433,7 @@ struct Foo { fn foo(foo: Foo) { let Foo { i: b } = foo; - let _ = b<|>; + let _ = b$0; } "#, expected_fixture, @@ -1447,7 +1447,7 @@ struct Foo { fn foo(foo: Foo) { let Foo { i } = foo; - let _ = i<|>; + let _ = i$0; } "#, expected_fixture, @@ -1464,7 +1464,7 @@ struct Foo { } fn foo(Foo { i }: foo) -> i32 { - i<|> + i$0 } "#, r#" @@ -1488,7 +1488,7 @@ trait Foo<'a> { fn foo() -> &'a (); } impl<'a> Foo<'a> for &'a () { - fn foo() -> &'a<|> () { + fn foo() -> &'a$0 () { unimplemented!() } } @@ -1520,7 +1520,7 @@ fn main() { let test_variable = CustomOption::Some(22); match test_variable { - CustomOption::Some(foo<|>) if foo == 11 => {} + CustomOption::Some(foo$0) if foo == 11 => {} _ => (), } }"#, @@ -1549,7 +1549,7 @@ fn main() { fn foo<'a>() -> &'a () { 'a: { 'b: loop { - break 'a<|>; + break 'a$0; } } } diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index f4030f3ef..557563d7e 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs @@ -329,7 +329,7 @@ mod tests { check( r#" //- /lib.rs -<|> +$0 fn main() {} #[test] @@ -425,7 +425,7 @@ fn bench() {} check( r#" //- /lib.rs -<|> +$0 fn main() {} /// ``` @@ -573,7 +573,7 @@ struct StructWithRunnable(String); check( r#" //- /lib.rs -<|> +$0 fn main() {} struct Data; @@ -625,7 +625,7 @@ impl Data { check( r#" //- /lib.rs -<|> +$0 mod test_mod { #[test] fn test_foo1() {} @@ -679,7 +679,7 @@ mod test_mod { check( r#" //- /lib.rs -<|> +$0 mod root_tests { mod nested_tests_0 { mod nested_tests_1 { @@ -819,7 +819,7 @@ mod root_tests { check( r#" //- /lib.rs crate:foo cfg:feature=foo -<|> +$0 #[test] #[cfg(feature = "foo")] fn test_foo1() {} @@ -864,7 +864,7 @@ fn test_foo1() {} check( r#" //- /lib.rs crate:foo cfg:feature=foo,feature=bar -<|> +$0 #[test] #[cfg(all(feature = "foo", feature = "bar"))] fn test_foo1() {} @@ -919,7 +919,7 @@ fn test_foo1() {} check( r#" //- /lib.rs -<|> +$0 mod test_mod { fn foo1() {} } @@ -938,7 +938,7 @@ mod test_mod { //- /lib.rs mod foo; //- /foo.rs -struct Foo;<|> +struct Foo;$0 impl Foo { /// ``` /// let x = 5; diff --git a/crates/ide/src/syntax_tree.rs b/crates/ide/src/syntax_tree.rs index 6dd05c05d..1f26f8043 100644 --- a/crates/ide/src/syntax_tree.rs +++ b/crates/ide/src/syntax_tree.rs @@ -85,7 +85,7 @@ fn syntax_tree_for_token(node: &SyntaxToken, text_range: TextRange) -> Option", ""); + .replace("$0", ""); let parsed = SourceFile::parse(&text); @@ -182,7 +182,7 @@ SOURCE_FILE@0..60 #[test] fn test_syntax_tree_with_range() { - let (analysis, range) = fixture::range(r#"<|>fn foo() {}<|>"#.trim()); + let (analysis, range) = fixture::range(r#"$0fn foo() {}$0"#.trim()); let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); assert_eq_text!( @@ -206,10 +206,10 @@ FN@0..11 let (analysis, range) = fixture::range( r#"fn test() { - <|>assert!(" + $0assert!(" fn foo() { } - ", "");<|> + ", "");$0 }"# .trim(), ); @@ -243,8 +243,8 @@ EXPR_STMT@16..58 let (analysis, range) = fixture::range( r#"fn test() { assert!(" -<|>fn foo() { -}<|> +$0fn foo() { +}$0 fn bar() { } ", ""); @@ -277,8 +277,8 @@ SOURCE_FILE@0..12 let (analysis, range) = fixture::range( r###"fn test() { assert!(r#" -<|>fn foo() { -}<|> +$0fn foo() { +}$0 fn bar() { } "#, ""); @@ -310,11 +310,11 @@ SOURCE_FILE@0..12 // With a raw string let (analysis, range) = fixture::range( r###"fn test() { - assert!(r<|>#" + assert!(r$0#" fn foo() { } fn bar() { -}"<|>#, ""); +}"$0#, ""); }"### .trim(), ); diff --git a/crates/ide/src/typing.rs b/crates/ide/src/typing.rs index 43458a3a2..88c905003 100644 --- a/crates/ide/src/typing.rs +++ b/crates/ide/src/typing.rs @@ -170,7 +170,7 @@ mod tests { fn test_on_eq_typed() { // do_check(r" // fn foo() { - // let foo =<|> + // let foo =$0 // } // ", r" // fn foo() { @@ -181,7 +181,7 @@ mod tests { '=', r" fn foo() { - let foo <|> 1 + 1 + let foo $0 1 + 1 } ", r" @@ -192,7 +192,7 @@ fn foo() { ); // do_check(r" // fn foo() { - // let foo =<|> + // let foo =$0 // let bar = 1; // } // ", r" @@ -210,7 +210,7 @@ fn foo() { r" fn main() { xs.foo() - <|> + $0 } ", r" @@ -225,7 +225,7 @@ fn foo() { r" fn main() { xs.foo() - <|> + $0 } ", ) @@ -238,7 +238,7 @@ fn foo() { r" fn main() { xs.foo() - <|>; + $0; } ", r" @@ -253,7 +253,7 @@ fn foo() { r" fn main() { xs.foo() - <|>; + $0; } ", ) @@ -266,7 +266,7 @@ fn foo() { r#" fn main() { let _ = foo - <|> + $0 bar() } "#, @@ -288,7 +288,7 @@ fn main() { fn main() { xs.foo() .first() - <|> + $0 } ", r" @@ -305,7 +305,7 @@ fn main() { fn main() { xs.foo() .first() - <|> + $0 } ", ); @@ -318,7 +318,7 @@ fn main() { r" fn source_impl() { let var = enum_defvariant_list().unwrap() - <|> + $0 .nth(92) .unwrap(); } @@ -337,7 +337,7 @@ fn main() { r" fn source_impl() { let var = enum_defvariant_list().unwrap() - <|> + $0 .nth(92) .unwrap(); } @@ -351,7 +351,7 @@ fn main() { '.', r" fn main() { - <|> + $0 } ", ); @@ -359,7 +359,7 @@ fn main() { '.', r" fn main() { - <|> + $0 } ", ); @@ -367,6 +367,6 @@ fn main() { #[test] fn adds_space_after_return_type() { - type_char('>', "fn foo() -<|>{ 92 }", "fn foo() -> { 92 }") + type_char('>', "fn foo() -$0{ 92 }", "fn foo() -> { 92 }") } } diff --git a/crates/ide/src/typing/on_enter.rs b/crates/ide/src/typing/on_enter.rs index f4ea30352..63cd51b69 100644 --- a/crates/ide/src/typing/on_enter.rs +++ b/crates/ide/src/typing/on_enter.rs @@ -136,7 +136,7 @@ mod tests { fn continues_doc_comment() { do_check( r" -/// Some docs<|> +/// Some docs$0 fn foo() { } ", @@ -151,7 +151,7 @@ fn foo() { do_check( r" impl S { - /// Some<|> docs. + /// Some$0 docs. fn foo() {} } ", @@ -166,7 +166,7 @@ impl S { do_check( r" -///<|> Some docs +///$0 Some docs fn foo() { } ", @@ -181,7 +181,7 @@ fn foo() { #[test] fn does_not_continue_before_doc_comment() { - do_check_noop(r"<|>//! docz"); + do_check_noop(r"$0//! docz"); } #[test] @@ -189,7 +189,7 @@ fn foo() { do_check( r" fn main() { - // Fix<|> me + // Fix$0 me let x = 1 + 1; } ", @@ -208,7 +208,7 @@ fn main() { do_check( r" fn main() { - // Fix<|> + // Fix$0 // me let x = 1 + 1; } @@ -229,7 +229,7 @@ fn main() { do_check_noop( r" fn main() { - // Fix me<|> + // Fix me$0 let x = 1 + 1; } ", @@ -242,7 +242,7 @@ fn main() { do_check( r#" fn main() { - // Fix me <|> + // Fix me $0 let x = 1 + 1; } "#, @@ -261,7 +261,7 @@ fn main() { do_check( " fn main() { - // Fix me \t\t <|> + // Fix me \t\t $0 let x = 1 + 1; } ", -- cgit v1.2.3