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.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs
index cd71ad1eea..15dacc8e46 100644
--- a/crates/ide_completion/src/render.rs
+++ b/crates/ide_completion/src/render.rs
@@ -400,6 +400,7 @@ mod tests {
(relevance.exact_name_match, "name"),
(relevance.is_local, "local"),
(relevance.exact_postfix_snippet_match, "snippet"),
+ (relevance.is_op_method, "op_method"),
]
.into_iter()
.filter_map(|(cond, desc)| if cond { Some(desc) } else { None })
@@ -580,6 +581,7 @@ fn main() { let _: m::Spam = S$0 }
Exact,
),
is_local: false,
+ is_op_method: false,
exact_postfix_snippet_match: false,
},
trigger_call_info: true,
@@ -600,6 +602,7 @@ fn main() { let _: m::Spam = S$0 }
Exact,
),
is_local: false,
+ is_op_method: false,
exact_postfix_snippet_match: false,
},
},
@@ -685,6 +688,7 @@ fn foo() { A { the$0 } }
CouldUnify,
),
is_local: false,
+ is_op_method: false,
exact_postfix_snippet_match: false,
},
},
@@ -1350,6 +1354,23 @@ fn main() {
}
#[test]
+ fn op_method_relevances() {
+ check_relevance(
+ r#"
+#[lang = "sub"]
+trait Sub {
+ fn sub(self, other: Self) -> Self { self }
+}
+impl Sub for u32 {}
+fn foo(a: u32) { a.$0 }
+"#,
+ expect![[r#"
+ me sub(…) (as Sub) [op_method]
+ "#]],
+ )
+ }
+
+ #[test]
fn struct_field_method_ref() {
check_kinds(
r#"