Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/ide-completion/src/completions/dot.rs12
-rw-r--r--crates/ide-completion/src/completions/item_list/trait_impl.rs30
-rw-r--r--crates/ide-completion/src/completions/use_.rs4
-rw-r--r--crates/ide-completion/src/item.rs9
-rw-r--r--crates/ide-completion/src/render.rs142
-rw-r--r--crates/ide-completion/src/render/function.rs67
-rw-r--r--crates/ide-completion/src/tests/expression.rs98
-rw-r--r--crates/ide-completion/src/tests/flyimport.rs54
-rw-r--r--crates/ide-completion/src/tests/item.rs24
-rw-r--r--crates/ide-completion/src/tests/pattern.rs4
-rw-r--r--crates/ide-completion/src/tests/predicate.rs42
-rw-r--r--crates/ide-completion/src/tests/record.rs4
-rw-r--r--crates/ide-completion/src/tests/special.rs70
-rw-r--r--crates/ide-completion/src/tests/type_pos.rs486
-rw-r--r--crates/ide-completion/src/tests/use_tree.rs20
15 files changed, 516 insertions, 550 deletions
diff --git a/crates/ide-completion/src/completions/dot.rs b/crates/ide-completion/src/completions/dot.rs
index 57e0646109..613a35dcb1 100644
--- a/crates/ide-completion/src/completions/dot.rs
+++ b/crates/ide-completion/src/completions/dot.rs
@@ -940,9 +940,9 @@ impl Foo { fn foo(&self) { $0 } }"#,
expect![[r#"
fd self.field i32
lc self &Foo
- sp Self
- st Foo
- bt u32
+ sp Self Foo
+ st Foo Foo
+ bt u32 u32
me self.foo() fn(&self)
"#]],
);
@@ -954,9 +954,9 @@ impl Foo { fn foo(&mut self) { $0 } }"#,
expect![[r#"
fd self.0 i32
lc self &mut Foo
- sp Self
- st Foo
- bt u32
+ sp Self Foo
+ st Foo Foo
+ bt u32 u32
me self.foo() fn(&mut self)
"#]],
);
diff --git a/crates/ide-completion/src/completions/item_list/trait_impl.rs b/crates/ide-completion/src/completions/item_list/trait_impl.rs
index 42dfbfc7d9..b0e4d8a5ac 100644
--- a/crates/ide-completion/src/completions/item_list/trait_impl.rs
+++ b/crates/ide-completion/src/completions/item_list/trait_impl.rs
@@ -417,10 +417,10 @@ impl Test for T {
}
",
expect![[r#"
- sp Self
- st T
+ sp Self T
+ st T T
tt Test
- bt u32
+ bt u32 u32
"#]],
);
@@ -526,10 +526,10 @@ impl Test for T {
}
",
expect![[r#"
- sp Self
- st T
+ sp Self T
+ st T T
tt Test
- bt u32
+ bt u32 u32
"#]],
);
@@ -543,10 +543,10 @@ impl Test for T {
}
",
expect![[r#"
- sp Self
- st T
+ sp Self T
+ st T T
tt Test
- bt u32
+ bt u32 u32
"#]],
);
@@ -562,10 +562,10 @@ impl Test for T {
}
",
expect![[r#"
- sp Self
- st T
+ sp Self T
+ st T T
tt Test
- bt u32
+ bt u32 u32
"#]],
);
@@ -610,10 +610,10 @@ impl Test for T {
}
",
expect![[r#"
- sp Self
- st T
+ sp Self T
+ st T T
tt Test
- bt u32
+ bt u32 u32
"#]],
);
diff --git a/crates/ide-completion/src/completions/use_.rs b/crates/ide-completion/src/completions/use_.rs
index 7a60030e9e..81107c1f41 100644
--- a/crates/ide-completion/src/completions/use_.rs
+++ b/crates/ide-completion/src/completions/use_.rs
@@ -71,9 +71,9 @@ pub(crate) fn complete_use_path(
if add_resolution {
let mut builder = Builder::from_resolution(ctx, path_ctx, name, def);
- builder.set_relevance(CompletionRelevance {
+ builder.with_relevance(|r| CompletionRelevance {
is_name_already_imported,
- ..Default::default()
+ ..r
});
acc.add(builder.build(ctx.db));
}
diff --git a/crates/ide-completion/src/item.rs b/crates/ide-completion/src/item.rs
index 99b895eed4..b982322a73 100644
--- a/crates/ide-completion/src/item.rs
+++ b/crates/ide-completion/src/item.rs
@@ -1,6 +1,6 @@
//! See `CompletionItem` structure.
-use std::fmt;
+use std::{fmt, mem};
use hir::Mutability;
use ide_db::{
@@ -570,6 +570,13 @@ impl Builder {
self.relevance = relevance;
self
}
+ pub(crate) fn with_relevance(
+ &mut self,
+ relevance: impl FnOnce(CompletionRelevance) -> CompletionRelevance,
+ ) -> &mut Builder {
+ self.relevance = relevance(mem::take(&mut self.relevance));
+ self
+ }
pub(crate) fn trigger_call_info(&mut self) -> &mut Builder {
self.trigger_call_info = true;
self
diff --git a/crates/ide-completion/src/render.rs b/crates/ide-completion/src/render.rs
index 309c193749..2ea3f74d18 100644
--- a/crates/ide-completion/src/render.rs
+++ b/crates/ide-completion/src/render.rs
@@ -10,7 +10,7 @@ pub(crate) mod variant;
pub(crate) mod union_literal;
pub(crate) mod literal;
-use hir::{AsAssocItem, Function, HasAttrs, HirDisplay, ModuleDef, ScopeDef, Type};
+use hir::{AsAssocItem, HasAttrs, HirDisplay, ModuleDef, ScopeDef, Type};
use ide_db::{
documentation::{Documentation, HasDocs},
helpers::item_name,
@@ -393,10 +393,10 @@ fn render_resolution_path(
ScopeDef::ModuleDef(ModuleDef::Adt(adt)) | ScopeDef::AdtSelfType(adt) => {
set_item_relevance(adt.ty(db))
}
- // Functions are handled at the start of the function.
- ScopeDef::ModuleDef(ModuleDef::Function(_)) => (), // TODO: Should merge with the match case earlier in the function?
- // Enum variants are handled at the start of the function.
- ScopeDef::ModuleDef(ModuleDef::Variant(_)) => (),
+ // Filtered out above
+ ScopeDef::ModuleDef(
+ ModuleDef::Function(_) | ModuleDef::Variant(_) | ModuleDef::Macro(_),
+ ) => (),
ScopeDef::ModuleDef(ModuleDef::Const(konst)) => set_item_relevance(konst.ty(db)),
ScopeDef::ModuleDef(ModuleDef::Static(stat)) => set_item_relevance(stat.ty(db)),
ScopeDef::ModuleDef(ModuleDef::BuiltinType(bt)) => set_item_relevance(bt.ty(db)),
@@ -404,11 +404,12 @@ fn render_resolution_path(
ScopeDef::GenericParam(_)
| ScopeDef::Label(_)
| ScopeDef::Unknown
- | ScopeDef::ModuleDef(ModuleDef::Trait(_))
- | ScopeDef::ModuleDef(ModuleDef::TraitAlias(_))
- | ScopeDef::ModuleDef(ModuleDef::Macro(_))
- | ScopeDef::ModuleDef(ModuleDef::Module(_))
- | ScopeDef::ModuleDef(ModuleDef::TypeAlias(_)) => (),
+ | ScopeDef::ModuleDef(
+ ModuleDef::Trait(_)
+ | ModuleDef::TraitAlias(_)
+ | ModuleDef::Module(_)
+ | ModuleDef::TypeAlias(_),
+ ) => (),
};
item
@@ -497,6 +498,7 @@ fn scope_def_is_deprecated(ctx: &RenderContext<'_>, resolution: ScopeDef) -> boo
}
}
+// FIXME: This checks types without possible coercions which some completions might want to do
fn match_types(
ctx: &CompletionContext<'_>,
ty1: &hir::Type,
@@ -526,41 +528,6 @@ fn compute_type_match(
match_types(ctx, expected_type, completion_ty)
}
-fn compute_function_type_match(
- ctx: &CompletionContext<'_>,
- func: &Function,
-) -> Option<CompletionRelevanceTypeMatch> {
- // We compute a vec of function parameters + the return type for the expected
- // type as well as the function we are matching with. Doing this allows for
- // matching all of the types in one iterator.
-
- let expected_callable = ctx.expected_type.as_ref()?.as_callable(ctx.db)?;
- let expected_types = expected_callable.params(ctx.db).into_iter().map(|param| param.1);
- let actual_types =
- func.ty(ctx.db).as_callable(ctx.db)?.params(ctx.db).into_iter().map(|param| param.1);
-
- if expected_types.len() != actual_types.len() {
- return None;
- }
-
- let mut matches = expected_types
- .zip(actual_types)
- .chain([(expected_callable.return_type(), func.ret_type(ctx.db))])
- .map(|(expected_type, actual_type)| match_types(ctx, &expected_type, &actual_type));
-
- // Any missing type match indicates that these types can not be unified.
- if matches.any(|type_match| type_match.is_none()) {
- return None;
- }
-
- // If any of the types are unifiable but not exact we consider the function types as a whole
- // to be unifiable. Otherwise if every pair of types is an exact match the functions are an
- // exact type match.
- matches
- .find(|type_match| matches!(type_match, Some(CompletionRelevanceTypeMatch::CouldUnify)))
- .unwrap_or(Some(CompletionRelevanceTypeMatch::Exact))
-}
-
fn compute_exact_name_match(ctx: &CompletionContext<'_>, completion_name: &str) -> bool {
ctx.expected_name.as_ref().map_or(false, |name| name.text() == completion_name)
}
@@ -745,16 +712,16 @@ fn main() {
pub mod test_mod_b {
pub union Union {
- a: i32,
- b: i32
- }
+ a: i32,
+ b: i32
+ }
}
pub mod test_mod_a {
pub enum Union {
- a: i32,
- b: i32
- }
+ a: i32,
+ b: i32
+ }
}
//- /main.rs crate:main deps:dep
@@ -783,14 +750,14 @@ fn main() {
pub mod test_mod_b {
pub enum Enum {
- variant
- }
+ variant
+ }
}
pub mod test_mod_a {
pub enum Enum {
- variant
- }
+ variant
+ }
}
//- /main.rs crate:main deps:dep
@@ -812,7 +779,6 @@ fn main() {
);
}
- // TODO: How dowe test ModuleDef::Variant(Variant?)
#[test]
fn set_enum_variant_type_completion_info() {
check_relevance(
@@ -821,14 +787,14 @@ fn main() {
pub mod test_mod_b {
pub enum Enum {
- Variant
- }
+ Variant
+ }
}
pub mod test_mod_a {
pub enum Enum {
- Variant
- }
+ Variant
+ }
}
//- /main.rs crate:main deps:dep
@@ -836,16 +802,14 @@ pub mod test_mod_a {
fn test(input: dep::test_mod_b::Enum) { }
fn main() {
- test(Enum::Variant$0);
+ test(Variant$0);
}
"#,
expect![[r#"
ev dep::test_mod_b::Enum::Variant [type_could_unify]
- en Enum (use dep::test_mod_b::Enum) [type_could_unify+requires_import]
fn main() []
fn test(…) []
md dep []
- en Enum (use dep::test_mod_a::Enum) [requires_import]
"#]],
);
}
@@ -857,13 +821,11 @@ fn main() {
//- /lib.rs crate:dep
pub mod test_mod_b {
- pub fn Function(j: isize) -> i32 {
- }
+ pub fn function(j: isize) -> i32 {}
}
- pub mod test_mod_a {
- pub fn Function(i: usize) -> i32 {
- }
+pub mod test_mod_a {
+ pub fn function(i: usize) -> i32 {}
}
//- /main.rs crate:main deps:dep
@@ -871,15 +833,15 @@ pub mod test_mod_b {
fn test(input: fn(usize) -> i32) { }
fn main() {
- test(Function$0);
+ test(function$0);
}
"#,
expect![[r#"
- fn Function (use dep::test_mod_a::Function) [type+requires_import]
fn main []
fn test []
md dep []
- fn Function (use dep::test_mod_b::Function) [requires_import]
+ fn function (use dep::test_mod_a::function) [requires_import]
+ fn function (use dep::test_mod_b::function) [requires_import]
"#]],
);
}
@@ -891,11 +853,11 @@ fn main() {
//- /lib.rs crate:dep
pub mod test_mod_b {
- pub const CONST: i32 = 1;
+ pub const CONST: i32 = 1;
}
pub mod test_mod_a {
- pub const CONST: i64 = 2;
+ pub const CONST: i64 = 2;
}
//- /main.rs crate:main deps:dep
@@ -923,11 +885,11 @@ fn main() {
//- /lib.rs crate:dep
pub mod test_mod_b {
- pub static STATIC: i32 = 5;
+ pub static STATIC: i32 = 5;
}
pub mod test_mod_a {
- pub static STATIC: i64 = 5;
+ pub static STATIC: i64 = 5;
}
//- /main.rs crate:main deps:dep
@@ -975,7 +937,7 @@ fn main() {
"#,
expect![[r#"
- me Function [type]
+ me Function []
"#]],
);
}
@@ -990,7 +952,7 @@ struct Struct;
impl Struct {
fn test(&self) {
- func(Self$0);
+ func(Self$0);
}
}
@@ -1013,14 +975,14 @@ fn func(input: Struct) { }
fn set_builtin_type_completion_info() {
check_relevance(
r#"
-//- /main.rs crate:main
+//- /main.rs crate:main
fn test(input: bool) { }
- pub Input: bool = false;
+ pub Input: bool = false;
fn main() {
- let input = false;
- let inputbad = 3;
+ let input = false;
+ let inputbad = 3;
test(inp$0);
}
"#,
@@ -1424,6 +1386,7 @@ use self::E::*;
kind: SymbolKind(
Enum,
),
+ detail: "E",
documentation: Documentation(
"enum docs",
),
@@ -1668,6 +1631,7 @@ fn go(world: &WorldSnapshot) { go(w$0) }
st WorldSnapshot {…} []
st &WorldSnapshot {…} [type]
st WorldSnapshot []
+ st &WorldSnapshot [type]
fn go(…) []
"#]],
);
@@ -1767,6 +1731,7 @@ fn main() {
st S []
st &mut S [type]
st S []
+ st &mut S [type]
fn foo(…) []
fn main() []
"#]],
@@ -1783,7 +1748,7 @@ fn main() {
expect![[r#"
lc s [type+name+local]
st S [type]
- st S []
+ st S [type]
fn foo(…) []
fn main() []
"#]],
@@ -1800,7 +1765,7 @@ fn main() {
expect![[r#"
lc ssss [type+local]
st S [type]
- st S []
+ st S [type]
fn foo(…) []
fn main() []
"#]],
@@ -1839,7 +1804,9 @@ fn main() {
st S []
st &S [type]
st S []
+ st &S [type]
st T []
+ st &T [type]
fn foo(…) []
fn main() []
md core []
@@ -1885,7 +1852,9 @@ fn main() {
st S []
st &mut S [type]
st S []
+ st &mut S [type]
st T []
+ st &mut T [type]
fn foo(…) []
fn main() []
md core []
@@ -1924,7 +1893,7 @@ fn bar(t: Foo) {}
expect![[r#"
ev Foo::A [type]
ev Foo::B [type]
- en Foo []
+ en Foo [type]
fn bar(…) []
fn foo() []
"#]],
@@ -1947,6 +1916,7 @@ fn bar(t: &Foo) {}
ev Foo::B []
ev &Foo::B [type]
en Foo []
+ en &Foo [type]
fn bar(…) []
fn foo() []
"#]],
@@ -1980,7 +1950,9 @@ fn main() {
st S []
st &S [type]
st S []
+ st &S [type]
st T []
+ st &T [type]
fn bar() []
fn &bar() [type]
fn foo(…) []
@@ -2189,8 +2161,8 @@ fn foo() {
lc foo [type+local]
ev Foo::A(…) [type_could_unify]
ev Foo::B [type_could_unify]
+ en Foo [type_could_unify]
fn foo() []
- en Foo []
fn bar() []
fn baz() []
"#]],
diff --git a/crates/ide-completion/src/render/function.rs b/crates/ide-completion/src/render/function.rs
index ff84aa8742..d23ed71fdc 100644
--- a/crates/ide-completion/src/render/function.rs
+++ b/crates/ide-completion/src/render/function.rs
@@ -9,9 +9,7 @@ use syntax::{AstNode, SmolStr};
use crate::{
context::{CompletionContext, DotAccess, DotAccessKind, PathCompletionCtx, PathKind},
item::{Builder, CompletionItem, CompletionItemKind, CompletionRelevance},
- render::{
- compute_exact_name_match, compute_function_type_match, compute_ref_match, RenderContext,
- },
+ render::{compute_exact_name_match, compute_ref_match, compute_type_match, RenderContext},
CallableSnippets,
};
@@ -81,8 +79,30 @@ fn render(
.and_then(|trait_| trait_.containing_trait_or_trait_impl(ctx.db()))
.map_or(false, |trait_| completion.is_ops_trait(trait_));
+ let (has_dot_receiver, has_call_parens, cap) = match func_kind {
+ FuncKind::Function(&PathCompletionCtx {
+ kind: PathKind::Expr { .. },
+ has_call_parens,
+ ..
+ }) => (false, has_call_parens, ctx.completion.config.snippet_cap),
+ FuncKind::Method(&DotAccess { kind: DotAccessKind::Method { has_parens }, .. }, _) => {
+ (true, has_parens, ctx.completion.config.snippet_cap)
+ }
+ FuncKind::Method(DotAccess { kind: DotAccessKind::Field { .. }, .. }, _) => {
+ (true, false, ctx.completion.config.snippet_cap)
+ }
+ _ => (false, false, None),
+ };
+ let complete_call_parens = cap
+ .filter(|_| !has_call_parens)
+ .and_then(|cap| Some((cap, params(ctx.completion, func, &func_kind, has_dot_receiver)?)));
+
item.set_relevance(CompletionRelevance {
- type_match: compute_function_type_match(completion, &func),
+ type_match: if has_call_parens || complete_call_parens.is_some() {
+ compute_type_match(completion, &ret_type)
+ } else {
+ compute_type_match(completion, &func.ty(db))
+ },
exact_name_match: compute_exact_name_match(completion, &call),
is_op_method,
..ctx.completion_relevance()
@@ -112,42 +132,9 @@ fn render(
.detail(detail)
.lookup_by(name.unescaped().to_smol_str());
- match ctx.completion.config.snippet_cap {
- Some(cap) => {
- let complete_params = match func_kind {
- FuncKind::Function(PathCompletionCtx {
- kind: PathKind::Expr { .. },
- has_call_parens: false,
- ..
- }) => Some(false),
- FuncKind::Method(
- DotAccess {
- kind:
- DotAccessKind::Method { has_parens: false } | DotAccessKind::Field { .. },
- ..
- },
- _,
- ) => Some(true),
- _ => None,
- };
- if let Some(has_dot_receiver) = complete_params {
- if let Some((self_param, params)) =
- params(ctx.completion, func, &func_kind, has_dot_receiver)
- {
- add_call_parens(
- &mut item,
- completion,
- cap,
- call,
- escaped_call,
- self_param,
- params,
- );
- }
- }
- }
- _ => (),
- };
+ if let Some((cap, (self_param, params))) = complete_call_parens {
+ add_call_parens(&mut item, completion, cap, call, escaped_call, self_param, params);
+ }
match ctx.import_to_add {
Some(import_to_add) => {
diff --git a/crates/ide-completion/src/tests/expression.rs b/crates/ide-completion/src/tests/expression.rs
index be5b7f8a34..e6969c8db3 100644
--- a/crates/ide-completion/src/tests/expression.rs
+++ b/crates/ide-completion/src/tests/expression.rs
@@ -26,22 +26,22 @@ fn baz() {
"#,
// This should not contain `FooDesc {…}`.
expect![[r#"
- ct CONST
- en Enum
+ ct CONST Unit
+ en Enum Enum
fn baz() fn()
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
- un Union
+ sc STATIC Unit
+ st FooDesc FooDesc
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
+ un Union Union
ev TupleV(…) TupleV(u32)
- bt u32
+ bt u32 u32
kw crate::
kw false
kw for
@@ -83,7 +83,7 @@ fn func(param0 @ (param1, param2): (i32, i32)) {
lc param0 (i32, i32)
lc param1 i32
lc param2 i32
- bt u32
+ bt u32 u32
kw crate::
kw false
kw for
@@ -117,24 +117,24 @@ impl Unit {
"#,
// `self` is in here twice, once as the module, once as the local
expect![[r#"
- ct CONST
+ ct CONST Unit
cp CONST_PARAM
- en Enum
+ en Enum 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
+ sp Self Unit
+ sc STATIC Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tp TypeParam
- un Union
+ un Union Union
ev TupleV(…) TupleV(u32)
- bt u32
+ bt u32 u32
kw const
kw crate::
kw enum
@@ -181,18 +181,18 @@ impl Unit {
}
"#,
expect![[r#"
- ct CONST
- en Enum
+ ct CONST Unit
+ en Enum Enum
fn function() fn()
ma makro!(…) macro_rules! makro
md module
md qualified
- sc STATIC
- st Record
- st Tuple
- st Unit
+ sc STATIC Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
+ un Union Union
ev TupleV(…) TupleV(u32)
?? Unresolved
"#]],
@@ -211,7 +211,7 @@ fn complete_in_block() {
"#,
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw const
kw crate::
kw enum
@@ -256,7 +256,7 @@ fn complete_after_if_expr() {
"#,
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw const
kw crate::
kw else
@@ -304,7 +304,7 @@ fn complete_in_match_arm() {
"#,
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw crate::
kw false
kw for
@@ -328,7 +328,7 @@ fn completes_in_loop_ctx() {
r"fn my() { loop { $0 } }",
expect![[r#"
fn my() fn()
- bt u32
+ bt u32 u32
kw break
kw const
kw continue
@@ -370,7 +370,7 @@ fn completes_in_let_initializer() {
r#"fn main() { let _ = $0 }"#,
expect![[r#"
fn main() fn()
- bt u32
+ bt u32 u32
kw crate::
kw false
kw for
@@ -403,8 +403,8 @@ fn foo() {
"#,
expect![[r#"
fn foo() fn()
- st Foo
- bt u32
+ st Foo Foo
+ bt u32 u32
kw crate::
kw false
kw for
@@ -439,7 +439,7 @@ fn foo() {
expect![[r#"
fn foo() fn()
lc bar i32
- bt u32
+ bt u32 u32
kw crate::
kw false
kw for
@@ -470,7 +470,7 @@ fn quux(x: i32) {
fn quux(…) fn(i32)
lc x i32
ma m!(…) macro_rules! m
- bt u32
+ bt u32 u32
kw crate::
kw false
kw for
@@ -497,7 +497,7 @@ fn quux(x: i32) {
fn quux(…) fn(i32)
lc x i32
ma m!(…) macro_rules! m
- bt u32
+ bt u32 u32
kw crate::
kw false
kw for
@@ -683,11 +683,11 @@ fn brr() {
}
"#,
expect![[r#"
- en HH
+ en HH HH
fn brr() fn()
- st YoloVariant
+ st YoloVariant YoloVariant
st YoloVariant {…} YoloVariant { f: usize }
- bt u32
+ bt u32 u32
kw crate::
kw false
kw for
@@ -749,7 +749,7 @@ fn foo() { if foo {} $0 }
"#,
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw const
kw crate::
kw else
@@ -789,7 +789,7 @@ fn foo() { if foo {} el$0 }
"#,
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw const
kw crate::
kw else
@@ -829,7 +829,7 @@ fn foo() { bar(if foo {} $0) }
"#,
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw crate::
kw else
kw else if
@@ -853,7 +853,7 @@ fn foo() { bar(if foo {} el$0) }
"#,
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw crate::
kw else
kw else if
@@ -877,7 +877,7 @@ fn foo() { if foo {} $0 let x = 92; }
"#,
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw const
kw crate::
kw else
@@ -917,7 +917,7 @@ fn foo() { if foo {} el$0 let x = 92; }
"#,
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw const
kw crate::
kw else
@@ -957,7 +957,7 @@ fn foo() { if foo {} el$0 { let x = 92; } }
"#,
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw const
kw crate::
kw else
@@ -1009,7 +1009,7 @@ pub struct UnstableThisShouldNotBeListed;
expect![[r#"
fn main() fn()
md std
- bt u32
+ bt u32 u32
kw const
kw crate::
kw enum
@@ -1060,8 +1060,8 @@ pub struct UnstableButWeAreOnNightlyAnyway;
expect![[r#"
fn main() fn()
md std
- st UnstableButWeAreOnNightlyAnyway
- bt u32
+ st UnstableButWeAreOnNightlyAnyway UnstableButWeAreOnNightlyAnyway
+ bt u32 u32
kw const
kw crate::
kw enum
diff --git a/crates/ide-completion/src/tests/flyimport.rs b/crates/ide-completion/src/tests/flyimport.rs
index 21f693d79f..9a4a94a245 100644
--- a/crates/ide-completion/src/tests/flyimport.rs
+++ b/crates/ide-completion/src/tests/flyimport.rs
@@ -139,10 +139,10 @@ fn main() {
}
"#,
expect![[r#"
- st Rc (use dep::Rc)
- st Rcar (use dep::Rcar)
- st Rc (use dep::some_module::Rc)
- st Rcar (use dep::some_module::Rcar)
+ st Rc (use dep::Rc) Rc
+ st Rcar (use dep::Rcar) Rcar
+ st Rc (use dep::some_module::Rc) Rc
+ st Rcar (use dep::some_module::Rcar) Rcar
"#]],
);
check(
@@ -165,12 +165,12 @@ fn main() {
}
"#,
expect![[r#"
- ct RC (use dep::RC)
- st Rc (use dep::Rc)
- st Rcar (use dep::Rcar)
- ct RC (use dep::some_module::RC)
- st Rc (use dep::some_module::Rc)
- st Rcar (use dep::some_module::Rcar)
+ ct RC (use dep::RC) ()
+ st Rc (use dep::Rc) Rc
+ st Rcar (use dep::Rcar) Rcar
+ ct RC (use dep::some_module::RC) ()
+ st Rc (use dep::some_module::Rc) Rc
+ st Rcar (use dep::some_module::Rcar) Rcar
"#]],
);
check(
@@ -193,8 +193,8 @@ fn main() {
}
"#,
expect![[r#"
- ct RC (use dep::RC)
- ct RC (use dep::some_module::RC)
+ ct RC (use dep::RC) ()
+ ct RC (use dep::some_module::RC) ()
"#]],
);
}
@@ -227,10 +227,10 @@ fn main() {
}
"#,
expect![[r#"
- st ThirdStruct (use dep::some_module::ThirdStruct)
- st AfterThirdStruct (use dep::some_module::AfterThirdStruct)
- st ThiiiiiirdStruct (use dep::some_module::ThiiiiiirdStruct)
- "#]],
+ st ThirdStruct (use dep::some_module::ThirdStruct) ThirdStruct
+ st AfterThirdStruct (use dep::some_module::AfterThirdStruct) AfterThirdStruct
+ st ThiiiiiirdStruct (use dep::some_module::ThiiiiiirdStruct) ThiiiiiirdStruct
+ "#]],
);
}
@@ -309,7 +309,7 @@ fn trait_const_fuzzy_completion() {
check(
fixture,
expect![[r#"
- ct SPECIAL_CONST (use dep::test_mod::TestTrait)
+ ct SPECIAL_CONST (use dep::test_mod::TestTrait) u8
"#]],
);
@@ -597,7 +597,7 @@ fn main() {
}
"#,
expect![[r#"
- ct SPECIAL_CONST (use dep::test_mod::TestTrait) DEPRECATED
+ ct SPECIAL_CONST (use dep::test_mod::TestTrait) u8 DEPRECATED
fn weird_function() (use dep::test_mod::TestTrait) fn() DEPRECATED
"#]],
);
@@ -717,7 +717,7 @@ fn main() {
check(
fixture,
expect![[r#"
- st Item (use foo::bar::baz::Item)
+ st Item (use foo::bar::baz::Item) Item
"#]],
);
@@ -759,7 +759,7 @@ fn main() {
check(
fixture,
expect![[r#"
- ct TEST_ASSOC (use foo::Item)
+ ct TEST_ASSOC (use foo::Item) usize
"#]],
);
@@ -803,8 +803,8 @@ fn main() {
check(
fixture,
expect![[r#"
- ct TEST_ASSOC (use foo::bar::Item)
- "#]],
+ ct TEST_ASSOC (use foo::bar::Item) usize
+ "#]],
);
check_edit(
@@ -897,7 +897,7 @@ fn main() {
TES$0
}"#,
expect![[r#"
- ct TEST_CONST (use foo::TEST_CONST)
+ ct TEST_CONST (use foo::TEST_CONST) usize
"#]],
);
@@ -914,7 +914,7 @@ fn main() {
tes$0
}"#,
expect![[r#"
- ct TEST_CONST (use foo::TEST_CONST)
+ ct TEST_CONST (use foo::TEST_CONST) usize
fn test_function() (use foo::test_function) fn() -> i32
"#]],
);
@@ -1138,8 +1138,8 @@ mod mud {
}
"#,
expect![[r#"
- st Struct (use crate::Struct)
- "#]],
+ st Struct (use crate::Struct) Struct
+ "#]],
);
}
@@ -1250,7 +1250,7 @@ enum Foo {
}
}"#,
expect![[r#"
- st Barbara (use foo::Barbara)
+ st Barbara (use foo::Barbara) Barbara
"#]],
)
}
diff --git a/crates/ide-completion/src/tests/item.rs b/crates/ide-completion/src/tests/item.rs
index 3ef2a7c942..de3fd05189 100644
--- a/crates/ide-completion/src/tests/item.rs
+++ b/crates/ide-completion/src/tests/item.rs
@@ -18,15 +18,15 @@ fn target_type_or_trait_in_impl_block() {
impl Tra$0
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -40,15 +40,15 @@ fn target_type_in_trait_impl_block() {
impl Trait for Str$0
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
diff --git a/crates/ide-completion/src/tests/pattern.rs b/crates/ide-completion/src/tests/pattern.rs
index b2e8274a84..67cf551fce 100644
--- a/crates/ide-completion/src/tests/pattern.rs
+++ b/crates/ide-completion/src/tests/pattern.rs
@@ -435,7 +435,7 @@ fn foo() {
}
"#,
expect![[r#"
- st Bar
+ st Bar Bar
kw crate::
kw self::
"#]],
@@ -450,7 +450,7 @@ fn foo() {
}
"#,
expect![[r#"
- st Foo
+ st Foo Foo
kw crate::
kw self::
"#]],
diff --git a/crates/ide-completion/src/tests/predicate.rs b/crates/ide-completion/src/tests/predicate.rs
index 789ad66345..46a3e97d3e 100644
--- a/crates/ide-completion/src/tests/predicate.rs
+++ b/crates/ide-completion/src/tests/predicate.rs
@@ -16,16 +16,16 @@ fn predicate_start() {
struct Foo<'lt, T, const C: usize> where $0 {}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Foo<…>
- st Record
- st Tuple
- st Unit
+ st Foo<…> Foo<'_, {unknown}, _>
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -89,16 +89,16 @@ fn param_list_for_for_pred() {
struct Foo<'lt, T, const C: usize> where for<'a> $0 {}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Foo<…>
- st Record
- st Tuple
- st Unit
+ st Foo<…> Foo<'_, {unknown}, _>
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -114,16 +114,16 @@ impl Record {
}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- sp Self
- st Record
- st Tuple
- st Unit
+ sp Self Record
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
diff --git a/crates/ide-completion/src/tests/record.rs b/crates/ide-completion/src/tests/record.rs
index 65cefdb085..18afde1b7c 100644
--- a/crates/ide-completion/src/tests/record.rs
+++ b/crates/ide-completion/src/tests/record.rs
@@ -186,10 +186,10 @@ fn main() {
lc foo Foo
lc thing i32
md core
- st Foo
+ st Foo Foo
st Foo {…} Foo { foo1: u32, foo2: u32 }
tt Default
- bt u32
+ bt u32 u32
kw crate::
kw self::
"#]],
diff --git a/crates/ide-completion/src/tests/special.rs b/crates/ide-completion/src/tests/special.rs
index d3dbd7cc22..fe5634712a 100644
--- a/crates/ide-completion/src/tests/special.rs
+++ b/crates/ide-completion/src/tests/special.rs
@@ -84,10 +84,10 @@ pub mod prelude {
}
"#,
expect![[r#"
- md std
- st Option
- bt u32
- "#]],
+ md std
+ st Option Option
+ bt u32 u32
+ "#]],
);
}
@@ -112,11 +112,11 @@ mod macros {
}
"#,
expect![[r#"
- fn f() fn()
- ma concat!(…) macro_rules! concat
- md std
- bt u32
- "#]],
+ fn f() fn()
+ ma concat!(…) macro_rules! concat
+ md std
+ bt u32 u32
+ "#]],
);
}
@@ -142,11 +142,11 @@ pub mod prelude {
}
"#,
expect![[r#"
- md core
- md std
- st String
- bt u32
- "#]],
+ md core
+ md std
+ st String String
+ bt u32 u32
+ "#]],
);
}
@@ -171,10 +171,10 @@ pub mod prelude {
}
"#,
expect![[r#"
- fn f() fn()
- md std
- bt u32
- "#]],
+ fn f() fn()
+ md std
+ bt u32 u32
+ "#]],
);
}
@@ -446,10 +446,10 @@ mod p {
}
"#,
expect![[r#"
- ct RIGHT_CONST
- fn right_fn() fn()
- st RightType
- "#]],
+ ct RIGHT_CONST u32
+ fn right_fn() fn()
+ st RightType WrongType
+ "#]],
);
check_edit(
@@ -881,7 +881,7 @@ fn main() {
fn main() fn()
lc foobar i32
ma x!(…) macro_rules! x
- bt u32
+ bt u32 u32
"#]],
)
}
@@ -1008,8 +1008,8 @@ fn here_we_go() {
"#,
expect![[r#"
fn here_we_go() fn()
- st Foo (alias Bar)
- bt u32
+ st Foo (alias Bar) Foo
+ bt u32 u32
kw const
kw crate::
kw enum
@@ -1057,8 +1057,8 @@ fn here_we_go() {
"#,
expect![[r#"
fn here_we_go() fn()
- st Foo (alias Bar, Qux, Baz)
- bt u32
+ st Foo (alias Bar, Qux, Baz) Foo
+ bt u32 u32
kw const
kw crate::
kw enum
@@ -1178,7 +1178,7 @@ fn bar() { qu$0 }
expect![[r#"
fn bar() fn()
fn foo() (alias qux) fn()
- bt u32
+ bt u32 u32
kw const
kw crate::
kw enum
@@ -1227,7 +1227,7 @@ fn here_we_go() {
}
"#,
expect![[r#"
- st Bar (alias Qux)
+ st Bar (alias Qux) Bar
"#]],
);
}
@@ -1246,7 +1246,7 @@ fn here_we_go() {
}
"#,
expect![[r#"
- st Bar (alias Qux)
+ st Bar (alias Qux) Bar
"#]],
);
}
@@ -1267,8 +1267,8 @@ fn here_we_go() {
expect![[r#"
fn here_we_go() fn()
md foo
- st Bar (alias Qux) (use foo::Bar)
- bt u32
+ st Bar (alias Qux) (use foo::Bar) Bar
+ bt u32 u32
kw crate::
kw false
kw for
@@ -1409,7 +1409,7 @@ fn foo() {
Some('_'),
expect![[r#"
fn foo() fn()
- bt u32
+ bt u32 u32
kw const
kw crate::
kw enum
@@ -1461,7 +1461,7 @@ fn foo(_: a_$0) { }
"#,
Some('_'),
expect![[r#"
- bt u32
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -1475,7 +1475,7 @@ fn foo<T>() {
Some('_'),
expect![[r#"
tp T
- bt u32
+ bt u32 u32
kw crate::
kw self::
"#]],
diff --git a/crates/ide-completion/src/tests/type_pos.rs b/crates/ide-completion/src/tests/type_pos.rs
index d518dd7641..c7161f82ce 100644
--- a/crates/ide-completion/src/tests/type_pos.rs
+++ b/crates/ide-completion/src/tests/type_pos.rs
@@ -17,18 +17,18 @@ struct Foo<'lt, T, const C: usize> {
}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- sp Self
- st Foo<…>
- st Record
- st Tuple
- st Unit
+ sp Self Foo<'_, {unknown}, _>
+ st Foo<…> Foo<'_, {unknown}, _>
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
tp T
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -42,18 +42,18 @@ fn tuple_struct_field() {
struct Foo<'lt, T, const C: usize>(f$0);
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- sp Self
- st Foo<…>
- st Record
- st Tuple
- st Unit
+ sp Self Foo<'_, {unknown}, _>
+ st Foo<…> Foo<'_, {unknown}, _>
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
tp T
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw pub
kw pub(crate)
@@ -70,16 +70,16 @@ fn fn_return_type() {
fn x<'lt, T, const C: usize>() -> $0
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
tp T
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -100,19 +100,19 @@ fn foo() -> B$0 {
}
"#,
expect![[r#"
- en Enum
- ma makro!(…) macro_rules! makro
- md module
- st Record
- st Tuple
- st Unit
- tt Trait
- un Union
- bt u32
- it ()
- kw crate::
- kw self::
- "#]],
+ en Enum Enum
+ ma makro!(…) macro_rules! makro
+ md module
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
+ tt Trait
+ un Union Union
+ bt u32 u32
+ it ()
+ kw crate::
+ kw self::
+ "#]],
)
}
@@ -124,16 +124,16 @@ struct Foo<T>(T);
const FOO: $0 = Foo(2);
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Foo<…>
- st Record
- st Tuple
- st Unit
+ st Foo<…> Foo<{unknown}>
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
it Foo<i32>
kw crate::
kw self::
@@ -151,15 +151,15 @@ fn f2() {
}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
it i32
kw crate::
kw self::
@@ -179,15 +179,15 @@ fn f2() {
}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
it u64
kw crate::
kw self::
@@ -204,15 +204,15 @@ fn f2(x: u64) -> $0 {
}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
it u64
kw crate::
kw self::
@@ -230,15 +230,15 @@ fn f2(x: $0) {
}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
it i32
kw crate::
kw self::
@@ -262,17 +262,17 @@ fn foo<'lt, T, const C: usize>() {
}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md a
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
tp T
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
it a::Foo<a::Foo<i32>>
kw crate::
kw self::
@@ -291,17 +291,17 @@ fn foo<'lt, T, const C: usize>() {
}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Foo<…>
- st Record
- st Tuple
- st Unit
+ st Foo<…> Foo<{unknown}>
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
tp T
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
it Foo<i32>
kw crate::
kw self::
@@ -319,16 +319,16 @@ fn foo<'lt, T, const C: usize>() {
}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
tp T
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -341,14 +341,14 @@ fn foo<'lt, T, const C: usize>() {
}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
- un Union
+ un Union Union
"#]],
);
}
@@ -384,18 +384,18 @@ trait Trait2<T>: Trait1 {
fn foo<'lt, T: Trait2<$0>, const CONST_PARAM: usize>(_: T) {}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
tt Trait1
tt Trait2
tp T
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -409,15 +409,15 @@ trait Trait2<T> {
fn foo<'lt, T: Trait2<self::$0>, const CONST_PARAM: usize>(_: T) {}
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt Trait
tt Trait2
- un Union
+ un Union Union
"#]],
);
}
@@ -434,18 +434,18 @@ trait Tr<T> {
impl Tr<$0
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- sp Self
- st Record
- st S
- st Tuple
- st Unit
+ sp Self dyn Tr<{unknown}>
+ st Record Record
+ st S S
+ st Tuple Tuple
+ st Unit Unit
tt Tr
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -481,16 +481,16 @@ trait MyTrait<T, U> {
fn f(t: impl MyTrait<u$0
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt MyTrait
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -506,16 +506,16 @@ trait MyTrait<T, U> {
fn f(t: impl MyTrait<u8, u$0
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt MyTrait
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -549,16 +549,16 @@ trait MyTrait<T, U = u8> {
fn f(t: impl MyTrait<u$0
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt MyTrait
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -574,18 +574,18 @@ trait MyTrait<T, U = u8> {
fn f(t: impl MyTrait<u8, u$0
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt MyTrait
tt Trait
ta Item1 = (as MyTrait) type Item1
ta Item2 = (as MyTrait) type Item2
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -619,16 +619,16 @@ trait MyTrait {
fn f(t: impl MyTrait<Item1 = $0
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt MyTrait
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -644,16 +644,16 @@ trait MyTrait {
fn f(t: impl MyTrait<Item1 = u8, Item2 = $0
"#,
expect![[r#"
- en Enum
+ en Enum Enum
ma makro!(…) macro_rules! makro
md module
- st Record
- st Tuple
- st Unit
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
tt MyTrait
tt Trait
- un Union
- bt u32
+ un Union Union
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -668,7 +668,7 @@ trait MyTrait {
fn f(t: impl MyTrait<C = $0
"#,
expect![[r#"
- ct CONST
+ ct CONST Unit
ma makro!(…) macro_rules! makro
kw crate::
kw self::
@@ -691,9 +691,9 @@ pub struct S;
"#,
expect![[r#"
md std
- sp Self
- st Foo
- bt u32
+ sp Self Foo
+ st Foo Foo
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -716,10 +716,10 @@ pub struct S;
"#,
expect![[r#"
md std
- sp Self
- st Foo
- st S
- bt u32
+ sp Self Foo
+ st Foo Foo
+ st S S
+ bt u32 u32
kw crate::
kw self::
"#]],
@@ -739,19 +739,19 @@ fn completes_const_and_type_generics_separately() {
}
"#,
expect![[r#"
- en Enum
- ma makro!(…) macro_rules! makro
- md module
- st Foo
- st Record
- st Tuple
- st Unit
- tt Trait
- un Union
- bt u32
- kw crate::
- kw self::
- "#]],
+ en Enum Enum
+ ma makro!(…) macro_rules! makro
+ md module
+ st Foo Foo
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
+ tt Trait
+ un Union Union
+ bt u32 u32
+ kw crate::
+ kw self::
+ "#]],
);
// FIXME: This should probably also suggest completions for types, at least those that have
// associated constants usable in this position. For example, a user could be typing
@@ -766,12 +766,12 @@ fn completes_const_and_type_generics_separately() {
}
"#,
expect![[r#"
- ct CONST
- ct X
- ma makro!(…) macro_rules! makro
- kw crate::
- kw self::
- "#]],
+ ct CONST Unit
+ ct X usize
+ ma makro!(…) macro_rules! makro
+ kw crate::
+ kw self::
+ "#]],
);
// Method generic params
@@ -785,19 +785,19 @@ fn completes_const_and_type_generics_separately() {
}
"#,
expect![[r#"
- en Enum
- ma makro!(…) macro_rules! makro
- md module
- st Foo
- st Record
- st Tuple
- st Unit
- tt Trait
- un Union
- bt u32
- kw crate::
- kw self::
- "#]],
+ en Enum Enum
+ ma makro!(…) macro_rules! makro
+ md module
+ st Foo Foo
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
+ tt Trait
+ un Union Union
+ bt u32 u32
+ kw crate::
+ kw self::
+ "#]],
);
check(
r#"
@@ -809,12 +809,12 @@ fn completes_const_and_type_generics_separately() {
}
"#,
expect![[r#"
- ct CONST
- ct X
- ma makro!(…) macro_rules! makro
- kw crate::
- kw self::
- "#]],
+ ct CONST Unit
+ ct X usize
+ ma makro!(…) macro_rules! makro
+ kw crate::
+ kw self::
+ "#]],
);
// Associated type generic params
@@ -828,20 +828,20 @@ fn completes_const_and_type_generics_separately() {
fn foo(_: impl Bar<Baz<F$0, 0> = ()>) {}
"#,
expect![[r#"
- en Enum
- ma makro!(…) macro_rules! makro
- md module
- st Foo
- st Record
- st Tuple
- st Unit
- tt Bar
- tt Trait
- un Union
- bt u32
- kw crate::
- kw self::
- "#]],
+ en Enum Enum
+ ma makro!(…) macro_rules! makro
+ md module
+ st Foo Foo
+ st Record Record
+ st Tuple Tuple
+ st Unit Unit
+ tt Bar
+ tt Trait
+ un Union Union
+ bt u32 u32
+ kw crate::
+ kw self::
+ "#]],
);
check(
r#"
@@ -853,12 +853,12 @@ fn completes_const_and_type_generics_separately() {
fn foo<T: Bar<Baz<(), $0> = ()>>() {}
"#,
expect![[r#"
- ct CONST
- ct X
- ma makro!(…) macro_rules! makro
- kw crate::
- kw self::
- "#]],
+ ct CONST Unit
+ ct X usize
+ ma makro!(…) macro_rules! makro
+ kw crate::
+ kw self::
+ "#]],
);
// Type generic params
@@ -871,12 +871,12 @@ fn completes_const_and_type_generics_separately() {
}
"#,
expect![[r#"
- ct CONST
- ct X
- ma makro!(…) macro_rules! makro
- kw crate::
- kw self::
- "#]],
+ ct CONST Unit
+ ct X usize
+ ma makro!(…) macro_rules! makro
+ kw crate::
+ kw self::
+ "#]],
);
// Type alias generic params
@@ -890,12 +890,12 @@ fn completes_const_and_type_generics_separately() {
}
"#,
expect![[r#"
- ct CONST
- ct X
- ma makro!(…) macro_rules! makro
- kw crate::
- kw self::
- "#]],
+ ct CONST Unit
+ ct X usize
+ ma makro!(…) macro_rules! makro
+ kw crate::
+ kw self::
+ "#]],
);
// Enum variant params
@@ -908,12 +908,12 @@ fn completes_const_and_type_generics_separately() {
}
"#,
expect![[r#"
- ct CONST
- ct X
- ma makro!(…) macro_rules! makro
- kw crate::
- kw self::
- "#]],
+ ct CONST Unit
+ ct X usize
+ ma makro!(…) macro_rules! makro
+ kw crate::
+ kw self::
+ "#]],
);
// Trait params
@@ -924,12 +924,12 @@ fn completes_const_and_type_generics_separately() {
impl Foo<(), $0> for () {}
"#,
expect![[r#"
- ct CONST
- ct X
- ma makro!(…) macro_rules! makro
- kw crate::
- kw self::
- "#]],
+ ct CONST Unit
+ ct X usize
+ ma makro!(…) macro_rules! makro
+ kw crate::
+ kw self::
+ "#]],
);
// Trait alias params
@@ -942,12 +942,12 @@ fn completes_const_and_type_generics_separately() {
fn foo<T: Bar<X$0, ()>>() {}
"#,
expect![[r#"
- ct CONST
- ct X
- ma makro!(…) macro_rules! makro
- kw crate::
- kw self::
- "#]],
+ ct CONST Unit
+ ct X usize
+ ma makro!(…) macro_rules! makro
+ kw crate::
+ kw self::
+ "#]],
);
// Omitted lifetime params
@@ -957,7 +957,7 @@ struct S<'a, 'b, const C: usize, T>(core::marker::PhantomData<&'a &'b T>);
fn foo<'a>() { S::<F$0, _>; }
"#,
expect![[r#"
- ct CONST
+ ct CONST Unit
ma makro!(…) macro_rules! makro
kw crate::
kw self::
@@ -970,7 +970,7 @@ struct S<'a, 'b, const C: usize, T>(core::marker::PhantomData<&'a &'b T>);
fn foo<'a>() { S::<'static, 'static, F$0, _>; }
"#,
expect![[r#"
- ct CONST
+ ct CONST Unit
ma makro!(…) macro_rules! makro
kw crate::
kw self::
diff --git a/crates/ide-completion/src/tests/use_tree.rs b/crates/ide-completion/src/tests/use_tree.rs
index 4c74dba526..167bdec546 100644
--- a/crates/ide-completion/src/tests/use_tree.rs
+++ b/crates/ide-completion/src/tests/use_tree.rs
@@ -65,7 +65,7 @@ use self::{foo::*, bar$0};
"#,
expect![[r#"
md foo
- st S
+ st S S
"#]],
);
}
@@ -82,7 +82,7 @@ mod foo {
use foo::{bar::$0}
"#,
expect![[r#"
- st FooBar
+ st FooBar FooBar
"#]],
);
check(
@@ -115,7 +115,7 @@ mod foo {
use foo::{bar::{baz::$0}}
"#,
expect![[r#"
- st FooBarBaz
+ st FooBarBaz FooBarBaz
"#]],
);
check(
@@ -152,7 +152,7 @@ struct Bar;
"#,
expect![[r#"
ma foo macro_rules! foo_
- st Foo
+ st Foo Foo
"#]],
);
}
@@ -193,7 +193,7 @@ struct Bar;
"#,
expect![[r#"
md foo
- st Bar
+ st Bar Bar
"#]],
);
}
@@ -212,7 +212,7 @@ struct Bar;
expect![[r#"
md bar
md foo
- st Bar
+ st Bar Bar
"#]],
);
}
@@ -230,7 +230,7 @@ mod a {
}
"#,
expect![[r#"
- ct A
+ ct A usize
md b
kw super::
"#]],
@@ -248,7 +248,7 @@ struct Bar;
"#,
expect![[r#"
md foo
- st Bar
+ st Bar Bar
"#]],
);
}
@@ -265,7 +265,7 @@ pub mod foo {}
"#,
expect![[r#"
md foo
- st Foo
+ st Foo Foo
"#]],
);
}
@@ -425,7 +425,7 @@ marco_rules! m { () => {} }
expect![[r#"
fn foo fn()
md simd
- st S
+ st S S
"#]],
);
}