From 9297f4d991c5738c0d08c3818c6a387525cb05ce Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 13 Mar 2020 09:29:16 +0100 Subject: Add test for completion of unresolved items --- crates/ra_ide/src/completion/complete_scope.rs | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/crates/ra_ide/src/completion/complete_scope.rs b/crates/ra_ide/src/completion/complete_scope.rs index ed55baa64..5ffff5a1c 100644 --- a/crates/ra_ide/src/completion/complete_scope.rs +++ b/crates/ra_ide/src/completion/complete_scope.rs @@ -867,4 +867,38 @@ mod tests { "### ); } + + #[test] + fn completes_unresolved_uses() { + assert_debug_snapshot!( + do_reference_completion( + r" + use spam::Quux; + + fn main() { + <|> + } + " + ), + @r###" + [ + CompletionItem { + label: "Quux", + source_range: [82; 82), + delete: [82; 82), + insert: "Quux", + }, + CompletionItem { + label: "main()", + source_range: [82; 82), + delete: [82; 82), + insert: "main()$0", + kind: Function, + lookup: "main", + detail: "fn main()", + }, + ] + "### + ); + } } -- cgit v1.2.3