fix: Fix find_path not respecting non-std preference config correctly

This commit is contained in:
Lukas Wirth 2024-08-10 08:02:03 +02:00
parent 56f63dfd8a
commit 24c0e0bd48
11 changed files with 124 additions and 104 deletions

View file

@ -100,7 +100,6 @@
// }
// ----
use hir::ImportPathConfig;
use ide_db::imports::import_assets::LocatedImport;
use itertools::Itertools;
use syntax::{ast, AstNode, GreenNode, SyntaxNode};
@ -169,11 +168,7 @@ impl Snippet {
}
fn import_edits(ctx: &CompletionContext<'_>, requires: &[GreenNode]) -> Option<Vec<LocatedImport>> {
let import_cfg = ImportPathConfig {
prefer_no_std: ctx.config.prefer_no_std,
prefer_prelude: ctx.config.prefer_prelude,
prefer_absolute: ctx.config.prefer_absolute,
};
let import_cfg = ctx.config.import_path_config();
let resolve = |import: &GreenNode| {
let path = ast::Path::cast(SyntaxNode::new_root(import.clone()))?;