From 8cb139090f969c9e8f8eecf9ffe3cd89624526d5 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 28 Apr 2020 22:45:46 +0200 Subject: Complete union fields after dot --- crates/ra_ide/src/completion/complete_dot.rs | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'crates/ra_ide') diff --git a/crates/ra_ide/src/completion/complete_dot.rs b/crates/ra_ide/src/completion/complete_dot.rs index 814354ffa..05f825c6f 100644 --- a/crates/ra_ide/src/completion/complete_dot.rs +++ b/crates/ra_ide/src/completion/complete_dot.rs @@ -249,6 +249,44 @@ mod tests { ); } + #[test] + fn test_union_field_completion() { + assert_debug_snapshot!( + do_ref_completion( + r" + union Un { + field: u8, + other: u16, + } + + fn foo(u: Un) { + u.<|> + } + ", + ), + @r###" + [ + CompletionItem { + label: "field", + source_range: 140..140, + delete: 140..140, + insert: "field", + kind: Field, + detail: "u8", + }, + CompletionItem { + label: "other", + source_range: 140..140, + delete: 140..140, + insert: "other", + kind: Field, + detail: "u16", + }, + ] + "### + ); + } + #[test] fn test_method_completion() { assert_debug_snapshot!( -- cgit v1.2.3