aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/config.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-01-06 17:43:46 +0000
committerAleksey Kladov <[email protected]>2021-01-06 18:22:24 +0000
commitf8a056117898c56d34d1758455bc54df50e2e426 (patch)
tree429e2c7284476213432b66b02ab9b76f6525eb92 /crates/completion/src/config.rs
parent7ae4b8bdb62735ee767dff25ce1485ae8bffe199 (diff)
Align config's API with usage
The config now is mostly immutable, optimize for that.
Diffstat (limited to 'crates/completion/src/config.rs')
-rw-r--r--crates/completion/src/config.rs26
1 files changed, 1 insertions, 25 deletions
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 @@
4//! module, and we use to statically check that we only produce snippet 4//! module, and we use to statically check that we only produce snippet
5//! completions if we are allowed to. 5//! completions if we are allowed to.
6 6
7use ide_db::helpers::insert_use::MergeBehavior; 7use ide_db::helpers::{insert_use::MergeBehavior, SnippetCap};
8 8
9#[derive(Clone, Debug, PartialEq, Eq)] 9#[derive(Clone, Debug, PartialEq, Eq)]
10pub struct CompletionConfig { 10pub struct CompletionConfig {
@@ -15,27 +15,3 @@ pub struct CompletionConfig {
15 pub snippet_cap: Option<SnippetCap>, 15 pub snippet_cap: Option<SnippetCap>,
16 pub merge: Option<MergeBehavior>, 16 pub merge: Option<MergeBehavior>,
17} 17}
18
19impl CompletionConfig {
20 pub fn allow_snippets(&mut self, yes: bool) {
21 self.snippet_cap = if yes { Some(SnippetCap { _private: () }) } else { None }
22 }
23}
24
25#[derive(Clone, Copy, Debug, PartialEq, Eq)]
26pub struct SnippetCap {
27 _private: (),
28}
29
30impl Default for CompletionConfig {
31 fn default() -> Self {
32 CompletionConfig {
33 enable_postfix_completions: true,
34 enable_autoimport_completions: true,
35 add_call_parenthesis: true,
36 add_call_argument_snippets: true,
37 snippet_cap: Some(SnippetCap { _private: () }),
38 merge: Some(MergeBehavior::Full),
39 }
40 }
41}