diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-24 01:27:38 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-24 01:27:38 +0100 |
commit | 3a0a7081f4db293599bce5fab124cf258a946cb2 (patch) | |
tree | 2b3d64141d9797715914e2d26496eee7adb38a11 /crates/ra_ide/src/completion/completion_config.rs | |
parent | 601f89f2cb085ab7e638f034088f32b9428a0611 (diff) | |
parent | 5fd5de4061362aa1066cb9a47aa9cb79eab38e47 (diff) |
Merge #4116
4116: Make sure that adding a snippet requires corresponding capability r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/completion/completion_config.rs')
-rw-r--r-- | crates/ra_ide/src/completion/completion_config.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/crates/ra_ide/src/completion/completion_config.rs b/crates/ra_ide/src/completion/completion_config.rs new file mode 100644 index 000000000..6cf7ed6e4 --- /dev/null +++ b/crates/ra_ide/src/completion/completion_config.rs | |||
@@ -0,0 +1,29 @@ | |||
1 | //! Settings for tweaking completion. | ||
2 | //! | ||
3 | //! The fun thing here is `SnippetCap` -- this type can only be created in this | ||
4 | //! module, and we use to statically check that we only produce snippet | ||
5 | //! completions if we are allowed to. | ||
6 | |||
7 | #[derive(Clone, Debug, PartialEq, Eq)] | ||
8 | pub struct CompletionConfig { | ||
9 | pub enable_postfix_completions: bool, | ||
10 | pub add_call_parenthesis: bool, | ||
11 | pub add_call_argument_snippets: bool, | ||
12 | pub snippet_cap: Option<SnippetCap>, | ||
13 | } | ||
14 | |||
15 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] | ||
16 | pub struct SnippetCap { | ||
17 | _private: (), | ||
18 | } | ||
19 | |||
20 | impl Default for CompletionConfig { | ||
21 | fn default() -> Self { | ||
22 | CompletionConfig { | ||
23 | enable_postfix_completions: true, | ||
24 | add_call_parenthesis: true, | ||
25 | add_call_argument_snippets: true, | ||
26 | snippet_cap: Some(SnippetCap { _private: () }), | ||
27 | } | ||
28 | } | ||
29 | } | ||