Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/render.rs')
-rw-r--r--crates/ide-completion/src/render.rs150
1 files changed, 148 insertions, 2 deletions
diff --git a/crates/ide-completion/src/render.rs b/crates/ide-completion/src/render.rs
index 607ca6ff54..9eaa63040a 100644
--- a/crates/ide-completion/src/render.rs
+++ b/crates/ide-completion/src/render.rs
@@ -856,6 +856,7 @@ mod tests {
function: _,
is_skipping_completion: _,
has_local_inherent_impl,
+ is_deprecated,
} = relevance;
let relevance_factors = [
(type_match == Some(CompletionRelevanceTypeMatch::Exact), "type"),
@@ -866,6 +867,7 @@ mod tests {
(trait_.is_some_and(|it| it.is_op_method), "op_method"),
(requires_import, "requires_import"),
(has_local_inherent_impl, "has_local_inherent_impl"),
+ (is_deprecated, "deprecated"),
]
.into_iter()
.filter_map(|(cond, desc)| cond.then_some(desc))
@@ -1249,6 +1251,7 @@ fn main() { Foo::Fo$0 }
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
trigger_call_info: true,
},
@@ -1300,6 +1303,7 @@ fn main() { Foo::Fo$0 }
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
trigger_call_info: true,
},
@@ -1444,6 +1448,7 @@ fn main() { Foo::Fo$0 }
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
trigger_call_info: true,
},
@@ -1528,6 +1533,7 @@ fn main() { let _: m::Spam = S$0 }
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
trigger_call_info: true,
},
@@ -1565,6 +1571,7 @@ fn main() { let _: m::Spam = S$0 }
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
trigger_call_info: true,
},
@@ -1596,6 +1603,20 @@ fn main() { som$0 }
Module,
),
deprecated: true,
+ relevance: CompletionRelevance {
+ exact_name_match: false,
+ type_match: None,
+ is_local: false,
+ trait_: None,
+ is_name_already_imported: false,
+ requires_import: false,
+ is_private_editable: false,
+ postfix_match: None,
+ function: None,
+ is_skipping_completion: false,
+ has_local_inherent_impl: false,
+ is_deprecated: true,
+ },
},
]
"#]],
@@ -1641,6 +1662,20 @@ fn main() { som$0 }
lookup: "something_deprecated",
detail: "fn()",
deprecated: true,
+ relevance: CompletionRelevance {
+ exact_name_match: false,
+ type_match: None,
+ is_local: false,
+ trait_: None,
+ is_name_already_imported: false,
+ requires_import: false,
+ is_private_editable: false,
+ postfix_match: None,
+ function: None,
+ is_skipping_completion: false,
+ has_local_inherent_impl: false,
+ is_deprecated: true,
+ },
},
]
"#]],
@@ -1670,6 +1705,20 @@ fn main() { A$0 }
),
detail: "A",
deprecated: true,
+ relevance: CompletionRelevance {
+ exact_name_match: false,
+ type_match: None,
+ is_local: false,
+ trait_: None,
+ is_name_already_imported: false,
+ requires_import: false,
+ is_private_editable: false,
+ postfix_match: None,
+ function: None,
+ is_skipping_completion: false,
+ has_local_inherent_impl: false,
+ is_deprecated: true,
+ },
},
]
"#]],
@@ -1699,6 +1748,20 @@ fn main() { A$0 }
),
detail: "A",
deprecated: true,
+ relevance: CompletionRelevance {
+ exact_name_match: false,
+ type_match: None,
+ is_local: false,
+ trait_: None,
+ is_name_already_imported: false,
+ requires_import: false,
+ is_private_editable: false,
+ postfix_match: None,
+ function: None,
+ is_skipping_completion: false,
+ has_local_inherent_impl: false,
+ is_deprecated: true,
+ },
},
]
"#]],
@@ -1748,6 +1811,7 @@ fn main() { A::$0 }
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
trigger_call_info: true,
},
@@ -1783,6 +1847,7 @@ fn main() { A::$0 }
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: true,
},
trigger_call_info: true,
},
@@ -1814,6 +1879,20 @@ fn main() { A$0 }
),
detail: "i32",
deprecated: true,
+ relevance: CompletionRelevance {
+ exact_name_match: false,
+ type_match: None,
+ is_local: false,
+ trait_: None,
+ is_name_already_imported: false,
+ requires_import: false,
+ is_private_editable: false,
+ postfix_match: None,
+ function: None,
+ is_skipping_completion: false,
+ has_local_inherent_impl: false,
+ is_deprecated: true,
+ },
},
]
"#]],
@@ -1843,6 +1922,20 @@ fn main() { A$0 }
),
detail: "i32",
deprecated: true,
+ relevance: CompletionRelevance {
+ exact_name_match: false,
+ type_match: None,
+ is_local: false,
+ trait_: None,
+ is_name_already_imported: false,
+ requires_import: false,
+ is_private_editable: false,
+ postfix_match: None,
+ function: None,
+ is_skipping_completion: false,
+ has_local_inherent_impl: false,
+ is_deprecated: true,
+ },
},
]
"#]],
@@ -1869,6 +1962,20 @@ impl A$0
Trait,
),
deprecated: true,
+ relevance: CompletionRelevance {
+ exact_name_match: false,
+ type_match: None,
+ is_local: false,
+ trait_: None,
+ is_name_already_imported: false,
+ requires_import: false,
+ is_private_editable: false,
+ postfix_match: None,
+ function: None,
+ is_skipping_completion: false,
+ has_local_inherent_impl: false,
+ is_deprecated: true,
+ },
},
]
"#]],
@@ -1895,6 +2002,20 @@ fn main() { A$0 }
TypeAlias,
),
deprecated: true,
+ relevance: CompletionRelevance {
+ exact_name_match: false,
+ type_match: None,
+ is_local: false,
+ trait_: None,
+ is_name_already_imported: false,
+ requires_import: false,
+ is_private_editable: false,
+ postfix_match: None,
+ function: None,
+ is_skipping_completion: false,
+ has_local_inherent_impl: false,
+ is_deprecated: true,
+ },
},
]
"#]],
@@ -1925,6 +2046,20 @@ fn main() { a$0 }
lookup: "a!",
detail: "macro_rules! a",
deprecated: true,
+ relevance: CompletionRelevance {
+ exact_name_match: false,
+ type_match: None,
+ is_local: false,
+ trait_: None,
+ is_name_already_imported: false,
+ requires_import: false,
+ is_private_editable: false,
+ postfix_match: None,
+ function: None,
+ is_skipping_completion: false,
+ has_local_inherent_impl: false,
+ is_deprecated: true,
+ },
},
]
"#]],
@@ -1967,6 +2102,7 @@ fn main() { A { the$0 } }
function: None,
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: true,
},
},
]
@@ -2027,6 +2163,7 @@ impl S {
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
},
CompletionItem {
@@ -2119,6 +2256,7 @@ use self::E::*;
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
trigger_call_info: true,
},
@@ -2190,6 +2328,7 @@ fn foo(s: S) { s.$0 }
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
},
]
@@ -2403,6 +2542,7 @@ fn f() -> i32 {
function: None,
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
},
]
@@ -2509,6 +2649,7 @@ fn main() {
function: None,
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
ref_match: "&@65",
},
@@ -3306,6 +3447,7 @@ fn foo(f: Foo) { let _: &u32 = f.b$0 }
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
ref_match: "&@107",
},
@@ -3394,6 +3536,7 @@ fn foo() {
function: None,
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
},
]
@@ -3453,6 +3596,7 @@ fn main() {
),
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
ref_match: "&@92",
},
@@ -3658,8 +3802,8 @@ fn main() {
}
"#,
expect![[r#"
- ct INFINITY f32 [type_could_unify+requires_import]
- ct NEG_INFINITY f32 [type_could_unify+requires_import]
+ ct INFINITY f32 [type_could_unify+requires_import+deprecated]
+ ct NEG_INFINITY f32 [type_could_unify+requires_import+deprecated]
ct INFINITY pub const INFINITY: f32 []
ct NEG_INFINITY pub const NEG_INFINITY: f32 []
"#]],
@@ -3943,6 +4087,7 @@ fn main() {
function: None,
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
},
CompletionItem {
@@ -3978,6 +4123,7 @@ fn main() {
function: None,
is_skipping_completion: false,
has_local_inherent_impl: false,
+ is_deprecated: false,
},
},
]