Prefer test duped crates for ide features

This commit is contained in:
Lukas Wirth 2023-04-13 16:43:36 +02:00
parent a4c7a87755
commit e205af259d
10 changed files with 65 additions and 119 deletions

View file

@ -119,7 +119,9 @@ impl SourceToDefCtx<'_, '_> {
pub(super) fn file_to_def(&self, file: FileId) -> SmallVec<[ModuleId; 1]> {
let _p = profile::span("SourceBinder::to_module_def");
let mut mods = SmallVec::new();
for &crate_id in self.db.relevant_crates(file).iter() {
// HACK: We iterate in reverse so that dev-dependency duplicated crates appear first in this
// Most code only deals with one module and we want to prefer the test enabled code where possible
for &crate_id in self.db.relevant_crates(file).iter().rev() {
// FIXME: inner items
let crate_def_map = self.db.crate_def_map(crate_id);
mods.extend(