From f8a056117898c56d34d1758455bc54df50e2e426 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 6 Jan 2021 20:43:46 +0300 Subject: Align config's API with usage The config now is mostly immutable, optimize for that. --- crates/completion/src/config.rs | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) (limited to 'crates/completion/src/config.rs') diff --git a/crates/completion/src/config.rs b/crates/completion/src/config.rs index 9f82b0346..b4439b7d1 100644 --- a/crates/completion/src/config.rs +++ b/crates/completion/src/config.rs @@ -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, pub merge: Option, } - -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), - } - } -} -- cgit v1.2.3