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

@ -4,6 +4,7 @@
//! module, and we use to statically check that we only produce snippet
//! completions if we are allowed to.
use hir::ImportPathConfig;
use ide_db::{imports::insert_use::InsertUseConfig, SnippetCap};
use crate::snippet::Snippet;
@ -45,4 +46,12 @@ impl CompletionConfig {
.iter()
.flat_map(|snip| snip.prefix_triggers.iter().map(move |trigger| (&**trigger, snip)))
}
pub fn import_path_config(&self) -> ImportPathConfig {
ImportPathConfig {
prefer_no_std: self.prefer_no_std,
prefer_prelude: self.prefer_prelude,
prefer_absolute: self.prefer_absolute,
}
}
}