From 58ed8ee6650058d5dc4ce511e2d9c04fdfa09aaf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 11 Feb 2019 15:39:26 +0300 Subject: use extern prelude in Resolver This fixes two bugs: - completion for paths works again - we handle extern prelude shadowing more correctly --- crates/ra_ide_api/src/completion/complete_path.rs | 16 ++++++++++++++++ ...on_item__completes_use_paths_across_crates.snap | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap (limited to 'crates/ra_ide_api') diff --git a/crates/ra_ide_api/src/completion/complete_path.rs b/crates/ra_ide_api/src/completion/complete_path.rs index c47a14e9f..39aefdb13 100644 --- a/crates/ra_ide_api/src/completion/complete_path.rs +++ b/crates/ra_ide_api/src/completion/complete_path.rs @@ -186,4 +186,20 @@ mod tests { ", ); } + + #[test] + fn completes_use_paths_across_crates() { + check_reference_completion( + "completes_use_paths_across_crates", + " + //- /main.rs + use foo::<|>; + + //- /foo/lib.rs + pub mod bar { + pub struct S; + } + ", + ); + } } diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap new file mode 100644 index 000000000..4b40fcf27 --- /dev/null +++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_use_paths_across_crates.snap @@ -0,0 +1,22 @@ +--- +created: "2019-02-11T11:53:02.410665254Z" +creator: insta@0.6.1 +source: crates/ra_ide_api/src/completion/completion_item.rs +expression: kind_completions +--- +[ + CompletionItem { + completion_kind: Reference, + label: "bar", + kind: Some( + Module + ), + detail: None, + documentation: None, + lookup: None, + insert_text: None, + insert_text_format: PlainText, + source_range: [9; 9), + text_edit: None + } +] -- cgit v1.2.3