diff options
Diffstat (limited to 'crates/completion/src/config.rs')
-rw-r--r-- | crates/completion/src/config.rs | 26 |
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 | ||
7 | use ide_db::helpers::insert_use::MergeBehavior; | 7 | use ide_db::helpers::{insert_use::MergeBehavior, SnippetCap}; |
8 | 8 | ||
9 | #[derive(Clone, Debug, PartialEq, Eq)] | 9 | #[derive(Clone, Debug, PartialEq, Eq)] |
10 | pub struct CompletionConfig { | 10 | pub 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 | |||
19 | impl 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)] | ||
26 | pub struct SnippetCap { | ||
27 | _private: (), | ||
28 | } | ||
29 | |||
30 | impl 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 | } | ||