mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Align config's API with usage
The config now is mostly immutable, optimize for that.
This commit is contained in:
parent
7ae4b8bdb6
commit
f8a0561178
22 changed files with 164 additions and 162 deletions
|
@ -4,7 +4,7 @@
|
|||
//! module, and we use to statically check that we only produce snippet
|
||||
//! completions if we are allowed to.
|
||||
|
||||
use ide_db::helpers::insert_use::MergeBehavior;
|
||||
use ide_db::helpers::{insert_use::MergeBehavior, SnippetCap};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct CompletionConfig {
|
||||
|
@ -15,27 +15,3 @@ pub struct CompletionConfig {
|
|||
pub snippet_cap: Option<SnippetCap>,
|
||||
pub merge: Option<MergeBehavior>,
|
||||
}
|
||||
|
||||
impl CompletionConfig {
|
||||
pub fn allow_snippets(&mut self, yes: bool) {
|
||||
self.snippet_cap = if yes { Some(SnippetCap { _private: () }) } else { None }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
pub struct SnippetCap {
|
||||
_private: (),
|
||||
}
|
||||
|
||||
impl Default for CompletionConfig {
|
||||
fn default() -> Self {
|
||||
CompletionConfig {
|
||||
enable_postfix_completions: true,
|
||||
enable_autoimport_completions: true,
|
||||
add_call_parenthesis: true,
|
||||
add_call_argument_snippets: true,
|
||||
snippet_cap: Some(SnippetCap { _private: () }),
|
||||
merge: Some(MergeBehavior::Full),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue