Skip to content

Commit 2caa690

Browse files
committed
Rudimentarily autocomplete tuple struct field access
1 parent ca40ca9 commit 2caa690

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

crates/ra_ide_api/src/completion/complete_dot.rs

+22
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,26 @@ mod tests {
184184
",
185185
);
186186
}
187+
188+
#[test]
189+
fn test_tuple_field_inference() {
190+
check_ref_completion(
191+
"tuple_field_inference",
192+
r"
193+
pub struct S;
194+
impl S {
195+
pub fn blah(&self) {}
196+
}
197+
198+
struct T(S);
199+
200+
impl T {
201+
fn foo(&self) {
202+
// FIXME: This doesn't work without the trailing `a` as `0.` is a float
203+
self.0.a<|>
204+
}
205+
}
206+
",
207+
);
208+
}
187209
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
created: "2019-04-05T23:00:18.283812700Z"
3+
creator: insta@0.7.4
4+
source: crates/ra_ide_api/src/completion/completion_item.rs
5+
expression: kind_completions
6+
---
7+
[
8+
CompletionItem {
9+
label: "blah",
10+
source_range: [299; 300),
11+
delete: [299; 300),
12+
insert: "blah()$0",
13+
kind: Method,
14+
detail: "pub fn blah(&self)"
15+
}
16+
]

0 commit comments

Comments
 (0)