aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-10-06 12:43:08 +0100
committerGitHub <[email protected]>2020-10-06 12:43:08 +0100
commitaf0e54a566ab8c8be9b39a628aaa4992f161695c (patch)
tree6b12b51c50d64cd5412271101692d9e39282988f /crates/hir
parent69512dae26278f06b5ac96a7b6093abb69cdd040 (diff)
parent86993310143c1347db6308a66c1f31a7a5644f56 (diff)
Merge #6139
6139: Make find_path_prefixed configurable r=matklad a=Veykril This makes `find_path_prefixed` more configurable allowing one to choose whether it always returns absolute paths, self-prefixed paths or to ignore local imports when building the path. The config names are just thrown in here, taking better names if they exist :) This should fix #6131 as well? Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/code_model.rs4
-rw-r--r--crates/hir/src/lib.rs1
2 files changed, 4 insertions, 1 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index 5721a66c4..a445a97b3 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -4,6 +4,7 @@ use std::{iter, sync::Arc};
4use arrayvec::ArrayVec; 4use arrayvec::ArrayVec;
5use base_db::{CrateId, Edition, FileId}; 5use base_db::{CrateId, Edition, FileId};
6use either::Either; 6use either::Either;
7use hir_def::find_path::PrefixKind;
7use hir_def::{ 8use hir_def::{
8 adt::ReprKind, 9 adt::ReprKind,
9 adt::StructKind, 10 adt::StructKind,
@@ -390,8 +391,9 @@ impl Module {
390 self, 391 self,
391 db: &dyn DefDatabase, 392 db: &dyn DefDatabase,
392 item: impl Into<ItemInNs>, 393 item: impl Into<ItemInNs>,
394 prefix_kind: PrefixKind,
393 ) -> Option<ModPath> { 395 ) -> Option<ModPath> {
394 hir_def::find_path::find_path_prefixed(db, item.into(), self.into()) 396 hir_def::find_path::find_path_prefixed(db, item.into(), self.into(), prefix_kind)
395 } 397 }
396} 398}
397 399
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index b9d9c7e25..87084fa13 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -48,6 +48,7 @@ pub use hir_def::{
48 body::scope::ExprScopes, 48 body::scope::ExprScopes,
49 builtin_type::BuiltinType, 49 builtin_type::BuiltinType,
50 docs::Documentation, 50 docs::Documentation,
51 find_path::PrefixKind,
51 item_scope::ItemInNs, 52 item_scope::ItemInNs,
52 nameres::ModuleSource, 53 nameres::ModuleSource,
53 path::ModPath, 54 path::ModPath,