mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-19 08:40:24 +00:00
Add config to unconditionally prefer core imports over std
Fixes https://github.com/rust-lang/rust-analyzer/issues/12979
This commit is contained in:
parent
6909556435
commit
7d19971666
33 changed files with 156 additions and 43 deletions
|
@ -174,8 +174,12 @@ fn import_edits(ctx: &CompletionContext<'_>, requires: &[GreenNode]) -> Option<V
|
|||
hir::PathResolution::Def(def) => def.into(),
|
||||
_ => return None,
|
||||
};
|
||||
let path =
|
||||
ctx.module.find_use_path_prefixed(ctx.db, item, ctx.config.insert_use.prefix_kind)?;
|
||||
let path = ctx.module.find_use_path_prefixed(
|
||||
ctx.db,
|
||||
item,
|
||||
ctx.config.insert_use.prefix_kind,
|
||||
ctx.config.prefer_core,
|
||||
)?;
|
||||
Some((path.len() > 1).then(|| LocatedImport::new(path.clone(), item, item, None)))
|
||||
};
|
||||
let mut res = Vec::with_capacity(requires.len());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue