Add config for preferring / ignoring prelude modules in find_path

This commit is contained in:
Lukas Wirth 2023-11-11 14:52:11 +01:00
parent 801a887954
commit ba61766217
36 changed files with 260 additions and 54 deletions

View file

@ -664,8 +664,15 @@ impl Module {
db: &dyn DefDatabase,
item: impl Into<ItemInNs>,
prefer_no_std: bool,
prefer_prelude: bool,
) -> Option<ModPath> {
hir_def::find_path::find_path(db, item.into().into(), self.into(), prefer_no_std)
hir_def::find_path::find_path(
db,
item.into().into(),
self.into(),
prefer_no_std,
prefer_prelude,
)
}
/// Finds a path that can be used to refer to the given item from within
@ -676,6 +683,7 @@ impl Module {
item: impl Into<ItemInNs>,
prefix_kind: PrefixKind,
prefer_no_std: bool,
prefer_prelude: bool,
) -> Option<ModPath> {
hir_def::find_path::find_path_prefixed(
db,
@ -683,6 +691,7 @@ impl Module {
self.into(),
prefix_kind,
prefer_no_std,
prefer_prelude,
)
}
}