mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +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
|
@ -263,6 +263,8 @@ config_data! {
|
|||
imports_group_enable: bool = "true",
|
||||
/// Whether to allow import insertion to merge new imports into single path glob imports like `use std::fmt::*;`.
|
||||
imports_merge_glob: bool = "true",
|
||||
/// Prefer to use imports of the core crate over the std crate.
|
||||
imports_prefer_core: bool = "false",
|
||||
/// The path structure for newly inserted paths to use.
|
||||
imports_prefix: ImportPrefixDef = "\"plain\"",
|
||||
|
||||
|
@ -918,6 +920,7 @@ impl Config {
|
|||
ExprFillDefaultDef::Default => ExprFillDefaultMode::Default,
|
||||
},
|
||||
insert_use: self.insert_use_config(),
|
||||
prefer_core: self.data.imports_prefer_core,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1133,6 +1136,7 @@ impl Config {
|
|||
CallableCompletionDef::None => None,
|
||||
},
|
||||
insert_use: self.insert_use_config(),
|
||||
prefer_core: self.data.imports_prefer_core,
|
||||
snippet_cap: SnippetCap::new(try_or_def!(
|
||||
self.caps
|
||||
.text_document
|
||||
|
@ -1156,6 +1160,7 @@ impl Config {
|
|||
snippet_cap: SnippetCap::new(self.experimental("snippetTextEdit")),
|
||||
allowed: None,
|
||||
insert_use: self.insert_use_config(),
|
||||
prefer_core: self.data.imports_prefer_core,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,6 +145,7 @@ fn integrated_completion_benchmark() {
|
|||
skip_glob_imports: true,
|
||||
},
|
||||
snippets: Vec::new(),
|
||||
prefer_core: false,
|
||||
};
|
||||
let position =
|
||||
FilePosition { file_id, offset: TextSize::try_from(completion_offset).unwrap() };
|
||||
|
@ -182,6 +183,7 @@ fn integrated_completion_benchmark() {
|
|||
skip_glob_imports: true,
|
||||
},
|
||||
snippets: Vec::new(),
|
||||
prefer_core: false,
|
||||
};
|
||||
let position =
|
||||
FilePosition { file_id, offset: TextSize::try_from(completion_offset).unwrap() };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue