aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion')
-rw-r--r--crates/ide_completion/src/render.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs
index a0432b806..9ce49074f 100644
--- a/crates/ide_completion/src/render.rs
+++ b/crates/ide_completion/src/render.rs
@@ -1315,4 +1315,42 @@ fn main() {
1315 "#]], 1315 "#]],
1316 ) 1316 )
1317 } 1317 }
1318
1319 #[test]
1320 fn struct_field_method_ref() {
1321 check(
1322 r#"
1323struct Foo { bar: u32 }
1324impl Foo { fn baz(&self) -> u32 { 0 } }
1325
1326fn foo(f: Foo) { let _: &u32 = f.b$0 }
1327"#,
1328 // FIXME
1329 // Ideally we'd also suggest &f.bar and &f.baz() as exact
1330 // type matches. See #8058.
1331 expect![[r#"
1332 [
1333 CompletionItem {
1334 label: "bar",
1335 source_range: 98..99,
1336 delete: 98..99,
1337 insert: "bar",
1338 kind: SymbolKind(
1339 Field,
1340 ),
1341 detail: "u32",
1342 },
1343 CompletionItem {
1344 label: "baz()",
1345 source_range: 98..99,
1346 delete: 98..99,
1347 insert: "baz()$0",
1348 kind: Method,
1349 lookup: "baz",
1350 detail: "fn(&self) -> u32",
1351 },
1352 ]
1353 "#]],
1354 );
1355 }
1318} 1356}