mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 11:20:54 +00:00
Complete extern prelude (again)
This commit is contained in:
parent
ccef48b6c3
commit
699ce06ac3
@ -34,7 +34,7 @@ use crate::{
|
||||
/// module, the set of visible items.
|
||||
#[derive(Default, Debug, PartialEq, Eq)]
|
||||
pub struct ItemMap {
|
||||
extern_prelude: FxHashMap<Name, ModuleDef>,
|
||||
pub(crate) extern_prelude: FxHashMap<Name, ModuleDef>,
|
||||
per_module: ArenaMap<ModuleId, ModuleScope>,
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,10 @@ impl Scope {
|
||||
.entries()
|
||||
.for_each(|(name, res)| {
|
||||
f(name.clone(), res.def.map(Resolution::Def));
|
||||
})
|
||||
});
|
||||
m.item_map.extern_prelude.iter().for_each(|(name, def)| {
|
||||
f(name.clone(), PerNs::types(Resolution::Def(*def)));
|
||||
});
|
||||
}
|
||||
Scope::GenericParams(gp) => {
|
||||
for param in &gp.params {
|
||||
|
@ -110,6 +110,20 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completes_extern_prelude() {
|
||||
check_reference_completion(
|
||||
"extern_prelude",
|
||||
r"
|
||||
//- /lib.rs
|
||||
use <|>;
|
||||
|
||||
//- /other_crate/lib.rs
|
||||
// nothing here
|
||||
",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completes_module_items_in_nested_modules() {
|
||||
check_reference_completion(
|
||||
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
created: "2019-02-04T21:08:32.615556587+00:00"
|
||||
creator: insta@0.5.3
|
||||
expression: kind_completions
|
||||
source: crates/ra_ide_api/src/completion/completion_item.rs
|
||||
---
|
||||
[
|
||||
CompletionItem {
|
||||
completion_kind: Reference,
|
||||
label: "other_crate",
|
||||
kind: Some(
|
||||
Module
|
||||
),
|
||||
detail: None,
|
||||
documentation: None,
|
||||
lookup: None,
|
||||
insert_text: None,
|
||||
insert_text_format: PlainText,
|
||||
source_range: [4; 4),
|
||||
text_edit: None
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user