mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Rudimentarily autocomplete tuple struct field access
This commit is contained in:
parent
ca40ca93a5
commit
2caa690ef6
2 changed files with 38 additions and 0 deletions
|
@ -184,4 +184,26 @@ mod tests {
|
||||||
",
|
",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_tuple_field_inference() {
|
||||||
|
check_ref_completion(
|
||||||
|
"tuple_field_inference",
|
||||||
|
r"
|
||||||
|
pub struct S;
|
||||||
|
impl S {
|
||||||
|
pub fn blah(&self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct T(S);
|
||||||
|
|
||||||
|
impl T {
|
||||||
|
fn foo(&self) {
|
||||||
|
// FIXME: This doesn't work without the trailing `a` as `0.` is a float
|
||||||
|
self.0.a<|>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
",
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
---
|
||||||
|
created: "2019-04-05T23:00:18.283812700Z"
|
||||||
|
creator: insta@0.7.4
|
||||||
|
source: crates/ra_ide_api/src/completion/completion_item.rs
|
||||||
|
expression: kind_completions
|
||||||
|
---
|
||||||
|
[
|
||||||
|
CompletionItem {
|
||||||
|
label: "blah",
|
||||||
|
source_range: [299; 300),
|
||||||
|
delete: [299; 300),
|
||||||
|
insert: "blah()$0",
|
||||||
|
kind: Method,
|
||||||
|
detail: "pub fn blah(&self)"
|
||||||
|
}
|
||||||
|
]
|
Loading…
Add table
Add a link
Reference in a new issue