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/completion/src/completions/attribute.rs | 12 ++-- crates/completion/src/completions/dot.rs | 42 +++++------ crates/completion/src/completions/fn_param.rs | 8 +-- crates/completion/src/completions/keyword.rs | 56 +++++++-------- .../src/completions/macro_in_item_position.rs | 2 +- crates/completion/src/completions/mod_.rs | 18 ++--- crates/completion/src/completions/pattern.rs | 20 +++--- crates/completion/src/completions/postfix.rs | 48 ++++++------- .../completion/src/completions/qualified_path.rs | 70 +++++++++--------- crates/completion/src/completions/record.rs | 28 ++++---- crates/completion/src/completions/snippet.rs | 8 +-- crates/completion/src/completions/trait_impl.rs | 70 +++++++++--------- .../completion/src/completions/unqualified_path.rs | 82 +++++++++++----------- 13 files changed, 228 insertions(+), 236 deletions(-) (limited to 'crates/completion/src/completions') diff --git a/crates/completion/src/completions/attribute.rs b/crates/completion/src/completions/attribute.rs index 17276b5a4..10739750c 100644 --- a/crates/completion/src/completions/attribute.rs +++ b/crates/completion/src/completions/attribute.rs @@ -413,7 +413,7 @@ mod tests { fn empty_derive_completion() { check( r#" -#[derive(<|>)] +#[derive($0)] struct Test {} "#, expect![[r#" @@ -434,7 +434,7 @@ struct Test {} fn no_completion_for_incorrect_derive() { check( r#" -#[derive{<|>)] +#[derive{$0)] struct Test {} "#, expect![[r#""#]], @@ -445,7 +445,7 @@ struct Test {} fn derive_with_input_completion() { check( r#" -#[derive(serde::Serialize, PartialEq, <|>)] +#[derive(serde::Serialize, PartialEq, $0)] struct Test {} "#, expect![[r#" @@ -464,7 +464,7 @@ struct Test {} #[test] fn test_attribute_completion() { check( - r#"#[<|>]"#, + r#"#[$0]"#, expect![[r#" at allow(…) at automatically_derived @@ -504,13 +504,13 @@ struct Test {} #[test] fn test_attribute_completion_inside_nested_attr() { - check(r#"#[cfg(<|>)]"#, expect![[]]) + check(r#"#[cfg($0)]"#, expect![[]]) } #[test] fn test_inner_attribute_completion() { check( - r"#![<|>]", + r"#![$0]", expect![[r#" at allow(…) at automatically_derived diff --git a/crates/completion/src/completions/dot.rs b/crates/completion/src/completions/dot.rs index 551ef1771..2e25c8ba2 100644 --- a/crates/completion/src/completions/dot.rs +++ b/crates/completion/src/completions/dot.rs @@ -79,7 +79,7 @@ struct S { foo: u32 } impl S { fn bar(&self) {} } -fn foo(s: S) { s.<|> } +fn foo(s: S) { s.$0 } "#, expect![[r#" fd foo u32 @@ -94,7 +94,7 @@ fn foo(s: S) { s.<|> } r#" struct S { the_field: (u32,) } impl S { - fn foo(self) { self.<|> } + fn foo(self) { self.$0 } } "#, expect![[r#" @@ -110,7 +110,7 @@ impl S { r#" struct A { the_field: (u32, i32) } impl A { - fn foo(&self) { self.<|> } + fn foo(&self) { self.$0 } } "#, expect![[r#" @@ -126,7 +126,7 @@ impl A { check( r#" struct A { the_field: u32 } -fn foo(a: A) { a.<|>() } +fn foo(a: A) { a.$0() } "#, expect![[""]], ); @@ -144,7 +144,7 @@ mod inner { pub(crate) super_field: u32, } } -fn foo(a: inner::A) { a.<|> } +fn foo(a: inner::A) { a.$0 } "#, expect![[r#" fd pub_field u32 @@ -162,7 +162,7 @@ mod m { pub(crate) fn the_method(&self) {} } } -fn foo(a: A) { a.<|> } +fn foo(a: A) { a.$0 } "#, expect![[r#" me the_method() pub(crate) fn the_method(&self) @@ -175,7 +175,7 @@ fn foo(a: A) { a.<|> } check( r#" union U { field: u8, other: u16 } -fn foo(u: U) { u.<|> } +fn foo(u: U) { u.$0 } "#, expect![[r#" fd field u8 @@ -195,7 +195,7 @@ impl A { impl A { fn the_other_method(&self) {} } -fn foo(a: A) { a.<|> } +fn foo(a: A) { a.$0 } "#, expect![[r#" me the_method() fn the_method(&self) @@ -210,7 +210,7 @@ fn foo(a: A) { a.<|> } struct A {} trait Trait { fn the_method(&self); } impl Trait for A {} -fn foo(a: A) { a.<|> } +fn foo(a: A) { a.$0 } "#, expect![[r#" me the_method() fn the_method(&self) @@ -225,7 +225,7 @@ fn foo(a: A) { a.<|> } struct A {} trait Trait { fn the_method(&self); } impl Trait for T {} -fn foo(a: &A) { a.<|> } +fn foo(a: &A) { a.$0 } ", expect![[r#" me the_method() fn the_method(&self) @@ -243,7 +243,7 @@ mod m { } use m::Trait; impl Trait for A {} -fn foo(a: A) { a.<|> } +fn foo(a: A) { a.$0 } ", expect![[r#" me the_method() fn the_method(&self) @@ -260,7 +260,7 @@ impl A { fn the_method() {} } fn foo(a: A) { - a.<|> + a.$0 } "#, expect![[""]], @@ -273,7 +273,7 @@ fn foo(a: A) { r#" fn foo() { let b = (0, 3.14); - b.<|> + b.$0 } "#, expect![[r#" @@ -295,7 +295,7 @@ struct T(S); impl T { fn foo(&self) { // FIXME: This doesn't work without the trailing `a` as `0.` is a float - self.0.a<|> + self.0.a$0 } } "#, @@ -311,7 +311,7 @@ impl T { r#" struct A { the_field: u32 } const X: u32 = { - A { the_field: 92 }.<|> + A { the_field: 92 }.$0 }; "#, expect![[r#" @@ -327,7 +327,7 @@ const X: u32 = { macro_rules! m { ($e:expr) => { $e } } struct A { the_field: u32 } fn foo(a: A) { - m!(a.x<|>) + m!(a.x$0) } "#, expect![[r#" @@ -344,7 +344,7 @@ fn foo(a: A) { macro_rules! m { ($e:expr) => { $e } } struct A { the_field: u32 } fn foo(a: A) { - m!(a.<|>) + m!(a.$0) } "#, expect![[r#" @@ -360,7 +360,7 @@ fn foo(a: A) { macro_rules! m { ($e:expr) => { $e } } struct A { the_field: u32 } fn foo(a: A) { - m!(m!(m!(a.x<|>))) + m!(m!(m!(a.x$0))) } "#, expect![[r#" @@ -386,7 +386,7 @@ macro_rules! dbg { } struct A { the_field: u32 } fn foo(a: A) { - dbg!(a.<|>) + dbg!(a.$0) } "#, expect![[r#" @@ -405,7 +405,7 @@ impl HashSet { } fn foo() { let s: HashSet<_>; - s.<|> + s.$0 } "#, expect![[r#" @@ -421,7 +421,7 @@ fn foo() { struct S; impl S { fn foo(&self) {} } macro_rules! make_s { () => { S }; } -fn main() { make_s!().f<|>; } +fn main() { make_s!().f$0; } "#, expect![[r#" me foo() fn foo(&self) diff --git a/crates/completion/src/completions/fn_param.rs b/crates/completion/src/completions/fn_param.rs index e777a53c1..5505c3559 100644 --- a/crates/completion/src/completions/fn_param.rs +++ b/crates/completion/src/completions/fn_param.rs @@ -81,7 +81,7 @@ mod tests { r#" fn foo(file_id: FileId) {} fn bar(file_id: FileId) {} -fn baz(file<|>) {} +fn baz(file$0) {} "#, expect![[r#" bn file_id: FileId @@ -94,7 +94,7 @@ fn baz(file<|>) {} check( r#" fn foo(file_id: FileId) {} -fn baz(file<|>, x: i32) {} +fn baz(file$0, x: i32) {} "#, expect![[r#" bn file_id: FileId @@ -110,7 +110,7 @@ pub(crate) trait SourceRoot { pub fn contains(&self, file_id: FileId) -> bool; pub fn module_map(&self) -> &ModuleMap; pub fn lines(&self, file_id: FileId) -> &LineIndex; - pub fn syntax(&self, file<|>) + pub fn syntax(&self, file$0) } "#, expect![[r#" @@ -124,7 +124,7 @@ pub(crate) trait SourceRoot { check( r#" fn outer(text: String) { - fn inner(<|>) + fn inner($0) } "#, expect![[r#" diff --git a/crates/completion/src/completions/keyword.rs b/crates/completion/src/completions/keyword.rs index 1859dec70..425a688ff 100644 --- a/crates/completion/src/completions/keyword.rs +++ b/crates/completion/src/completions/keyword.rs @@ -193,7 +193,7 @@ mod tests { #[test] fn test_keywords_in_use_stmt() { check( - r"use <|>", + r"use $0", expect![[r#" kw crate:: kw self @@ -202,7 +202,7 @@ mod tests { ); check( - r"use a::<|>", + r"use a::$0", expect![[r#" kw self kw super:: @@ -210,7 +210,7 @@ mod tests { ); check( - r"use a::{b, <|>}", + r"use a::{b, $0}", expect![[r#" kw self kw super:: @@ -221,7 +221,7 @@ mod tests { #[test] fn test_keywords_at_source_file_level() { check( - r"m<|>", + r"m$0", expect![[r#" kw fn kw use @@ -245,7 +245,7 @@ mod tests { #[test] fn test_keywords_in_function() { check( - r"fn quux() { <|> }", + r"fn quux() { $0 }", expect![[r#" kw fn kw use @@ -271,7 +271,7 @@ mod tests { #[test] fn test_keywords_inside_block() { check( - r"fn quux() { if true { <|> } }", + r"fn quux() { if true { $0 } }", expect![[r#" kw fn kw use @@ -297,7 +297,7 @@ mod tests { #[test] fn test_keywords_after_if() { check( - r#"fn quux() { if true { () } <|> }"#, + r#"fn quux() { if true { () } $0 }"#, expect![[r#" kw fn kw use @@ -322,7 +322,7 @@ mod tests { ); check_edit( "else", - r#"fn quux() { if true { () } <|> }"#, + r#"fn quux() { if true { () } $0 }"#, r#"fn quux() { if true { () } else {$0} }"#, ); } @@ -332,7 +332,7 @@ mod tests { check( r#" fn quux() -> i32 { - match () { () => <|> } + match () { () => $0 } } "#, expect![[r#" @@ -350,7 +350,7 @@ fn quux() -> i32 { #[test] fn test_keywords_in_trait_def() { check( - r"trait My { <|> }", + r"trait My { $0 }", expect![[r#" kw fn kw const @@ -363,7 +363,7 @@ fn quux() -> i32 { #[test] fn test_keywords_in_impl_def() { check( - r"impl My { <|> }", + r"impl My { $0 }", expect![[r#" kw fn kw const @@ -378,7 +378,7 @@ fn quux() -> i32 { #[test] fn test_keywords_in_loop() { check( - r"fn my() { loop { <|> } }", + r"fn my() { loop { $0 } }", expect![[r#" kw fn kw use @@ -406,7 +406,7 @@ fn quux() -> i32 { #[test] fn test_keywords_after_unsafe_in_item_list() { check( - r"unsafe <|>", + r"unsafe $0", expect![[r#" kw fn kw trait @@ -418,7 +418,7 @@ fn quux() -> i32 { #[test] fn test_keywords_after_unsafe_in_block_expr() { check( - r"fn my_fn() { unsafe <|> }", + r"fn my_fn() { unsafe $0 }", expect![[r#" kw fn kw trait @@ -430,19 +430,19 @@ fn quux() -> i32 { #[test] fn test_mut_in_ref_and_in_fn_parameters_list() { check( - r"fn my_fn(&<|>) {}", + r"fn my_fn(&$0) {}", expect![[r#" kw mut "#]], ); check( - r"fn my_fn(<|>) {}", + r"fn my_fn($0) {}", expect![[r#" kw mut "#]], ); check( - r"fn my_fn() { let &<|> }", + r"fn my_fn() { let &$0 }", expect![[r#" kw mut "#]], @@ -452,13 +452,13 @@ fn quux() -> i32 { #[test] fn test_where_keyword() { check( - r"trait A <|>", + r"trait A $0", expect![[r#" kw where "#]], ); check( - r"impl A <|>", + r"impl A $0", expect![[r#" kw where "#]], @@ -471,7 +471,7 @@ fn quux() -> i32 { check( r#" fn test() { - let x = 2; // A comment<|> + let x = 2; // A comment$0 } "#, expect![[""]], @@ -479,7 +479,7 @@ fn test() { check( r#" /* -Some multi-line comment<|> +Some multi-line comment$0 */ "#, expect![[""]], @@ -487,7 +487,7 @@ Some multi-line comment<|> check( r#" /// Some doc comment -/// let test<|> = 1 +/// let test$0 = 1 "#, expect![[""]], ); @@ -501,7 +501,7 @@ Some multi-line comment<|> use std::future::*; struct A {} impl Future for A {} -fn foo(a: A) { a.<|> } +fn foo(a: A) { a.$0 } //- /std/lib.rs crate:std pub mod future { @@ -520,7 +520,7 @@ pub mod future { use std::future::*; fn foo() { let a = async {}; - a.<|> + a.$0 } //- /std/lib.rs crate:std @@ -540,7 +540,7 @@ pub mod future { #[test] fn after_let() { check( - r#"fn main() { let _ = <|> }"#, + r#"fn main() { let _ = $0 }"#, expect![[r#" kw match kw while @@ -557,7 +557,7 @@ pub mod future { check( r#" struct Foo { - <|> + $0 pub f: i32, } "#, @@ -578,7 +578,7 @@ struct Foo { } fn foo() { Foo { - <|> + $0 } } "#, @@ -595,7 +595,7 @@ struct Foo { } fn foo() { Foo { - f: <|> + f: $0 } } "#, diff --git a/crates/completion/src/completions/macro_in_item_position.rs b/crates/completion/src/completions/macro_in_item_position.rs index 82884a181..2be299ac2 100644 --- a/crates/completion/src/completions/macro_in_item_position.rs +++ b/crates/completion/src/completions/macro_in_item_position.rs @@ -31,7 +31,7 @@ mod tests { macro_rules! foo { () => {} } fn foo() {} -<|> +$0 "#, expect![[r#" ma foo!(…) macro_rules! foo diff --git a/crates/completion/src/completions/mod_.rs b/crates/completion/src/completions/mod_.rs index f77864b77..8c8eaeaa6 100644 --- a/crates/completion/src/completions/mod_.rs +++ b/crates/completion/src/completions/mod_.rs @@ -9,7 +9,7 @@ use crate::{CompletionItem, CompletionItemKind}; use crate::{context::CompletionContext, item::CompletionKind, Completions}; -/// Complete mod declaration, i.e. `mod <|> ;` +/// Complete mod declaration, i.e. `mod $0 ;` pub(crate) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { let mod_under_caret = match &ctx.mod_declaration_under_caret { Some(mod_under_caret) if mod_under_caret.item_list().is_some() => return None, @@ -159,7 +159,7 @@ mod tests { check( r#" //- /lib.rs - mod <|> + mod $0 //- /foo.rs fn foo() {} //- /foo/ignored_foo.rs @@ -181,7 +181,7 @@ mod tests { check( r#" //- /lib.rs - mod <|> { + mod $0 { } //- /foo.rs @@ -196,7 +196,7 @@ mod tests { check( r#" //- /main.rs - mod <|> + mod $0 //- /foo.rs fn foo() {} //- /foo/ignored_foo.rs @@ -219,7 +219,7 @@ mod tests { r#" //- /main.rs mod tests { - mod <|>; + mod $0; } //- /tests/foo.rs fn foo() {} @@ -237,7 +237,7 @@ mod tests { //- /lib.rs mod foo; //- /foo.rs - mod <|>; + mod $0; //- /foo/bar.rs fn bar() {} //- /foo/bar/ignored_bar.rs @@ -262,7 +262,7 @@ mod tests { mod foo; //- /foo.rs mod bar { - mod <|> + mod $0 } //- /foo/bar/baz.rs fn baz() {} @@ -288,7 +288,7 @@ mod tests { // //- /src/bin.rs // fn main() {} // //- /src/bin/foo.rs - // mod <|> + // mod $0 // //- /src/bin/bar.rs // fn bar() {} // //- /src/bin/bar/bar_ignored.rs @@ -307,7 +307,7 @@ mod tests { //- /src/bin.rs crate:main fn main() {} //- /src/bin/foo.rs - mod <|> + mod $0 //- /src/bin/bar.rs mod foo; fn bar() {} diff --git a/crates/completion/src/completions/pattern.rs b/crates/completion/src/completions/pattern.rs index eee31098d..595160ff5 100644 --- a/crates/completion/src/completions/pattern.rs +++ b/crates/completion/src/completions/pattern.rs @@ -71,7 +71,7 @@ static FOO: E = E::X; struct Bar { f: u32 } fn foo() { - match E::X { <|> } + match E::X { $0 } } "#, expect![[r#" @@ -92,7 +92,7 @@ macro_rules! m { ($e:expr) => { $e } } enum E { X } fn foo() { - m!(match E::X { <|> }) + m!(match E::X { $0 }) } "#, expect![[r#" @@ -115,7 +115,7 @@ static FOO: E = E::X; struct Bar { f: u32 } fn foo() { - let <|> + let $0 } "#, expect![[r#" @@ -133,7 +133,7 @@ enum E { X } static FOO: E = E::X; struct Bar { f: u32 } -fn foo(<|>) { +fn foo($0) { } "#, expect![[r#" @@ -149,7 +149,7 @@ fn foo(<|>) { struct Bar { f: u32 } fn foo() { - let <|> + let $0 } "#, expect![[r#" @@ -165,7 +165,7 @@ fn foo() { struct Foo { bar: String, baz: String } struct Bar(String, String); struct Baz; -fn outer(<|>) {} +fn outer($0) {} "#, expect![[r#" bn Foo Foo { bar$1, baz$2 }: Foo$0 @@ -182,7 +182,7 @@ struct Foo { bar: String, baz: String } struct Bar(String, String); struct Baz; fn outer() { - let <|> + let $0 } "#, expect![[r#" @@ -201,7 +201,7 @@ struct Bar(String, String); struct Baz; fn outer() { match () { - <|> + $0 } } "#, @@ -225,7 +225,7 @@ use foo::*; fn outer() { match () { - <|> + $0 } } "#, @@ -244,7 +244,7 @@ fn outer() { struct Foo(i32); fn main() { match Foo(92) { - <|>(92) => (), + $0(92) => (), } } "#, diff --git a/crates/completion/src/completions/postfix.rs b/crates/completion/src/completions/postfix.rs index 4888f518a..87f0c0b2a 100644 --- a/crates/completion/src/completions/postfix.rs +++ b/crates/completion/src/completions/postfix.rs @@ -1,4 +1,4 @@ -//! Postfix completions, like `Ok(10).ifl<|>` => `if let Ok() = Ok(10) { <|> }`. +//! Postfix completions, like `Ok(10).ifl$0` => `if let Ok() = Ok(10) { $0 }`. mod format_like; @@ -310,7 +310,7 @@ mod tests { r#" fn main() { let bar = true; - bar.<|> + bar.$0 } "#, expect![[r#" @@ -342,7 +342,7 @@ fn foo(elt: bool) -> bool { fn main() { let bar = true; - foo(bar.<|>) + foo(bar.$0) } "#, expect![[r#" @@ -368,7 +368,7 @@ fn main() { r#" fn main() { let bar: u8 = 12; - bar.<|> + bar.$0 } "#, expect![[r#" @@ -392,7 +392,7 @@ fn main() { check( r#" fn main() { - baz.l<|> + baz.l$0 res } "#, @@ -424,7 +424,7 @@ enum Option { Some(T), None } fn main() { let bar = Option::Some(true); - bar.<|> + bar.$0 } "#, r#" @@ -449,7 +449,7 @@ enum Result { Ok(T), Err(E) } fn main() { let bar = Result::Ok(true); - bar.<|> + bar.$0 } "#, r#" @@ -468,7 +468,7 @@ fn main() { #[test] fn postfix_completion_works_for_ambiguous_float_literal() { - check_edit("refm", r#"fn main() { 42.<|> }"#, r#"fn main() { &mut 42 }"#) + check_edit("refm", r#"fn main() { 42.$0 }"#, r#"fn main() { &mut 42 }"#) } #[test] @@ -479,7 +479,7 @@ fn main() { macro_rules! m { ($e:expr) => { $e } } fn main() { let bar: u8 = 12; - m!(bar.d<|>) + m!(bar.d$0) } "#, r#" @@ -494,55 +494,47 @@ fn main() { #[test] fn postfix_completion_for_references() { - check_edit("dbg", r#"fn main() { &&42.<|> }"#, r#"fn main() { dbg!(&&42) }"#); - check_edit("refm", r#"fn main() { &&42.<|> }"#, r#"fn main() { &&&mut 42 }"#); + check_edit("dbg", r#"fn main() { &&42.$0 }"#, r#"fn main() { dbg!(&&42) }"#); + check_edit("refm", r#"fn main() { &&42.$0 }"#, r#"fn main() { &&&mut 42 }"#); } #[test] fn postfix_completion_for_format_like_strings() { check_edit( "format", - r#"fn main() { "{some_var:?}".<|> }"#, + r#"fn main() { "{some_var:?}".$0 }"#, r#"fn main() { format!("{:?}", some_var) }"#, ); check_edit( "panic", - r#"fn main() { "Panic with {a}".<|> }"#, + r#"fn main() { "Panic with {a}".$0 }"#, r#"fn main() { panic!("Panic with {}", a) }"#, ); check_edit( "println", - r#"fn main() { "{ 2+2 } { SomeStruct { val: 1, other: 32 } :?}".<|> }"#, + r#"fn main() { "{ 2+2 } { SomeStruct { val: 1, other: 32 } :?}".$0 }"#, r#"fn main() { println!("{} {:?}", 2+2, SomeStruct { val: 1, other: 32 }) }"#, ); check_edit( "loge", - r#"fn main() { "{2+2}".<|> }"#, + r#"fn main() { "{2+2}".$0 }"#, r#"fn main() { log::error!("{}", 2+2) }"#, ); check_edit( "logt", - r#"fn main() { "{2+2}".<|> }"#, + r#"fn main() { "{2+2}".$0 }"#, r#"fn main() { log::trace!("{}", 2+2) }"#, ); check_edit( "logd", - r#"fn main() { "{2+2}".<|> }"#, + r#"fn main() { "{2+2}".$0 }"#, r#"fn main() { log::debug!("{}", 2+2) }"#, ); - check_edit( - "logi", - r#"fn main() { "{2+2}".<|> }"#, - r#"fn main() { log::info!("{}", 2+2) }"#, - ); - check_edit( - "logw", - r#"fn main() { "{2+2}".<|> }"#, - r#"fn main() { log::warn!("{}", 2+2) }"#, - ); + check_edit("logi", r#"fn main() { "{2+2}".$0 }"#, r#"fn main() { log::info!("{}", 2+2) }"#); + check_edit("logw", r#"fn main() { "{2+2}".$0 }"#, r#"fn main() { log::warn!("{}", 2+2) }"#); check_edit( "loge", - r#"fn main() { "{2+2}".<|> }"#, + r#"fn main() { "{2+2}".$0 }"#, r#"fn main() { log::error!("{}", 2+2) }"#, ); } diff --git a/crates/completion/src/completions/qualified_path.rs b/crates/completion/src/completions/qualified_path.rs index 882c4dcbc..fa9e6e810 100644 --- a/crates/completion/src/completions/qualified_path.rs +++ b/crates/completion/src/completions/qualified_path.rs @@ -1,4 +1,4 @@ -//! Completion of paths, i.e. `some::prefix::<|>`. +//! Completion of paths, i.e. `some::prefix::$0`. use hir::{Adt, HasVisibility, PathResolution, ScopeDef}; use rustc_hash::FxHashSet; @@ -38,7 +38,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon if let ScopeDef::Unknown = def { if let Some(name_ref) = ctx.name_ref_syntax.as_ref() { if name_ref.syntax().text() == name.to_string().as_str() { - // for `use self::foo<|>`, don't suggest `foo` as a completion + // for `use self::foo$0`, don't suggest `foo` as a completion mark::hit!(dont_complete_current_use); continue; } @@ -173,7 +173,7 @@ mod tests { #[test] fn dont_complete_current_use() { mark::check!(dont_complete_current_use); - check(r#"use self::foo<|>;"#, expect![[""]]); + check(r#"use self::foo$0;"#, expect![[""]]); } #[test] @@ -181,7 +181,7 @@ mod tests { check( r#" mod foo { pub struct S; } -use self::{foo::*, bar<|>}; +use self::{foo::*, bar$0}; "#, expect![[r#" st S @@ -192,18 +192,18 @@ use self::{foo::*, bar<|>}; #[test] fn dont_complete_primitive_in_use() { - check_builtin(r#"use self::<|>;"#, expect![[""]]); + check_builtin(r#"use self::$0;"#, expect![[""]]); } #[test] fn dont_complete_primitive_in_module_scope() { - check_builtin(r#"fn foo() { self::<|> }"#, expect![[""]]); + check_builtin(r#"fn foo() { self::$0 }"#, expect![[""]]); } #[test] fn completes_primitives() { check_builtin( - r#"fn main() { let _: <|> = 92; }"#, + r#"fn main() { let _: $0 = 92; }"#, expect![[r#" bt u32 bt bool @@ -230,7 +230,7 @@ use self::{foo::*, bar<|>}; fn completes_mod_with_same_name_as_function() { check( r#" -use self::my::<|>; +use self::my::$0; mod my { pub struct Bar; } fn my() {} @@ -245,7 +245,7 @@ fn my() {} fn filters_visibility() { check( r#" -use self::my::<|>; +use self::my::$0; mod my { struct Bar; @@ -264,7 +264,7 @@ mod my { fn completes_use_item_starting_with_self() { check( r#" -use self::m::<|>; +use self::m::$0; mod m { pub struct Bar; } "#, @@ -282,7 +282,7 @@ mod m { pub struct Bar; } mod foo; struct Spam; //- /foo.rs -use crate::Sp<|> +use crate::Sp$0 "#, expect![[r#" md foo @@ -299,7 +299,7 @@ use crate::Sp<|> mod foo; struct Spam; //- /foo.rs -use crate::{Sp<|>}; +use crate::{Sp$0}; "#, expect![[r#" md foo @@ -320,7 +320,7 @@ pub mod bar { } } //- /foo.rs -use crate::{bar::{baz::Sp<|>}}; +use crate::{bar::{baz::Sp$0}}; "#, expect![[r#" st Spam @@ -333,7 +333,7 @@ use crate::{bar::{baz::Sp<|>}}; check( r#" enum E { Foo, Bar(i32) } -fn foo() { let _ = E::<|> } +fn foo() { let _ = E::$0 } "#, expect![[r#" ev Foo () @@ -356,7 +356,7 @@ impl S { type T = i32; } -fn foo() { let _ = S::<|> } +fn foo() { let _ = S::$0 } "#, expect![[r#" fn a() fn a() @@ -384,7 +384,7 @@ mod m { } } -fn foo() { let _ = S::<|> } +fn foo() { let _ = S::$0 } "#, expect![[r#" fn public_method() pub(crate) fn public_method() @@ -401,7 +401,7 @@ fn foo() { let _ = S::<|> } enum E {}; impl E { fn m() { } } -fn foo() { let _ = E::<|> } +fn foo() { let _ = E::$0 } "#, expect![[r#" fn m() fn m() @@ -416,7 +416,7 @@ fn foo() { let _ = E::<|> } union U {}; impl U { fn m() { } } -fn foo() { let _ = U::<|> } +fn foo() { let _ = U::$0 } "#, expect![[r#" fn m() fn m() @@ -429,7 +429,7 @@ fn foo() { let _ = U::<|> } check( r#" //- /main.rs crate:main deps:foo -use foo::<|>; +use foo::$0; //- /foo/lib.rs crate:foo pub mod bar { pub struct S; } @@ -446,7 +446,7 @@ pub mod bar { pub struct S; } r#" trait Trait { fn m(); } -fn foo() { let _ = Trait::<|> } +fn foo() { let _ = Trait::$0 } "#, expect![[r#" fn m() fn m() @@ -463,7 +463,7 @@ trait Trait { fn m(); } struct S; impl Trait for S {} -fn foo() { let _ = S::<|> } +fn foo() { let _ = S::$0 } "#, expect![[r#" fn m() fn m() @@ -480,7 +480,7 @@ trait Trait { fn m(); } struct S; impl Trait for S {} -fn foo() { let _ = ::<|> } +fn foo() { let _ = ::$0 } "#, expect![[r#" fn m() fn m() @@ -506,7 +506,7 @@ trait Sub: Super { fn submethod(&self) {} } -fn foo() { T::<|> } +fn foo() { T::$0 } "#, expect![[r#" ta SubTy type SubTy; @@ -544,7 +544,7 @@ impl Super for Wrap {} impl Sub for Wrap { fn subfunc() { // Should be able to assume `Self: Sub + Super` - Self::<|> + Self::$0 } } "#, @@ -570,7 +570,7 @@ impl S { fn foo() {} } type T = S; impl T { fn bar() {} } -fn main() { T::<|>; } +fn main() { T::$0; } "#, expect![[r#" fn foo() fn foo() @@ -586,7 +586,7 @@ fn main() { T::<|>; } #[macro_export] macro_rules! foo { () => {} } -fn main() { let _ = crate::<|> } +fn main() { let _ = crate::$0 } "#, expect![[r##" fn main() fn main() @@ -604,7 +604,7 @@ mod a { const A: usize = 0; mod b { const B: usize = 0; - mod c { use super::super::<|> } + mod c { use super::super::$0 } } } "#, @@ -619,7 +619,7 @@ mod a { fn completes_reexported_items_under_correct_name() { check( r#" -fn foo() { self::m::<|> } +fn foo() { self::m::$0 } mod m { pub use super::p::wrong_fn as right_fn; @@ -642,7 +642,7 @@ mod p { check_edit( "RightType", r#" -fn foo() { self::m::<|> } +fn foo() { self::m::$0 } mod m { pub use super::p::wrong_fn as right_fn; @@ -677,7 +677,7 @@ mod p { check( r#" macro_rules! m { ($e:expr) => { $e } } -fn main() { m!(self::f<|>); } +fn main() { m!(self::f$0); } fn foo() {} "#, expect![[r#" @@ -691,7 +691,7 @@ fn foo() {} fn function_mod_share_name() { check( r#" -fn foo() { self::m::<|> } +fn foo() { self::m::$0 } mod m { pub mod z {} @@ -716,7 +716,7 @@ impl HashMap { pub fn new() -> HashMap { } } fn foo() { - HashMap::<|> + HashMap::$0 } "#, expect![[r#" @@ -730,7 +730,7 @@ fn foo() { check( r#" mod foo { pub struct Foo; } -#[foo::<|>] +#[foo::$0] fn f() {} "#, expect![[""]], @@ -749,7 +749,7 @@ fn foo( } fn main() { - fo<|> + fo$0 } "#, expect![[r#" @@ -770,7 +770,7 @@ enum Foo { impl Foo { fn foo(self) { - Self::<|> + Self::$0 } } "#, diff --git a/crates/completion/src/completions/record.rs b/crates/completion/src/completions/record.rs index e58b9a274..bb6354ded 100644 --- a/crates/completion/src/completions/record.rs +++ b/crates/completion/src/completions/record.rs @@ -99,7 +99,7 @@ impl core::default::Default for S { fn process(f: S) { let other = S { foo: 5, - .<|> + .$0 }; } "#; @@ -139,7 +139,7 @@ impl core::default::Default for S { fn process(f: S) { let other = S { foo: 5, - .<|> + .$0 }; } "#, @@ -173,7 +173,7 @@ struct S { foo: u32, bar: usize } fn process(f: S) { let other = S { foo: 5, - .<|> + .$0 }; } "#; @@ -201,7 +201,7 @@ struct S { foo: u32 } fn process(f: S) { match f { - S { f<|>: 92 } => (), + S { f$0: 92 } => (), } } "#, @@ -219,7 +219,7 @@ enum E { S { foo: u32, bar: () } } fn process(e: E) { match e { - E::S { <|> } => (), + E::S { $0 } => (), } } "#, @@ -239,7 +239,7 @@ struct S { foo: u32 } fn process(f: S) { m!(match f { - S { f<|>: 92 } => (), + S { f$0: 92 } => (), }) } ", @@ -263,7 +263,7 @@ fn main() { foo1: 1, foo2: 2, bar: 3, baz: 4, }; - if let S { foo1, foo2: a, <|> } = s {} + if let S { foo1, foo2: a, $0 } = s {} } "#, expect![[r#" @@ -279,7 +279,7 @@ fn main() { r#" struct A { the_field: u32 } fn foo() { - A { the<|> } + A { the$0 } } "#, expect![[r#" @@ -294,7 +294,7 @@ fn foo() { r#" enum E { A { a: u32 } } fn foo() { - let _ = E::A { <|> } + let _ = E::A { $0 } } "#, expect![[r#" @@ -311,7 +311,7 @@ struct A { a: u32 } struct B { b: u32 } fn foo() { - let _: A = B { <|> } + let _: A = B { $0 } } "#, expect![[r#" @@ -327,7 +327,7 @@ fn foo() { struct A { a: T } fn foo() { - let _: A = A { <|> } + let _: A = A { $0 } } "#, expect![[r#" @@ -343,7 +343,7 @@ fn foo() { macro_rules! m { ($e:expr) => { $e } } struct A { the_field: u32 } fn foo() { - m!(A { the<|> }) + m!(A { the$0 }) } "#, expect![[r#" @@ -363,7 +363,7 @@ struct S { fn main() { let foo1 = 1; - let s = S { foo1, foo2: 5, <|> } + let s = S { foo1, foo2: 5, $0 } } "#, expect![[r#" @@ -381,7 +381,7 @@ struct S { foo1: u32, foo2: u32 } fn main() { let foo1 = 1; - let s = S { foo1, <|> .. loop {} } + let s = S { foo1, $0 .. loop {} } } "#, expect![[r#" diff --git a/crates/completion/src/completions/snippet.rs b/crates/completion/src/completions/snippet.rs index b5e704696..df17a15c5 100644 --- a/crates/completion/src/completions/snippet.rs +++ b/crates/completion/src/completions/snippet.rs @@ -83,7 +83,7 @@ mod tests { #[test] fn completes_snippets_in_expressions() { check( - r#"fn foo(x: i32) { <|> }"#, + r#"fn foo(x: i32) { $0 }"#, expect![[r#" sn pd sn ppd @@ -93,8 +93,8 @@ mod tests { #[test] fn should_not_complete_snippets_in_path() { - check(r#"fn foo(x: i32) { ::foo<|> }"#, expect![[""]]); - check(r#"fn foo(x: i32) { ::<|> }"#, expect![[""]]); + check(r#"fn foo(x: i32) { ::foo$0 }"#, expect![[""]]); + check(r#"fn foo(x: i32) { ::$0 }"#, expect![[""]]); } #[test] @@ -103,7 +103,7 @@ mod tests { r#" #[cfg(test)] mod tests { - <|> + $0 } "#, expect![[r#" diff --git a/crates/completion/src/completions/trait_impl.rs b/crates/completion/src/completions/trait_impl.rs index 54bb897e9..aa9c845da 100644 --- a/crates/completion/src/completions/trait_impl.rs +++ b/crates/completion/src/completions/trait_impl.rs @@ -15,7 +15,7 @@ //! } //! //! impl SomeTrait for () { -//! fn f<|> +//! fn f$0 //! } //! ``` //! @@ -27,7 +27,7 @@ //! # } //! //! impl SomeTrait for () { -//! fn foo() {}<|> +//! fn foo() {}$0 //! } //! ``` @@ -82,7 +82,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext fn completion_match(ctx: &CompletionContext) -> Option<(ImplCompletionKind, SyntaxNode, Impl)> { let mut token = ctx.token.clone(); - // For keywork without name like `impl .. { fn <|> }`, the current position is inside + // For keywork without name like `impl .. { fn $0 }`, the current position is inside // the whitespace token, which is outside `FN` syntax node. // We need to follow the previous token in this case. if token.kind() == SyntaxKind::WHITESPACE { @@ -90,20 +90,20 @@ fn completion_match(ctx: &CompletionContext) -> Option<(ImplCompletionKind, Synt } let impl_item_offset = match token.kind() { - // `impl .. { const <|> }` + // `impl .. { const $0 }` // ERROR 0 // CONST_KW <- * SyntaxKind::CONST_KW => 0, - // `impl .. { fn/type <|> }` + // `impl .. { fn/type $0 }` // FN/TYPE_ALIAS 0 // FN_KW <- * SyntaxKind::FN_KW | SyntaxKind::TYPE_KW => 0, - // `impl .. { fn/type/const foo<|> }` + // `impl .. { fn/type/const foo$0 }` // FN/TYPE_ALIAS/CONST 1 // NAME 0 // IDENT <- * SyntaxKind::IDENT if token.parent().kind() == SyntaxKind::NAME => 1, - // `impl .. { foo<|> }` + // `impl .. { foo$0 }` // MACRO_CALL 3 // PATH 2 // PATH_SEGMENT 1 @@ -120,7 +120,7 @@ fn completion_match(ctx: &CompletionContext) -> Option<(ImplCompletionKind, Synt // let impl_def = ast::Impl::cast(impl_item.parent()?.parent()?)?; let kind = match impl_item.kind() { - // `impl ... { const <|> fn/type/const }` + // `impl ... { const $0 fn/type/const }` _ if token.kind() == SyntaxKind::CONST_KW => ImplCompletionKind::Const, SyntaxKind::CONST | SyntaxKind::ERROR => ImplCompletionKind::Const, SyntaxKind::TYPE_ALIAS => ImplCompletionKind::TypeAlias, @@ -267,7 +267,7 @@ trait Test { struct T; impl Test for T { - t<|> + t$0 } "#, expect![[" @@ -287,7 +287,7 @@ struct T; impl Test for T { fn test() { - t<|> + t$0 } } ", @@ -301,7 +301,7 @@ struct T; impl Test for T { fn test() { - fn t<|> + fn t$0 } } ", @@ -315,7 +315,7 @@ struct T; impl Test for T { fn test() { - fn <|> + fn $0 } } ", @@ -330,7 +330,7 @@ struct T; impl Test for T { fn test() { - foo.<|> + foo.$0 } } ", @@ -343,7 +343,7 @@ trait Test { fn test(_: i32); fn test2(); } struct T; impl Test for T { - fn test(t<|>) + fn test(t$0) } ", expect![[""]], @@ -355,7 +355,7 @@ trait Test { fn test(_: fn()); fn test2(); } struct T; impl Test for T { - fn test(f: fn <|>) + fn test(f: fn $0) } ", expect![[""]], @@ -370,7 +370,7 @@ trait Test { const TEST: fn(); const TEST2: u32; type Test; fn test(); } struct T; impl Test for T { - const TEST: fn <|> + const TEST: fn $0 } ", expect![[""]], @@ -382,7 +382,7 @@ trait Test { const TEST: u32; const TEST2: u32; type Test; fn test(); } struct T; impl Test for T { - const TEST: T<|> + const TEST: T$0 } ", expect![[""]], @@ -394,7 +394,7 @@ trait Test { const TEST: u32; const TEST2: u32; type Test; fn test(); } struct T; impl Test for T { - const TEST: u32 = f<|> + const TEST: u32 = f$0 } ", expect![[""]], @@ -407,7 +407,7 @@ struct T; impl Test for T { const TEST: u32 = { - t<|> + t$0 }; } ", @@ -421,7 +421,7 @@ struct T; impl Test for T { const TEST: u32 = { - fn <|> + fn $0 }; } ", @@ -435,7 +435,7 @@ struct T; impl Test for T { const TEST: u32 = { - fn t<|> + fn t$0 }; } ", @@ -451,7 +451,7 @@ trait Test { type Test; type Test2; fn test(); } struct T; impl Test for T { - type Test = T<|>; + type Test = T$0; } ", expect![[""]], @@ -463,7 +463,7 @@ trait Test { type Test; type Test2; fn test(); } struct T; impl Test for T { - type Test = fn <|>; + type Test = fn $0; } ", expect![[""]], @@ -481,7 +481,7 @@ trait Test { struct T; impl Test for T { - t<|> + t$0 } "#, r#" @@ -510,7 +510,7 @@ trait Test { struct T; impl Test for T { - fn t<|> + fn t$0 } "#, r#" @@ -540,7 +540,7 @@ struct T; impl Test for T { fn foo() {} - fn f<|> + fn f$0 } "#, expect![[r#" @@ -560,7 +560,7 @@ trait Test { struct T; impl Test for T { - fn f<|> + fn f$0 } "#, r#" @@ -585,7 +585,7 @@ trait Test { struct T; impl Test for T { - fn f<|> + fn f$0 } "#, r#" @@ -614,7 +614,7 @@ trait Test { } impl Test for () { - type S<|> + type S$0 } "#, " @@ -639,7 +639,7 @@ trait Test { } impl Test for () { - const S<|> + const S$0 } "#, " @@ -661,7 +661,7 @@ trait Test { } impl Test for () { - const S<|> + const S$0 } "#, " @@ -724,7 +724,7 @@ impl Test for T {{ // Enumerate some possible next siblings. for next_sibling in &[ "", - "fn other_fn() {}", // `const <|> fn` -> `const fn` + "fn other_fn() {}", // `const $0 fn` -> `const fn` "type OtherType = i32;", "const OTHER_CONST: i32 = 0;", "async fn other_fn() {}", @@ -733,9 +733,9 @@ impl Test for T {{ "default type OtherType = i32;", "default const OTHER_CONST: i32 = 0;", ] { - test("bar", "fn <|>", "fn bar() {\n $0\n}", next_sibling); - test("Foo", "type <|>", "type Foo = ", next_sibling); - test("CONST", "const <|>", "const CONST: u16 = ", next_sibling); + test("bar", "fn $0", "fn bar() {\n $0\n}", next_sibling); + test("Foo", "type $0", "type Foo = ", next_sibling); + test("CONST", "const $0", "const CONST: u16 = ", next_sibling); } } } diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs index 2da21b5c2..12cdb869d 100644 --- a/crates/completion/src/completions/unqualified_path.rs +++ b/crates/completion/src/completions/unqualified_path.rs @@ -85,7 +85,7 @@ fn complete_enum_variants(acc: &mut Completions, ctx: &CompletionContext, ty: &T // // ``` // fn main() { -// pda<|> +// pda$0 // } // # pub mod std { pub mod marker { pub struct PhantomData { } } } // ``` @@ -212,7 +212,7 @@ mod tests { mark::check!(self_fulfilling_completion); check( r#" -use foo<|> +use foo$0 use std::collections; "#, expect![[r#" @@ -229,7 +229,7 @@ enum Enum { A, B } fn quux(x: Option) { match x { None => (), - Some(en<|> @ Enum::A) => (), + Some(en$0 @ Enum::A) => (), } } "#, @@ -245,7 +245,7 @@ enum Enum { A, B } fn quux(x: Option) { match x { None => (), - Some(ref en<|>) => (), + Some(ref en$0) => (), } } "#, @@ -261,7 +261,7 @@ enum Enum { A, B } fn quux(x: Option) { match x { None => (), - Some(En<|>) => (), + Some(En$0) => (), } } "#, @@ -277,7 +277,7 @@ fn quux(x: Option) { r#" fn quux(x: i32) { let y = 92; - 1 + <|>; + 1 + $0; let z = (); } "#, @@ -299,7 +299,7 @@ fn quux() { }; if let Some(a) = bar() { let b = 62; - 1 + <|> + 1 + $0 } } "#, @@ -316,7 +316,7 @@ fn quux() { check( r#" fn quux() { - for x in &[1, 2, 3] { <|> } + for x in &[1, 2, 3] { $0 } } "#, expect![[r#" @@ -334,7 +334,7 @@ fn quux() { r#" fn main() { let wherewolf = 92; - drop(where<|>) + drop(where$0) } "#, r#" @@ -349,7 +349,7 @@ fn main() { #[test] fn completes_generic_params() { check( - r#"fn quux() { <|> }"#, + r#"fn quux() { $0 }"#, expect![[r#" tp T fn quux() fn quux() @@ -360,7 +360,7 @@ fn main() { #[test] fn completes_generic_params_in_struct() { check( - r#"struct S { x: <|>}"#, + r#"struct S { x: $0}"#, expect![[r#" tp Self tp T @@ -372,7 +372,7 @@ fn main() { #[test] fn completes_self_in_enum() { check( - r#"enum X { Y(<|>) }"#, + r#"enum X { Y($0) }"#, expect![[r#" tp Self en X @@ -386,7 +386,7 @@ fn main() { r#" struct S; enum E {} -fn quux() { <|> } +fn quux() { $0 } "#, expect![[r#" st S @@ -403,7 +403,7 @@ fn quux() { <|> } "_alpha", r#" fn main() { - _<|> + _$0 } fn _alpha() {} "#, @@ -421,7 +421,7 @@ fn _alpha() {} check( r#" //- /lib.rs crate:main deps:other_crate -use <|>; +use $0; //- /other_crate/lib.rs crate:other_crate // nothing here @@ -439,7 +439,7 @@ use <|>; struct Foo; mod m { struct Bar; - fn quux() { <|> } + fn quux() { $0 } } "#, expect![[r#" @@ -454,7 +454,7 @@ mod m { check( r#" struct Foo; -fn x() -> <|> +fn x() -> $0 "#, expect![[r#" st Foo @@ -471,7 +471,7 @@ fn foo() { let bar = 92; { let bar = 62; - drop(<|>) + drop($0) } } "#, @@ -487,7 +487,7 @@ fn foo() { #[test] fn completes_self_in_methods() { check( - r#"impl S { fn foo(&self) { <|> } }"#, + r#"impl S { fn foo(&self) { $0 } }"#, expect![[r#" bn self &{unknown} tp Self @@ -500,7 +500,7 @@ fn foo() { check( r#" //- /main.rs crate:main deps:std -fn foo() { let x: <|> } +fn foo() { let x: $0 } //- /std/lib.rs crate:std #[prelude_import] @@ -521,7 +521,7 @@ mod prelude { struct Option; } check( r#" //- /main.rs crate:main deps:core,std -fn foo() { let x: <|> } +fn foo() { let x: $0 } //- /core/lib.rs crate:core #[prelude_import] @@ -562,7 +562,7 @@ mod m2 { macro_rules! baz { () => {} } } -fn main() { let v = <|> } +fn main() { let v = $0 } "#, expect![[r##" md m1 @@ -581,7 +581,7 @@ fn main() { let v = <|> } check( r#" macro_rules! foo { () => {} } -fn foo() { <|> } +fn foo() { $0 } "#, expect![[r#" fn foo() fn foo() @@ -595,7 +595,7 @@ fn foo() { <|> } check( r#" macro_rules! foo { () => {} } -fn main() { let x: <|> } +fn main() { let x: $0 } "#, expect![[r#" fn main() fn main() @@ -609,7 +609,7 @@ fn main() { let x: <|> } check( r#" macro_rules! foo { () => {} } -fn main() { <|> } +fn main() { $0 } "#, expect![[r#" fn main() fn main() @@ -623,7 +623,7 @@ fn main() { <|> } check( r#" fn main() { - return f<|>; + return f$0; fn frobnicate() {} } "#, @@ -641,7 +641,7 @@ fn main() { macro_rules! m { ($e:expr) => { $e } } fn quux(x: i32) { let y = 92; - m!(<|>); + m!($0); } "#, expect![[r#" @@ -660,7 +660,7 @@ fn quux(x: i32) { macro_rules! m { ($e:expr) => { $e } } fn quux(x: i32) { let y = 92; - m!(x<|>); + m!(x$0); } ", expect![[r#" @@ -679,7 +679,7 @@ fn quux(x: i32) { macro_rules! m { ($e:expr) => { $e } } fn quux(x: i32) { let y = 92; - m!(x<|> + m!(x$0 } "#, expect![[r#" @@ -697,7 +697,7 @@ fn quux(x: i32) { r#" use spam::Quux; -fn main() { <|> } +fn main() { $0 } "#, expect![[r#" fn main() fn main() @@ -714,7 +714,7 @@ enum Foo { Bar, Baz, Quux } fn main() { let foo = Foo::Quux; - match foo { Qu<|> } + match foo { Qu$0 } } "#, expect![[r#" @@ -734,7 +734,7 @@ enum Foo { Bar, Baz, Quux } fn main() { let foo = Foo::Quux; - match &foo { Qu<|> } + match &foo { Qu$0 } } "#, expect![[r#" @@ -754,7 +754,7 @@ enum Foo { Bar, Baz, Quux } fn main() { let foo = Foo::Quux; - if let Qu<|> = foo { } + if let Qu$0 = foo { } } "#, expect![[r#" @@ -771,7 +771,7 @@ fn main() { check( r#" enum Foo { Bar, Baz, Quux } -fn main() { let foo: Foo = Q<|> } +fn main() { let foo: Foo = Q$0 } "#, expect![[r#" ev Foo::Bar () @@ -788,7 +788,7 @@ fn main() { let foo: Foo = Q<|> } check( r#" mod m { pub enum E { V } } -fn f() -> m::E { V<|> } +fn f() -> m::E { V$0 } "#, expect![[r#" ev m::E::V () @@ -803,7 +803,7 @@ fn f() -> m::E { V<|> } check( r#" struct Foo; -#[<|>] +#[$0] fn f() {} "#, expect![[""]], @@ -817,7 +817,7 @@ fn f() {} trait MyTrait {} struct MyStruct {} -impl My<|> +impl My$0 "#, expect![[r#" tp Self @@ -840,7 +840,7 @@ pub mod io { //- /main.rs crate:main deps:dep fn main() { - stdi<|> + stdi$0 } "#, r#" @@ -868,7 +868,7 @@ macro_rules! macro_with_curlies { //- /main.rs crate:main deps:dep fn main() { - curli<|> + curli$0 } "#, r#" @@ -898,7 +898,7 @@ pub mod some_module { use dep::{FirstStruct, some_module::SecondStruct}; fn main() { - this<|> + this$0 } "#, r#" @@ -936,7 +936,7 @@ pub mod some_module { use dep::{FirstStruct, some_module::SecondStruct}; fn main() { - hir<|> + hir$0 } "#, expect![[r#" -- cgit v1.2.3