diff --git a/crates/ide-completion/src/completions/dot.rs b/crates/ide-completion/src/completions/dot.rs index f9df33d88b093..01a5f856c1b1f 100644 --- a/crates/ide-completion/src/completions/dot.rs +++ b/crates/ide-completion/src/completions/dot.rs @@ -190,9 +190,9 @@ pub mod m { fn foo(a: lib::m::A) { a.$0 } "#, expect![[r#" + fd crate_field u32 fd private_field u32 fd pub_field u32 - fd crate_field u32 fd super_field u32 "#]], ); @@ -248,8 +248,8 @@ mod m { fn foo(a: lib::A) { a.$0 } "#, expect![[r#" - me private_method() fn(&self) me crate_method() fn(&self) + me private_method() fn(&self) me pub_method() fn(&self) "#]], ); @@ -686,11 +686,11 @@ struct Foo { field: i32 } impl Foo { fn foo(&self) { $0 } }"#, expect![[r#" fd self.field i32 - me self.foo() fn(&self) lc self &Foo sp Self st Foo bt u32 + me self.foo() fn(&self) "#]], ); check( @@ -700,11 +700,11 @@ struct Foo(i32); impl Foo { fn foo(&mut self) { $0 } }"#, expect![[r#" fd self.0 i32 - me self.foo() fn(&mut self) lc self &mut Foo sp Self st Foo bt u32 + me self.foo() fn(&mut self) "#]], ); } diff --git a/crates/ide-completion/src/completions/keyword.rs b/crates/ide-completion/src/completions/keyword.rs index 51405e3523239..07cfad81d263f 100644 --- a/crates/ide-completion/src/completions/keyword.rs +++ b/crates/ide-completion/src/completions/keyword.rs @@ -205,8 +205,8 @@ mod tests { r"fn my_fn() { unsafe $0 }", expect![[r#" kw fn - kw trait kw impl + kw trait sn pd sn ppd "#]], @@ -225,15 +225,15 @@ fn foo(a: A) { a.$0 } "#, expect![[r#" kw await expr.await - sn ref &expr - sn refm &mut expr - sn match match expr {} sn box Box::new(expr) + sn call function(expr) sn dbg dbg!(expr) sn dbgr dbg!(&expr) - sn call function(expr) sn let let sn letm let mut + sn match match expr {} + sn ref &expr + sn refm &mut expr "#]], ); @@ -248,15 +248,15 @@ fn foo() { "#, expect![[r#" kw await expr.await - sn ref &expr - sn refm &mut expr - sn match match expr {} sn box Box::new(expr) + sn call function(expr) sn dbg dbg!(expr) sn dbgr dbg!(&expr) - sn call function(expr) sn let let sn letm let mut + sn match match expr {} + sn ref &expr + sn refm &mut expr "#]], ) } diff --git a/crates/ide-completion/src/completions/mod_.rs b/crates/ide-completion/src/completions/mod_.rs index cf7566bcc3cea..43b0da61a9bb2 100644 --- a/crates/ide-completion/src/completions/mod_.rs +++ b/crates/ide-completion/src/completions/mod_.rs @@ -182,8 +182,8 @@ fn bar() {} fn ignored_bar() {} "#, expect![[r#" - md foo; md bar; + md foo; "#]], ); } @@ -219,8 +219,8 @@ fn bar() {} fn ignored_bar() {} "#, expect![[r#" - md foo; md bar; + md foo; "#]], ); } @@ -346,8 +346,8 @@ fn bar() {} fn ignored_bar() {} "#, expect![[r#" - md foo; md bar; + md foo; "#]], ); } diff --git a/crates/ide-completion/src/completions/postfix.rs b/crates/ide-completion/src/completions/postfix.rs index 5bd69b0c1c3fe..7b936f0ff777f 100644 --- a/crates/ide-completion/src/completions/postfix.rs +++ b/crates/ide-completion/src/completions/postfix.rs @@ -309,18 +309,18 @@ fn main() { } "#, expect![[r#" - sn if if expr {} - sn while while expr {} - sn not !expr - sn ref &expr - sn refm &mut expr - sn match match expr {} sn box Box::new(expr) + sn call function(expr) sn dbg dbg!(expr) sn dbgr dbg!(&expr) - sn call function(expr) + sn if if expr {} sn let let sn letm let mut + sn match match expr {} + sn not !expr + sn ref &expr + sn refm &mut expr + sn while while expr {} "#]], ); } @@ -339,16 +339,16 @@ fn main() { } "#, expect![[r#" + sn box Box::new(expr) + sn call function(expr) + sn dbg dbg!(expr) + sn dbgr dbg!(&expr) sn if if expr {} - sn while while expr {} + sn match match expr {} sn not !expr sn ref &expr sn refm &mut expr - sn match match expr {} - sn box Box::new(expr) - sn dbg dbg!(expr) - sn dbgr dbg!(&expr) - sn call function(expr) + sn while while expr {} "#]], ); } @@ -363,15 +363,15 @@ fn main() { } "#, expect![[r#" - sn ref &expr - sn refm &mut expr - sn match match expr {} sn box Box::new(expr) + sn call function(expr) sn dbg dbg!(expr) sn dbgr dbg!(&expr) - sn call function(expr) sn let let sn letm let mut + sn match match expr {} + sn ref &expr + sn refm &mut expr "#]], ) } @@ -386,18 +386,18 @@ fn main() { } "#, expect![[r#" - sn if if expr {} - sn while while expr {} - sn not !expr - sn ref &expr - sn refm &mut expr - sn match match expr {} sn box Box::new(expr) + sn call function(expr) sn dbg dbg!(expr) sn dbgr dbg!(&expr) - sn call function(expr) + sn if if expr {} sn let let sn letm let mut + sn match match expr {} + sn not !expr + sn ref &expr + sn refm &mut expr + sn while while expr {} "#]], ); } diff --git a/crates/ide-completion/src/completions/qualified_path.rs b/crates/ide-completion/src/completions/qualified_path.rs index 2c2fe524ef9d9..ad92820bca9f4 100644 --- a/crates/ide-completion/src/completions/qualified_path.rs +++ b/crates/ide-completion/src/completions/qualified_path.rs @@ -249,8 +249,8 @@ impl S { fn foo() { let _ = lib::S::$0 } "#, expect![[r#" - fn public_method() fn() ct PUBLIC_CONST pub const PUBLIC_CONST: u32 + fn public_method() fn() ta PublicType pub type PublicType = u32 "#]], ); @@ -340,14 +340,14 @@ trait Sub: Super { fn foo() { T::$0 } "#, expect![[r#" - ta SubTy (as Sub) type SubTy - ta Ty (as Super) type Ty ct C2 (as Sub) const C2: () - fn subfunc() (as Sub) fn() - me submethod(…) (as Sub) fn(&self) ct CONST (as Super) const CONST: u8 fn func() (as Super) fn() + fn subfunc() (as Sub) fn() + ta SubTy (as Sub) type SubTy + ta Ty (as Super) type Ty me method(…) (as Super) fn(&self) + me submethod(…) (as Sub) fn(&self) "#]], ); } @@ -380,13 +380,13 @@ impl Sub for Wrap { } "#, expect![[r#" - ta SubTy (as Sub) type SubTy - ta Ty (as Super) type Ty + ct C2 (as Sub) const C2: () ct CONST (as Super) const CONST: u8 fn func() (as Super) fn() - me method(…) (as Super) fn(&self) - ct C2 (as Sub) const C2: () fn subfunc() (as Sub) fn() + ta SubTy (as Sub) type SubTy + ta Ty (as Super) type Ty + me method(…) (as Super) fn(&self) me submethod(…) (as Sub) fn(&self) "#]], ); @@ -404,8 +404,8 @@ impl T { fn bar() {} } fn main() { T::$0; } "#, expect![[r#" - fn foo() fn() fn bar() fn() + fn foo() fn() "#]], ); } @@ -518,8 +518,8 @@ fn main() { m!(self::f$0); } fn foo() {} "#, expect![[r#" - fn main() fn() fn foo() fn() + fn main() fn() "#]], ); } @@ -536,8 +536,8 @@ mod m { } "#, expect![[r#" - md z fn z() fn() + md z "#]], ); } diff --git a/crates/ide-completion/src/completions/trait_impl.rs b/crates/ide-completion/src/completions/trait_impl.rs index 43428f777f09c..80fbaffd71e63 100644 --- a/crates/ide-completion/src/completions/trait_impl.rs +++ b/crates/ide-completion/src/completions/trait_impl.rs @@ -343,8 +343,8 @@ impl Test for T { ", expect![[r#" sp Self - tt Test st T + tt Test bt u32 "#]], ); @@ -448,8 +448,8 @@ impl Test for T { ", expect![[r#" sp Self - tt Test st T + tt Test bt u32 "#]], ); @@ -465,8 +465,8 @@ impl Test for T { ", expect![[r#" sp Self - tt Test st T + tt Test bt u32 "#]], ); @@ -484,8 +484,8 @@ impl Test for T { ", expect![[r#" sp Self - tt Test st T + tt Test bt u32 "#]], ); @@ -532,8 +532,8 @@ impl Test for T { ", expect![[r#" sp Self - tt Test st T + tt Test bt u32 "#]], ); @@ -549,8 +549,8 @@ impl Test for T { ", expect![[r#" sp Self - tt Test st T + tt Test bt u32 "#]], ); diff --git a/crates/ide-completion/src/completions/unqualified_path.rs b/crates/ide-completion/src/completions/unqualified_path.rs index 53262ae267bc6..c4d4c5549e46c 100644 --- a/crates/ide-completion/src/completions/unqualified_path.rs +++ b/crates/ide-completion/src/completions/unqualified_path.rs @@ -176,8 +176,8 @@ pub mod prelude { "#, expect![[r#" md std - bt u32 st Option + bt u32 "#]], ); } @@ -233,10 +233,10 @@ pub mod prelude { } "#, expect![[r#" - md std md core - bt u32 + md std st String + bt u32 "#]], ); } diff --git a/crates/ide-completion/src/item.rs b/crates/ide-completion/src/item.rs index 29b073cfa52f1..fe1ad2bf82dd5 100644 --- a/crates/ide-completion/src/item.rs +++ b/crates/ide-completion/src/item.rs @@ -268,7 +268,7 @@ impl CompletionRelevance { } /// The type of the completion item. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub enum CompletionItemKind { SymbolKind(SymbolKind), Binding, diff --git a/crates/ide-completion/src/tests.rs b/crates/ide-completion/src/tests.rs index 470fc37ca73f1..5387b455f038b 100644 --- a/crates/ide-completion/src/tests.rs +++ b/crates/ide-completion/src/tests.rs @@ -98,6 +98,7 @@ fn completion_list_with_config( }) .filter(|it| include_keywords || it.kind() != CompletionItemKind::Keyword) .filter(|it| include_keywords || it.kind() != CompletionItemKind::Snippet) + .sorted_by_key(|it| (it.kind(), it.label().to_owned(), it.detail().map(ToOwned::to_owned))) .collect(); render_completion_list(items) } diff --git a/crates/ide-completion/src/tests/attribute.rs b/crates/ide-completion/src/tests/attribute.rs index b851bf6a840ed..664bd05e2de3d 100644 --- a/crates/ide-completion/src/tests/attribute.rs +++ b/crates/ide-completion/src/tests/attribute.rs @@ -17,25 +17,25 @@ fn proc_macros() { struct Foo; "#, expect![[r#" - md proc_macros - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated + at derive(…) at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) at must_use at no_mangle - at derive(…) - at repr(…) at non_exhaustive + at repr(…) + at warn(…) + md proc_macros + kw crate:: + kw self:: + kw super:: "#]], ) } @@ -77,15 +77,15 @@ fn with_existing_attr() { check( r#"#[no_mangle] #[$0] mcall!();"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) at forbid(…) at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ) } @@ -95,29 +95,29 @@ fn attr_on_source_file() { check( r#"#![$0]"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) + at crate_name = "" at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") - at must_use - at no_mangle - at crate_name = "" + at doc(hidden) at feature(…) + at forbid(…) + at must_use at no_implicit_prelude at no_main + at no_mangle at no_std at recursion_limit = "…" at type_length_limit = … + at warn(…) at windows_subsystem = "…" + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -127,44 +127,44 @@ fn attr_on_module() { check( r#"#[$0] mod foo;"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) + at macro_use at must_use at no_mangle - at macro_use at path = "…" + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); check( r#"mod foo {#![$0]}"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) at must_use - at no_mangle at no_implicit_prelude + at no_mangle + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -174,23 +174,23 @@ fn attr_on_macro_rules() { check( r#"#[$0] macro_rules! foo {}"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") - at must_use - at no_mangle + at doc(hidden) + at forbid(…) at macro_export at macro_use + at must_use + at no_mangle + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -200,21 +200,21 @@ fn attr_on_macro_def() { check( r#"#[$0] macro foo {}"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) at must_use at no_mangle + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -224,22 +224,22 @@ fn attr_on_extern_crate() { check( r#"#[$0] extern crate foo;"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) + at macro_use at must_use at no_mangle - at macro_use + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -249,21 +249,21 @@ fn attr_on_use() { check( r#"#[$0] use foo;"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) at must_use at no_mangle + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -273,21 +273,21 @@ fn attr_on_type_alias() { check( r#"#[$0] type foo = ();"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) at must_use at no_mangle + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -301,26 +301,26 @@ fn attr_on_struct() { struct Foo; "#, expect![[r#" - md core - at derive macro derive - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated + at derive macro derive + at derive(…) at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) at must_use at no_mangle - at derive(…) - at repr(…) at non_exhaustive + at repr(…) + at warn(…) + md core + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -330,24 +330,24 @@ fn attr_on_enum() { check( r#"#[$0] enum Foo {}"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated + at derive(…) at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) at must_use at no_mangle - at derive(…) - at repr(…) at non_exhaustive + at repr(…) + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -357,21 +357,21 @@ fn attr_on_const() { check( r#"#[$0] const FOO: () = ();"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) at must_use at no_mangle + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -381,26 +381,26 @@ fn attr_on_static() { check( r#"#[$0] static FOO: () = ()"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") - at must_use - at no_mangle + at doc(hidden) at export_name = "…" + at forbid(…) + at global_allocator at link_name = "…" at link_section = "…" - at global_allocator + at must_use + at no_mangle at used + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -410,22 +410,22 @@ fn attr_on_trait() { check( r#"#[$0] trait Foo {}"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) at must_use - at no_mangle at must_use + at no_mangle + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -435,42 +435,42 @@ fn attr_on_impl() { check( r#"#[$0] impl () {}"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) + at automatically_derived at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) at must_use at no_mangle - at automatically_derived + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); check( r#"impl () {#![$0]}"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) at must_use at no_mangle + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -480,43 +480,43 @@ fn attr_on_extern_block() { check( r#"#[$0] extern {}"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) + at link at must_use at no_mangle - at link + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); check( r#"extern {#![$0]}"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") + at doc(hidden) + at forbid(…) + at link at must_use at no_mangle - at link + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -526,16 +526,16 @@ fn attr_on_variant() { check( r#"enum Foo { #[$0] Bar }"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) at forbid(…) - at warn(…) at non_exhaustive + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -545,36 +545,36 @@ fn attr_on_fn() { check( r#"#[$0] fn main() {}"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) + at cold at deny(…) - at forbid(…) - at warn(…) at deprecated at doc = "…" - at doc(hidden) at doc(alias = "…") - at must_use - at no_mangle + at doc(hidden) at export_name = "…" - at link_name = "…" - at link_section = "…" - at cold + at forbid(…) at ignore = "…" at inline + at link_name = "…" + at link_section = "…" at must_use + at must_use + at no_mangle at panic_handler at proc_macro - at proc_macro_derive(…) at proc_macro_attribute + at proc_macro_derive(…) at should_panic at target_feature = "…" at test at track_caller + at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -585,15 +585,15 @@ fn attr_on_expr() { check( r#"fn main() { #[$0] foo() }"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at cfg(…) at cfg_attr(…) at deny(…) at forbid(…) at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -603,9 +603,6 @@ fn attr_in_source_file_end() { check( r#"#[$0]"#, expect![[r#" - kw self:: - kw super:: - kw crate:: at allow(…) at automatically_derived at cfg(…) @@ -642,6 +639,9 @@ fn attr_in_source_file_end() { at track_caller at used at warn(…) + kw crate:: + kw self:: + kw super:: "#]], ); } @@ -654,8 +654,8 @@ mod cfg { check( r#"#[cfg(target_endian = $0"#, expect![[r#" - ba little ba big + ba little "#]], ); } @@ -688,17 +688,17 @@ mod derive { #[derive($0)] struct Test; "#, expect![[r#" - md core - de Default macro Default + de Clone macro Clone de Clone, Copy + de Default macro Default de PartialEq macro PartialEq de PartialEq, Eq de PartialEq, Eq, PartialOrd, Ord - de Clone macro Clone de PartialEq, PartialOrd + md core + kw crate:: kw self:: kw super:: - kw crate:: "#]], ); } @@ -711,16 +711,16 @@ mod derive { #[derive(serde::Serialize, PartialEq, $0)] struct Test; "#, expect![[r#" - md core - de Default macro Default + de Clone macro Clone de Clone, Copy + de Default macro Default de Eq de Eq, PartialOrd, Ord - de Clone macro Clone de PartialOrd + md core + kw crate:: kw self:: kw super:: - kw crate:: "#]], ) } @@ -733,16 +733,16 @@ mod derive { #[derive($0 serde::Serialize, PartialEq)] struct Test; "#, expect![[r#" - md core - de Default macro Default + de Clone macro Clone de Clone, Copy + de Default macro Default de Eq de Eq, PartialOrd, Ord - de Clone macro Clone de PartialOrd + md core + kw crate:: kw self:: kw super:: - kw crate:: "#]], ); } @@ -755,15 +755,15 @@ mod derive { #[derive(PartialEq, Eq, Or$0)] struct Test; "#, expect![[r#" - md core - de Default macro Default - de Clone, Copy - de PartialOrd, Ord de Clone macro Clone + de Clone, Copy + de Default macro Default de PartialOrd + de PartialOrd, Ord + md core + kw crate:: kw self:: kw super:: - kw crate:: "#]], ); } @@ -777,12 +777,12 @@ mod derive { #[derive(der$0)] struct Test; "#, expect![[r#" - md proc_macros + de DeriveIdentity (use proc_macros::DeriveIdentity) proc_macro DeriveIdentity md core + md proc_macros + kw crate:: kw self:: kw super:: - kw crate:: - de DeriveIdentity (use proc_macros::DeriveIdentity) proc_macro DeriveIdentity "#]], ); check_derive( @@ -794,11 +794,11 @@ use proc_macros::DeriveIdentity; "#, expect![[r#" de DeriveIdentity proc_macro DeriveIdentity - md proc_macros md core + md proc_macros + kw crate:: kw self:: kw super:: - kw crate:: "#]], ); } @@ -953,22 +953,22 @@ mod repr { check_repr( r#"#[repr($0)] struct Test;"#, expect![[r#" + ba C ba align($0) + ba i16 + ba i28 + ba i32 + ba i64 + ba i8 + ba isize ba packed ba transparent - ba C - ba u8 + ba u128 ba u16 ba u32 ba u64 - ba u128 + ba u8 ba usize - ba i8 - ba i16 - ba i32 - ba i64 - ba i28 - ba isize "#]], ); } @@ -983,20 +983,20 @@ mod repr { check_repr( r#"#[repr(align(1), $0)] struct Test;"#, expect![[r#" - ba transparent ba C - ba u8 - ba u16 - ba u32 - ba u64 - ba u128 - ba usize - ba i8 ba i16 + ba i28 ba i32 ba i64 - ba i28 + ba i8 ba isize + ba transparent + ba u128 + ba u16 + ba u32 + ba u64 + ba u8 + ba usize "#]], ); } @@ -1006,20 +1006,20 @@ mod repr { check_repr( r#"#[repr(packed, $0)] struct Test;"#, expect![[r#" - ba transparent ba C - ba u8 - ba u16 - ba u32 - ba u64 - ba u128 - ba usize - ba i8 ba i16 + ba i28 ba i32 ba i64 - ba i28 + ba i8 ba isize + ba transparent + ba u128 + ba u16 + ba u32 + ba u64 + ba u8 + ba usize "#]], ); } @@ -1030,19 +1030,19 @@ mod repr { r#"#[repr(C, $0)] struct Test;"#, expect![[r#" ba align($0) + ba i16 + ba i28 + ba i32 + ba i64 + ba i8 + ba isize ba packed - ba u8 + ba u128 ba u16 ba u32 ba u64 - ba u128 + ba u8 ba usize - ba i8 - ba i16 - ba i32 - ba i64 - ba i28 - ba isize "#]], ); } @@ -1052,9 +1052,9 @@ mod repr { check_repr( r#"#[repr(usize, $0)] struct Test;"#, expect![[r#" + ba C ba align($0) ba packed - ba C "#]], ); } diff --git a/crates/ide-completion/src/tests/expression.rs b/crates/ide-completion/src/tests/expression.rs index 5984149046a65..a068d5bf7afdf 100644 --- a/crates/ide-completion/src/tests/expression.rs +++ b/crates/ide-completion/src/tests/expression.rs @@ -31,38 +31,38 @@ fn baz() { "#, // This should not contain `FooDesc {…}`. expect![[r#" - kw unsafe - kw match - kw while - kw while let - kw loop - kw if - kw if let - kw for - kw true - kw false - kw mut - kw return - kw self - kw super - kw crate - st FooDesc - fn create_foo(…) fn(&FooDesc) - bt u32 - tt Trait + ct CONST en Enum - st Record - st Tuple - md module fn baz() fn() - st Unit - md _69latrick - ma makro!(…) macro_rules! makro + fn create_foo(…) fn(&FooDesc) fn function() fn() + ma makro!(…) macro_rules! makro + md _69latrick + md module sc STATIC + st FooDesc + st Record + st Tuple + st Unit + tt Trait un Union ev TupleV(…) TupleV(u32) - ct CONST + bt u32 + kw crate + kw false + kw for + kw if + kw if let + kw loop + kw match + kw mut + kw return + kw self + kw super + kw true + kw unsafe + kw while + kw while let "#]], ) } @@ -83,28 +83,28 @@ fn func(param0 @ (param1, param2): (i32, i32)) { } "#, expect![[r#" - kw unsafe - kw match - kw while - kw while let - kw loop - kw if - kw if let - kw for - kw true - kw false - kw return - kw self - kw super - kw crate - lc matcharm i32 + fn func(…) fn((i32, i32)) lc ifletlocal i32 lc letlocal i32 + lc matcharm i32 lc param0 (i32, i32) lc param1 i32 lc param2 i32 - fn func(…) fn((i32, i32)) bt u32 + kw crate + kw false + kw for + kw if + kw if let + kw loop + kw match + kw return + kw self + kw super + kw true + kw unsafe + kw while + kw while let "#]], ); } @@ -126,57 +126,57 @@ impl Unit { "#, // `self` is in here twice, once as the module, once as the local expect![[r#" - me self.foo() fn(self) - kw unsafe - kw fn + ct CONST + cp CONST_PARAM + en Enum + fn function() fn() + fn local_func() fn() + lc self Unit + ma makro!(…) macro_rules! makro + md module + md qualified + sp Self + sc STATIC + st Record + st Tuple + st Unit + tt Trait + tp TypeParam + un Union + ev TupleV(…) TupleV(u32) + bt u32 kw const - kw type - kw impl + kw crate + kw enum kw extern - kw use - kw trait - kw static + kw false + kw fn + kw for + kw if + kw if let + kw impl + kw let + kw loop + kw match kw mod - kw enum + kw return + kw self + kw static kw struct + kw super + kw trait + kw true + kw type kw union - kw match + kw unsafe + kw use kw while kw while let - kw loop - kw if - kw if let - kw for - kw true - kw false - kw let - kw return + me self.foo() fn(self) + sn macro_rules sn pd sn ppd - sn macro_rules - kw self - kw super - kw crate - fn local_func() fn() - bt u32 - lc self Unit - tp TypeParam - cp CONST_PARAM - sp Self - tt Trait - en Enum - st Record - st Tuple - md module - st Unit - md qualified - ma makro!(…) macro_rules! makro ?? Unresolved - fn function() fn() - sc STATIC - un Union - ev TupleV(…) TupleV(u32) - ct CONST "#]], ); check( @@ -192,20 +192,20 @@ impl Unit { } "#, expect![[r#" - tt Trait + ct CONST en Enum - st Record - st Tuple + fn function() fn() + ma makro!(…) macro_rules! makro md module - st Unit md qualified - ma makro!(…) macro_rules! makro - ?? Unresolved - fn function() fn() sc STATIC + st Record + st Tuple + st Unit + tt Trait un Union ev TupleV(…) TupleV(u32) - ct CONST + ?? Unresolved "#]], ); } @@ -221,38 +221,38 @@ fn complete_in_block() { } "#, expect![[r#" - kw unsafe - kw fn + fn foo() fn() + bt u32 kw const - kw type - kw impl + kw crate + kw enum kw extern - kw use - kw trait - kw static + kw false + kw fn + kw for + kw if + kw if let + kw impl + kw let + kw loop + kw match kw mod - kw enum + kw return + kw self + kw static kw struct + kw super + kw trait + kw true + kw type kw union - kw match + kw unsafe + kw use kw while kw while let - kw loop - kw if - kw if let - kw for - kw true - kw false - kw let - kw return + sn macro_rules sn pd sn ppd - sn macro_rules - kw self - kw super - kw crate - fn foo() fn() - bt u32 "#]], ) } @@ -267,40 +267,40 @@ fn complete_after_if_expr() { } "#, expect![[r#" - kw unsafe - kw fn + fn foo() fn() + bt u32 kw const - kw type - kw impl + kw crate + kw else + kw else if + kw enum kw extern - kw use - kw trait - kw static + kw false + kw fn + kw for + kw if + kw if let + kw impl + kw let + kw loop + kw match kw mod - kw enum + kw return + kw self + kw static kw struct + kw super + kw trait + kw true + kw type kw union - kw match + kw unsafe + kw use kw while kw while let - kw loop - kw if - kw if let - kw for - kw true - kw false - kw let - kw else - kw else if - kw return + sn macro_rules sn pd sn ppd - sn macro_rules - kw self - kw super - kw crate - fn foo() fn() - bt u32 "#]], ) } @@ -316,22 +316,22 @@ fn complete_in_match_arm() { } "#, expect![[r#" - kw unsafe - kw match - kw while - kw while let - kw loop + fn foo() fn() + bt u32 + kw crate + kw false + kw for kw if kw if let - kw for - kw true - kw false + kw loop + kw match kw return kw self kw super - kw crate - fn foo() fn() - bt u32 + kw true + kw unsafe + kw while + kw while let "#]], ) } @@ -341,40 +341,40 @@ fn completes_in_loop_ctx() { check_empty( r"fn my() { loop { $0 } }", expect![[r#" - kw unsafe - kw fn + fn my() fn() + bt u32 + kw break kw const - kw type - kw impl + kw continue + kw crate + kw enum kw extern - kw use - kw trait - kw static + kw false + kw fn + kw for + kw if + kw if let + kw impl + kw let + kw loop + kw match kw mod - kw enum + kw return + kw self + kw static kw struct + kw super + kw trait + kw true + kw type kw union - kw match + kw unsafe + kw use kw while kw while let - kw loop - kw if - kw if let - kw for - kw true - kw false - kw let - kw continue - kw break - kw return + sn macro_rules sn pd sn ppd - sn macro_rules - kw self - kw super - kw crate - fn my() fn() - bt u32 "#]], ); } @@ -384,22 +384,22 @@ fn completes_in_let_initializer() { check_empty( r#"fn main() { let _ = $0 }"#, expect![[r#" - kw unsafe - kw match - kw while - kw while let - kw loop + fn main() fn() + bt u32 + kw crate + kw false + kw for kw if kw if let - kw for - kw true - kw false + kw loop + kw match kw return kw self kw super - kw crate - fn main() fn() - bt u32 + kw true + kw unsafe + kw while + kw while let "#]], ) } @@ -418,23 +418,23 @@ fn foo() { } "#, expect![[r#" - kw unsafe - kw match - kw while - kw while let - kw loop + fn foo() fn() + st Foo + bt u32 + kw crate + kw false + kw for kw if kw if let - kw for - kw true - kw false + kw loop + kw match kw return kw self kw super - kw crate - st Foo - fn foo() fn() - bt u32 + kw true + kw unsafe + kw while + kw while let "#]], ); } @@ -454,23 +454,23 @@ fn foo() { } "#, expect![[r#" - kw unsafe - kw match - kw while - kw while let - kw loop + fn foo() fn() + lc bar i32 + bt u32 + kw crate + kw false + kw for kw if kw if let - kw for - kw true - kw false + kw loop + kw match kw return kw self kw super - kw crate - lc bar i32 - fn foo() fn() - bt u32 + kw true + kw unsafe + kw while + kw while let "#]], ); } @@ -485,24 +485,24 @@ fn quux(x: i32) { } "#, expect![[r#" - kw unsafe - kw match - kw while - kw while let - kw loop + fn quux(…) fn(i32) + lc x i32 + ma m!(…) macro_rules! m + bt u32 + kw crate + kw false + kw for kw if kw if let - kw for - kw true - kw false + kw loop + kw match kw return kw self kw super - kw crate - bt u32 - lc x i32 - fn quux(…) fn(i32) - ma m!(…) macro_rules! m + kw true + kw unsafe + kw while + kw while let "#]], ); check_empty( @@ -513,24 +513,24 @@ fn quux(x: i32) { } ", expect![[r#" - kw unsafe - kw match - kw while - kw while let - kw loop + fn quux(…) fn(i32) + lc x i32 + ma m!(…) macro_rules! m + bt u32 + kw crate + kw false + kw for kw if kw if let - kw for - kw true - kw false + kw loop + kw match kw return kw self kw super - kw crate - bt u32 - lc x i32 - fn quux(…) fn(i32) - ma m!(…) macro_rules! m + kw true + kw unsafe + kw while + kw while let "#]], ); check_empty( @@ -559,12 +559,12 @@ fn func() { } "#, expect![[r#" - ev TupleV(…) TupleV(u32) - ev RecordV {…} RecordV { field: u32 } - ev UnitV UnitV ct ASSOC_CONST const ASSOC_CONST: () fn assoc_fn() fn() ta AssocType type AssocType = () + ev RecordV {…} RecordV { field: u32 } + ev TupleV(…) TupleV(u32) + ev UnitV UnitV "#]], ); } @@ -601,8 +601,8 @@ fn func() { } "#, expect![[r#" - ev Variant(…) Variant fn variant fn() -> Enum + ev Variant(…) Variant "#]], ); } @@ -618,11 +618,11 @@ fn main() { self::$0 } ", - expect![[r" - tt Trait - fn main() fn() + expect![[r#" fn foo() fn() -> impl Trait - "]], + fn main() fn() + tt Trait + "#]], ); } @@ -638,12 +638,12 @@ fn main() { self::$0 } "#, - expect![[r" - tt Trait - fn main() fn() + expect![[r#" fn bar() async fn() -> impl Trait fn foo() async fn() -> u8 - "]], + fn main() fn() + tt Trait + "#]], ); } diff --git a/crates/ide-completion/src/tests/fn_param.rs b/crates/ide-completion/src/tests/fn_param.rs index 4578955da1e69..f8e145c747066 100644 --- a/crates/ide-completion/src/tests/fn_param.rs +++ b/crates/ide-completion/src/tests/fn_param.rs @@ -17,8 +17,8 @@ fn baz(file$0) {} "#, expect![[r#" bn file_id: usize - kw ref kw mut + kw ref "#]], ); } @@ -33,8 +33,8 @@ fn baz(foo: (), file$0) {} "#, expect![[r#" bn file_id: usize - kw ref kw mut + kw ref "#]], ); } @@ -49,8 +49,8 @@ fn baz(file$0 id: u32) {} "#, expect![[r#" bn file_id: usize, - kw ref kw mut + kw ref "#]], ); } @@ -63,8 +63,8 @@ fn foo(file_id: usize) {} fn bar(file_id: u32, $0) {} "#, expect![[r#" - kw ref kw mut + kw ref "#]], ); @@ -73,10 +73,10 @@ fn bar(file_id: u32, $0) {} fn f(#[foo = "bar"] baz: u32,) {} fn g(baz: (), ba$0) "#, - expect![[r##" - kw ref - kw mut - "##]], + expect![[r#" + kw mut + kw ref + "#]], ) } @@ -91,8 +91,8 @@ pub(crate) trait SourceRoot { "#, expect![[r#" bn file_id: usize - kw ref kw mut + kw ref "#]], ); } @@ -107,8 +107,8 @@ fn outer(text: &str) { "#, expect![[r#" bn text: &str - kw ref kw mut + kw ref "#]], ) } @@ -122,11 +122,11 @@ fn foo(Bar { bar }: Bar) {} fn foo2($0) {} "#, expect![[r#" + st Bar + bn Bar Bar { bar$1 }: Bar$0 bn Bar { bar }: Bar - kw ref kw mut - bn Bar Bar { bar$1 }: Bar$0 - st Bar + kw ref "#]], ) } @@ -143,15 +143,15 @@ impl A { } "#, expect![[r#" - bn self - bn &self - bn mut self + sp Self + st A bn &mut self + bn &self bn file_id: usize - kw ref + bn mut self + bn self kw mut - sp Self - st A + kw ref "#]], ) } @@ -168,11 +168,11 @@ impl A { } "#, expect![[r#" - bn file_id: usize - kw ref - kw mut sp Self st A + bn file_id: usize + kw mut + kw ref "#]], ) } @@ -195,11 +195,11 @@ fn outer() { } "#, expect![[r#" - bn foo: i32 - bn baz: i32 bn bar: i32 - kw ref + bn baz: i32 + bn foo: i32 kw mut + kw ref "#]], ) } @@ -220,11 +220,11 @@ fn outer() { } "#, expect![[r#" - bn baz: i32 bn bar: i32 + bn baz: i32 bn foo: i32 - kw ref kw mut + kw ref "#]], ) } @@ -238,8 +238,8 @@ fn bar(bar$0) {} "#, expect![[r#" bn bar: u32 - kw ref kw mut + kw ref "#]], ) } diff --git a/crates/ide-completion/src/tests/item.rs b/crates/ide-completion/src/tests/item.rs index ed341b361ac3d..8f2f8a548a484 100644 --- a/crates/ide-completion/src/tests/item.rs +++ b/crates/ide-completion/src/tests/item.rs @@ -18,18 +18,18 @@ fn target_type_or_trait_in_impl_block() { impl Tra$0 "#, expect![[r#" - kw self - kw super - kw crate - tt Trait en Enum + ma makro!(…) macro_rules! makro + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait un Union bt u32 + kw crate + kw self + kw super "#]], ) } @@ -41,18 +41,18 @@ fn target_type_in_trait_impl_block() { impl Trait for Str$0 "#, expect![[r#" - kw self - kw super - kw crate - tt Trait en Enum + ma makro!(…) macro_rules! makro + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait un Union bt u32 + kw crate + kw self + kw super "#]], ) } @@ -72,17 +72,17 @@ fn after_target_name_in_impl() { check( r"impl Trait $0", expect![[r#" - kw where kw for + kw where "#]], ); // FIXME: This should not emit `kw for` check( r"impl Trait for Type $0", expect![[r#" - kw where - kw for - "#]], + kw for + kw where + "#]], ); } @@ -92,30 +92,30 @@ fn after_struct_name() { check( r"struct Struct $0", expect![[r#" - kw pub(crate) - kw pub(super) - kw pub - kw unsafe - kw fn + ma makro!(…) macro_rules! makro + md module kw const - kw type - kw impl + kw crate + kw enum kw extern - kw use - kw trait - kw static + kw fn + kw impl kw mod - kw enum + kw pub + kw pub(crate) + kw pub(super) + kw self + kw static kw struct + kw super + kw trait + kw type kw union - sn tmod (Test module) - sn tfn (Test function) + kw unsafe + kw use sn macro_rules - kw self - kw super - kw crate - md module - ma makro!(…) macro_rules! makro + sn tfn (Test function) + sn tmod (Test module) "#]], ); } @@ -126,30 +126,30 @@ fn after_fn_name() { check( r"fn func() $0", expect![[r#" - kw pub(crate) - kw pub(super) - kw pub - kw unsafe - kw fn + ma makro!(…) macro_rules! makro + md module kw const - kw type - kw impl + kw crate + kw enum kw extern - kw use - kw trait - kw static + kw fn + kw impl kw mod - kw enum + kw pub + kw pub(crate) + kw pub(super) + kw self + kw static kw struct + kw super + kw trait + kw type kw union - sn tmod (Test module) - sn tfn (Test function) + kw unsafe + kw use sn macro_rules - kw self - kw super - kw crate - md module - ma makro!(…) macro_rules! makro + sn tfn (Test function) + sn tmod (Test module) "#]], ); } @@ -164,9 +164,9 @@ struct Foo { } "#, expect![[r#" + kw pub kw pub(crate) kw pub(super) - kw pub "#]], ) } diff --git a/crates/ide-completion/src/tests/item_list.rs b/crates/ide-completion/src/tests/item_list.rs index 0e60f748790bf..40d3b90da9de0 100644 --- a/crates/ide-completion/src/tests/item_list.rs +++ b/crates/ide-completion/src/tests/item_list.rs @@ -13,29 +13,29 @@ fn in_mod_item_list() { check( r#"mod tests { $0 }"#, expect![[r#" - kw pub(crate) - kw pub(super) - kw pub - kw unsafe - kw fn + ma makro!(…) macro_rules! makro kw const - kw type - kw impl + kw crate + kw enum kw extern - kw use - kw trait - kw static + kw fn + kw impl kw mod - kw enum + kw pub + kw pub(crate) + kw pub(super) + kw self + kw static kw struct + kw super + kw trait + kw type kw union - sn tmod (Test module) - sn tfn (Test function) + kw unsafe + kw use sn macro_rules - kw self - kw super - kw crate - ma makro!(…) macro_rules! makro + sn tfn (Test function) + sn tmod (Test module) "#]], ) } @@ -45,30 +45,30 @@ fn in_source_file_item_list() { check( r#"$0"#, expect![[r#" - kw pub(crate) - kw pub(super) - kw pub - kw unsafe - kw fn + ma makro!(…) macro_rules! makro + md module kw const - kw type - kw impl + kw crate + kw enum kw extern - kw use - kw trait - kw static + kw fn + kw impl kw mod - kw enum + kw pub + kw pub(crate) + kw pub(super) + kw self + kw static kw struct + kw super + kw trait + kw type kw union - sn tmod (Test module) - sn tfn (Test function) + kw unsafe + kw use sn macro_rules - kw self - kw super - kw crate - md module - ma makro!(…) macro_rules! makro + sn tfn (Test function) + sn tmod (Test module) "#]], ) } @@ -78,25 +78,25 @@ fn in_item_list_after_attr() { check( r#"#[attr] $0"#, expect![[r#" - kw pub(crate) - kw pub(super) - kw pub - kw unsafe - kw fn kw const - kw type - kw impl + kw enum kw extern - kw use - kw trait - kw static + kw fn + kw impl kw mod - kw enum + kw pub + kw pub(crate) + kw pub(super) + kw static kw struct + kw trait + kw type kw union - sn tmod (Test module) - sn tfn (Test function) + kw unsafe + kw use sn macro_rules + sn tfn (Test function) + sn tmod (Test module) "#]], ) } @@ -107,8 +107,8 @@ fn in_qualified_path() { check( r#"crate::$0"#, expect![[r#" - md module ma makro!(…) macro_rules! makro + md module "#]], ) } @@ -119,8 +119,8 @@ fn after_unsafe_token() { r#"unsafe $0"#, expect![[r#" kw fn - kw trait kw impl + kw trait "#]], ); } @@ -130,17 +130,17 @@ fn after_visibility() { check( r#"pub $0"#, expect![[r#" - kw unsafe - kw fn kw const - kw type - kw use - kw trait - kw static - kw mod kw enum + kw fn + kw mod + kw static kw struct + kw trait + kw type kw union + kw unsafe + kw use "#]], ); } @@ -152,8 +152,8 @@ fn after_visibility_unsafe() { r#"pub unsafe $0"#, expect![[r#" kw fn - kw trait kw impl + kw trait "#]], ); } @@ -163,18 +163,18 @@ fn in_impl_assoc_item_list() { check( r#"impl Struct { $0 }"#, expect![[r#" + ma makro!(…) macro_rules! makro + md module + kw const + kw crate + kw fn + kw pub kw pub(crate) kw pub(super) - kw pub - kw unsafe - kw fn - kw const - kw type kw self kw super - kw crate - md module - ma makro!(…) macro_rules! makro + kw type + kw unsafe "#]], ) } @@ -184,13 +184,13 @@ fn in_impl_assoc_item_list_after_attr() { check( r#"impl Struct { #[attr] $0 }"#, expect![[r#" + kw const + kw fn + kw pub kw pub(crate) kw pub(super) - kw pub - kw unsafe - kw fn - kw const kw type + kw unsafe "#]], ) } @@ -200,15 +200,15 @@ fn in_trait_assoc_item_list() { check( r"trait Foo { $0 }", expect![[r#" - kw unsafe - kw fn + ma makro!(…) macro_rules! makro + md module kw const - kw type + kw crate + kw fn kw self kw super - kw crate - md module - ma makro!(…) macro_rules! makro + kw type + kw unsafe "#]], ); } @@ -234,21 +234,21 @@ impl Test for () { } "#, expect![[r#" - kw pub(crate) - kw pub(super) - kw pub - kw unsafe - kw fn - kw const - kw type - ta type Type1 = ct const CONST1: () = fn fn function1() + ma makro!(…) macro_rules! makro + md module + ta type Type1 = + kw const + kw crate + kw fn + kw pub + kw pub(crate) + kw pub(super) kw self kw super - kw crate - md module - ma makro!(…) macro_rules! makro + kw type + kw unsafe "#]], ); } diff --git a/crates/ide-completion/src/tests/pattern.rs b/crates/ide-completion/src/tests/pattern.rs index 3b59263528881..b353883bc7ec9 100644 --- a/crates/ide-completion/src/tests/pattern.rs +++ b/crates/ide-completion/src/tests/pattern.rs @@ -22,8 +22,8 @@ fn quux() { } "#, expect![[r#" - kw ref kw mut + kw ref "#]], ); } @@ -113,19 +113,19 @@ fn foo() { } "#, expect![[r#" - kw ref - kw mut + ct CONST en Enum - bn Record Record { field$1 }$0 + ma makro!(…) macro_rules! makro + md module st Record - bn Tuple Tuple($1)$0 st Tuple - md module st Unit - ma makro!(…) macro_rules! makro - bn TupleV TupleV($1)$0 ev TupleV - ct CONST + bn Record Record { field$1 }$0 + bn Tuple Tuple($1)$0 + bn TupleV TupleV($1)$0 + kw mut + kw ref "#]], ); } @@ -143,17 +143,17 @@ fn foo() { } "#, expect![[r#" - kw ref - kw mut - bn Record Record { field$1 }$0 + en SingleVariantEnum + ma makro!(…) macro_rules! makro + md module st Record - bn Tuple Tuple($1)$0 st Tuple - ev Variant - md module - en SingleVariantEnum st Unit - ma makro!(…) macro_rules! makro + ev Variant + bn Record Record { field$1 }$0 + bn Tuple Tuple($1)$0 + kw mut + kw ref "#]], ); } @@ -166,15 +166,15 @@ fn foo(a$0) { } "#, expect![[r#" - kw ref - kw mut - bn Record Record { field$1 }: Record$0 + ma makro!(…) macro_rules! makro + md module st Record - bn Tuple Tuple($1): Tuple$0 st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + bn Record Record { field$1 }: Record$0 + bn Tuple Tuple($1): Tuple$0 + kw mut + kw ref "#]], ); check( @@ -183,15 +183,15 @@ fn foo(a$0: Tuple) { } "#, expect![[r#" - kw ref - kw mut - bn Record Record { field$1 }$0 + ma makro!(…) macro_rules! makro + md module st Record - bn Tuple Tuple($1)$0 st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + bn Record Record { field$1 }$0 + bn Tuple Tuple($1)$0 + kw mut + kw ref "#]], ); } @@ -210,9 +210,9 @@ fn foo() { } "#, expect![[r#" - kw ref - kw mut ma m!(…) macro_rules! m + kw mut + kw ref "#]], ); } @@ -229,10 +229,10 @@ fn foo() { } "#, expect![[r#" - kw ref - kw mut en E ma m!(…) macro_rules! m + kw mut + kw ref "#]], ); } @@ -253,14 +253,14 @@ fn outer() { } "#, expect![[r#" - kw ref - kw mut - bn Record Record { field$1, .. }$0 + md foo + st Invisible st Record - bn Tuple Tuple($1, ..)$0 st Tuple - st Invisible - md foo + bn Record Record { field$1, .. }$0 + bn Tuple Tuple($1, ..)$0 + kw mut + kw ref "#]], ) } @@ -279,12 +279,12 @@ impl Foo { } "#, expect![[r#" - kw ref - kw mut - bn Self Self($1)$0 sp Self - bn Foo Foo($1)$0 st Foo + bn Foo Foo($1)$0 + bn Self Self($1)$0 + kw mut + kw ref "#]], ) } @@ -303,10 +303,10 @@ fn func() { } "#, expect![[r#" - ev TupleV(…) TupleV(u32) + ct ASSOC_CONST const ASSOC_CONST: () ev RecordV {…} RecordV { field: u32 } + ev TupleV(…) TupleV(u32) ev UnitV UnitV - ct ASSOC_CONST const ASSOC_CONST: () "#]], ); } @@ -320,12 +320,12 @@ struct Bar(u32); fn outer(Foo { bar: $0 }: Foo) {} "#, expect![[r#" - kw ref - kw mut - bn Foo Foo { bar$1 }$0 + st Bar st Foo bn Bar Bar($1)$0 - st Bar + bn Foo Foo { bar$1 }$0 + kw mut + kw ref "#]], ) } @@ -351,12 +351,12 @@ struct Bar(u32); fn foo($0) {} "#, expect![[r#" - kw ref - kw mut - bn Foo Foo { bar$1 }: Foo$0 + st Bar st Foo bn Bar Bar($1): Bar$0 - st Bar + bn Foo Foo { bar$1 }: Foo$0 + kw mut + kw ref "#]], ) } @@ -372,12 +372,12 @@ fn foo() { } "#, expect![[r#" - kw ref - kw mut - bn Foo Foo { bar$1 }$0 + st Bar st Foo bn Bar Bar($1)$0 - st Bar + bn Foo Foo { bar$1 }$0 + kw mut + kw ref "#]], ) } @@ -394,9 +394,9 @@ fn foo() { } "#, expect![[r#" + kw crate:: kw self:: kw super:: - kw crate:: "#]], ); check_empty( @@ -409,13 +409,13 @@ fn foo() { } "#, expect![[r#" + fn foo() fn() + st Foo + bt u32 + kw crate kw return kw self kw super - kw crate - st Foo - fn foo() fn() - bt u32 "#]], ); check_empty( diff --git a/crates/ide-completion/src/tests/predicate.rs b/crates/ide-completion/src/tests/predicate.rs index 5e975d715f664..cc18bf445360e 100644 --- a/crates/ide-completion/src/tests/predicate.rs +++ b/crates/ide-completion/src/tests/predicate.rs @@ -16,19 +16,19 @@ fn predicate_start() { struct Foo<'lt, T, const C: usize> where $0 {} "#, expect![[r#" - kw self - kw super - kw crate - tt Trait en Enum - st Record - st Tuple + ma makro!(…) macro_rules! makro md module st Foo<…> + st Record + st Tuple st Unit - ma makro!(…) macro_rules! makro + tt Trait un Union bt u32 + kw crate + kw self + kw super "#]], ); } @@ -40,12 +40,12 @@ fn bound_for_type_pred() { struct Foo<'lt, T, const C: usize> where T: $0 {} "#, expect![[r#" + ma makro!(…) macro_rules! makro + md module + tt Trait + kw crate kw self kw super - kw crate - tt Trait - md module - ma makro!(…) macro_rules! makro "#]], ); } @@ -59,12 +59,12 @@ fn bound_for_lifetime_pred() { struct Foo<'lt, T, const C: usize> where 'lt: $0 {} "#, expect![[r#" + ma makro!(…) macro_rules! makro + md module + tt Trait + kw crate kw self kw super - kw crate - tt Trait - md module - ma makro!(…) macro_rules! makro "#]], ); } @@ -76,12 +76,12 @@ fn bound_for_for_pred() { struct Foo<'lt, T, const C: usize> where for<'a> T: $0 {} "#, expect![[r#" + ma makro!(…) macro_rules! makro + md module + tt Trait + kw crate kw self kw super - kw crate - tt Trait - md module - ma makro!(…) macro_rules! makro "#]], ); } @@ -93,19 +93,19 @@ fn param_list_for_for_pred() { struct Foo<'lt, T, const C: usize> where for<'a> $0 {} "#, expect![[r#" - kw self - kw super - kw crate - tt Trait en Enum - st Record - st Tuple + ma makro!(…) macro_rules! makro md module st Foo<…> + st Record + st Tuple st Unit - ma makro!(…) macro_rules! makro + tt Trait un Union bt u32 + kw crate + kw self + kw super "#]], ); } @@ -119,19 +119,19 @@ impl Record { } "#, expect![[r#" - kw self - kw super - kw crate - sp Self - tt Trait en Enum + ma makro!(…) macro_rules! makro + md module + sp Self st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait un Union bt u32 + kw crate + kw self + kw super "#]], ); } diff --git a/crates/ide-completion/src/tests/proc_macros.rs b/crates/ide-completion/src/tests/proc_macros.rs index f54286fe592e0..9eae6f84954b1 100644 --- a/crates/ide-completion/src/tests/proc_macros.rs +++ b/crates/ide-completion/src/tests/proc_macros.rs @@ -25,15 +25,15 @@ fn main() { "#, expect![[r#" me foo() fn(&self) - sn ref &expr - sn refm &mut expr - sn match match expr {} sn box Box::new(expr) + sn call function(expr) sn dbg dbg!(expr) sn dbgr dbg!(&expr) - sn call function(expr) sn let let sn letm let mut + sn match match expr {} + sn ref &expr + sn refm &mut expr "#]], ) } @@ -55,15 +55,15 @@ fn main() { "#, expect![[r#" me foo() fn(&self) - sn ref &expr - sn refm &mut expr - sn match match expr {} sn box Box::new(expr) + sn call function(expr) sn dbg dbg!(expr) sn dbgr dbg!(&expr) - sn call function(expr) sn let let sn letm let mut + sn match match expr {} + sn ref &expr + sn refm &mut expr "#]], ) } @@ -87,15 +87,15 @@ fn main() {} "#, expect![[r#" me foo() fn(&self) - sn ref &expr - sn refm &mut expr - sn match match expr {} sn box Box::new(expr) + sn call function(expr) sn dbg dbg!(expr) sn dbgr dbg!(&expr) - sn call function(expr) sn let let sn letm let mut + sn match match expr {} + sn ref &expr + sn refm &mut expr "#]], ) } @@ -119,15 +119,15 @@ fn main() {} "#, expect![[r#" me foo() fn(&self) - sn ref &expr - sn refm &mut expr - sn match match expr {} sn box Box::new(expr) + sn call function(expr) sn dbg dbg!(expr) sn dbgr dbg!(&expr) - sn call function(expr) sn let let sn letm let mut + sn match match expr {} + sn ref &expr + sn refm &mut expr "#]], ) } diff --git a/crates/ide-completion/src/tests/record.rs b/crates/ide-completion/src/tests/record.rs index 0322ecbe39fa4..bae5ddb53940a 100644 --- a/crates/ide-completion/src/tests/record.rs +++ b/crates/ide-completion/src/tests/record.rs @@ -155,32 +155,32 @@ fn main() { } "#, expect![[r#" - kw unsafe - kw match - kw while - kw while let - kw loop - kw if - kw if let - kw for - kw true - kw false - kw return - st Foo {…} Foo { foo1: u32, foo2: u32 } fd ..Default::default() fd foo1 u32 fd foo2 u32 - kw self - kw super - kw crate + fn main() fn() lc foo Foo lc thing i32 - st Foo - fn main() fn() md core - bt u32 - tt Sized + st Foo + st Foo {…} Foo { foo1: u32, foo2: u32 } tt Default + tt Sized + bt u32 + kw crate + kw false + kw for + kw if + kw if let + kw loop + kw match + kw return + kw self + kw super + kw true + kw unsafe + kw while + kw while let "#]], ); check( @@ -198,9 +198,9 @@ fn main() { } "#, expect![[r#" - fn default() (as Default) fn() -> Self fd foo1 u32 fd foo2 u32 + fn default() (as Default) fn() -> Self "#]], ); } @@ -218,8 +218,8 @@ fn foo() { } "#, expect![[r#" - fd foo u32 fd bar f32 + fd foo u32 "#]], ) } diff --git a/crates/ide-completion/src/tests/type_pos.rs b/crates/ide-completion/src/tests/type_pos.rs index e3ffb92f786d7..fcbb2e05a797c 100644 --- a/crates/ide-completion/src/tests/type_pos.rs +++ b/crates/ide-completion/src/tests/type_pos.rs @@ -17,21 +17,21 @@ struct Foo<'lt, T, const C: usize> { } "#, expect![[r#" - kw self - kw super - kw crate - sp Self - tp T - tt Trait en Enum - st Record - st Tuple + ma makro!(…) macro_rules! makro md module + sp Self st Foo<…> + st Record + st Tuple st Unit - ma makro!(…) macro_rules! makro + tt Trait + tp T un Union bt u32 + kw crate + kw self + kw super "#]], ) } @@ -43,24 +43,24 @@ fn tuple_struct_field() { struct Foo<'lt, T, const C: usize>(f$0); "#, expect![[r#" - kw pub(crate) - kw pub(super) - kw pub - kw self - kw super - kw crate - sp Self - tp T - tt Trait en Enum - st Record - st Tuple + ma makro!(…) macro_rules! makro md module + sp Self st Foo<…> + st Record + st Tuple st Unit - ma makro!(…) macro_rules! makro + tt Trait + tp T un Union bt u32 + kw crate + kw pub + kw pub(crate) + kw pub(super) + kw self + kw super "#]], ) } @@ -72,19 +72,19 @@ fn fn_return_type() { fn x<'lt, T, const C: usize>() -> $0 "#, expect![[r#" - kw self - kw super - kw crate - tp T - tt Trait en Enum + ma makro!(…) macro_rules! makro + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait + tp T un Union bt u32 + kw crate + kw self + kw super "#]], ); } @@ -97,20 +97,20 @@ struct Foo(T); const FOO: $0 = Foo(2); "#, expect![[r#" - it Foo - kw self - kw super - kw crate - tt Trait en Enum - st Record - st Tuple + ma makro!(…) macro_rules! makro md module st Foo<…> + st Record + st Tuple st Unit - ma makro!(…) macro_rules! makro + tt Trait un Union bt u32 + it Foo + kw crate + kw self + kw super "#]], ); } @@ -125,19 +125,19 @@ fn f2() { } "#, expect![[r#" - it i32 - kw self - kw super - kw crate - tt Trait en Enum + ma makro!(…) macro_rules! makro + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait un Union bt u32 + it i32 + kw crate + kw self + kw super "#]], ); } @@ -154,19 +154,19 @@ fn f2() { } "#, expect![[r#" - it u64 - kw self - kw super - kw crate - tt Trait en Enum + ma makro!(…) macro_rules! makro + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait un Union bt u32 + it u64 + kw crate + kw self + kw super "#]], ); } @@ -180,19 +180,19 @@ fn f2(x: u64) -> $0 { } "#, expect![[r#" - it u64 - kw self - kw super - kw crate - tt Trait en Enum + ma makro!(…) macro_rules! makro + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait un Union bt u32 + it u64 + kw crate + kw self + kw super "#]], ); } @@ -207,19 +207,19 @@ fn f2(x: $0) { } "#, expect![[r#" - it i32 - kw self - kw super - kw crate - tt Trait en Enum + ma makro!(…) macro_rules! makro + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait un Union bt u32 + it i32 + kw crate + kw self + kw super "#]], ); } @@ -240,21 +240,21 @@ fn foo<'lt, T, const C: usize>() { } "#, expect![[r#" - it a::Foo> - kw self - kw super - kw crate - tp T - tt Trait en Enum + ma makro!(…) macro_rules! makro + md a + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait + tp T un Union - md a bt u32 + it a::Foo> + kw crate + kw self + kw super "#]], ); } @@ -270,21 +270,21 @@ fn foo<'lt, T, const C: usize>() { } "#, expect![[r#" - it Foo - kw self - kw super - kw crate - tp T - tt Trait en Enum - st Record - st Tuple + ma makro!(…) macro_rules! makro md module st Foo<…> + st Record + st Tuple st Unit - ma makro!(…) macro_rules! makro + tt Trait + tp T un Union bt u32 + it Foo + kw crate + kw self + kw super "#]], ); } @@ -299,19 +299,19 @@ fn foo<'lt, T, const C: usize>() { } "#, expect![[r#" - kw self - kw super - kw crate - tp T - tt Trait en Enum + ma makro!(…) macro_rules! makro + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait + tp T un Union bt u32 + kw crate + kw self + kw super "#]], ); check( @@ -322,13 +322,13 @@ fn foo<'lt, T, const C: usize>() { } "#, expect![[r#" - tt Trait en Enum + ma makro!(…) macro_rules! makro + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait un Union "#]], ); @@ -345,23 +345,23 @@ trait Trait2 { fn foo<'lt, T: Trait2<$0>, const CONST_PARAM: usize>(_: T) {} "#, expect![[r#" - kw self - kw super - kw crate - ta Foo = (as Trait2) type Foo - tp T + ct CONST cp CONST_PARAM - tt Trait en Enum + ma makro!(…) macro_rules! makro + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait tt Trait2 + ta Foo = (as Trait2) type Foo + tp T un Union - ct CONST bt u32 + kw crate + kw self + kw super "#]], ); check( @@ -373,16 +373,16 @@ trait Trait2 { fn foo<'lt, T: Trait2, const CONST_PARAM: usize>(_: T) {} "#, expect![[r#" - tt Trait + ct CONST en Enum + ma makro!(…) macro_rules! makro + md module st Record st Tuple - md module st Unit - ma makro!(…) macro_rules! makro + tt Trait tt Trait2 un Union - ct CONST "#]], ); } diff --git a/crates/ide-completion/src/tests/use_tree.rs b/crates/ide-completion/src/tests/use_tree.rs index ca06cc376ff79..70aa5e5468a5b 100644 --- a/crates/ide-completion/src/tests/use_tree.rs +++ b/crates/ide-completion/src/tests/use_tree.rs @@ -24,9 +24,9 @@ mod foo {} expect![[r#" md foo md other_crate + kw crate:: kw self:: kw super:: - kw crate:: "#]], ); } @@ -60,8 +60,8 @@ mod foo { pub struct S; } use self::{foo::*, bar$0}; "#, expect![[r#" - st S md foo + st S "#]], ); } @@ -91,8 +91,8 @@ mod foo { use foo::{$0} "#, expect![[r#" - kw self md bar + kw self "#]], ); } @@ -126,8 +126,8 @@ mod foo { use foo::{bar::{$0}} "#, expect![[r#" - kw self md baz + kw self "#]], ); } @@ -147,8 +147,8 @@ mod foo { struct Bar; "#, expect![[r#" - st Foo ma foo macro_rules! foo_ + st Foo "#]], ); } @@ -200,10 +200,10 @@ mod foo {} struct Bar; "#, expect![[r#" - kw super:: - st Bar md bar md foo + st Bar + kw super:: "#]], ); } @@ -221,9 +221,9 @@ mod a { } "#, expect![[r#" - kw super:: - md b ct A + md b + kw super:: "#]], ); } @@ -255,8 +255,8 @@ pub struct Foo; pub mod foo {} "#, expect![[r#" - st Foo md foo + st Foo "#]], ); } @@ -271,9 +271,9 @@ pub use $0; "#, expect![[r#" md bar + kw crate:: kw self:: kw super:: - kw crate:: "#]], ); } @@ -288,9 +288,9 @@ use {$0}; "#, expect![[r#" md bar + kw crate:: kw self:: kw super:: - kw crate:: "#]], ); } diff --git a/crates/ide-completion/src/tests/visibility.rs b/crates/ide-completion/src/tests/visibility.rs index 970eb707192dc..b77c595eeeca9 100644 --- a/crates/ide-completion/src/tests/visibility.rs +++ b/crates/ide-completion/src/tests/visibility.rs @@ -16,10 +16,10 @@ fn empty_pub() { pub($0) "#, expect![[r#" + kw crate kw in kw self kw super - kw crate "#]], ); } @@ -31,9 +31,9 @@ fn after_in_kw() { pub(in $0) "#, expect![[r#" + kw crate kw self kw super - kw crate "#]], ); }