Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/config.rs')
-rw-r--r--crates/ide-completion/src/config.rs22
1 files changed, 17 insertions, 5 deletions
diff --git a/crates/ide-completion/src/config.rs b/crates/ide-completion/src/config.rs
index 844fce5ef8..5623257a27 100644
--- a/crates/ide-completion/src/config.rs
+++ b/crates/ide-completion/src/config.rs
@@ -4,12 +4,15 @@
//! module, and we use to statically check that we only produce snippet
//! completions if we are allowed to.
-use hir::ImportPathConfig;
-use ide_db::{SnippetCap, imports::insert_use::InsertUseConfig};
+use hir::FindPathConfig;
+use ide_db::{
+ MiniCore, SnippetCap,
+ imports::{import_assets::ImportPathConfig, insert_use::InsertUseConfig},
+};
use crate::{CompletionFieldsToResolve, snippet::Snippet};
-#[derive(Clone, Debug, PartialEq, Eq)]
+#[derive(Clone, Debug)]
pub struct CompletionConfig<'a> {
pub enable_postfix_completions: bool,
pub enable_imports_on_the_fly: bool,
@@ -32,6 +35,7 @@ pub struct CompletionConfig<'a> {
pub fields_to_resolve: CompletionFieldsToResolve,
pub exclude_flyimport: Vec<(String, AutoImportExclusionType)>,
pub exclude_traits: &'a [String],
+ pub minicore: MiniCore<'a>,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
@@ -59,12 +63,20 @@ impl CompletionConfig<'_> {
.flat_map(|snip| snip.prefix_triggers.iter().map(move |trigger| (&**trigger, snip)))
}
- pub fn import_path_config(&self, allow_unstable: bool) -> ImportPathConfig {
- ImportPathConfig {
+ pub fn find_path_config(&self, allow_unstable: bool) -> FindPathConfig {
+ FindPathConfig {
prefer_no_std: self.prefer_no_std,
prefer_prelude: self.prefer_prelude,
prefer_absolute: self.prefer_absolute,
allow_unstable,
}
}
+
+ 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,
+ }
+ }
}