diff options
author | Aleksey Kladov <[email protected]> | 2020-04-24 01:01:23 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-24 01:01:23 +0100 |
commit | bd3b2393903de2fc98a50426f36d14dc7e86d8da (patch) | |
tree | 09b92b8f843c642146a7092bfb7ceb8a7c54cb53 /crates/ra_ide/src | |
parent | 88d243c742ecd724372c4293b6b6ea293bae2d17 (diff) |
Move CompletionConfig to a separate module
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/completion.rs | 23 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/completion_config.rs | 16 |
2 files changed, 20 insertions, 19 deletions
diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs index 19bc4321c..f0e02180b 100644 --- a/crates/ra_ide/src/completion.rs +++ b/crates/ra_ide/src/completion.rs | |||
@@ -1,5 +1,6 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | mod completion_config; | ||
3 | mod completion_item; | 4 | mod completion_item; |
4 | mod completion_context; | 5 | mod completion_context; |
5 | mod presentation; | 6 | mod presentation; |
@@ -28,27 +29,11 @@ use crate::{ | |||
28 | FilePosition, | 29 | FilePosition, |
29 | }; | 30 | }; |
30 | 31 | ||
31 | pub use crate::completion::completion_item::{ | 32 | pub use crate::completion::{ |
32 | CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat, | 33 | completion_config::CompletionConfig, |
34 | completion_item::{CompletionItem, CompletionItemKind, CompletionScore, InsertTextFormat}, | ||
33 | }; | 35 | }; |
34 | 36 | ||
35 | #[derive(Clone, Debug, PartialEq, Eq)] | ||
36 | pub struct CompletionConfig { | ||
37 | pub enable_postfix_completions: bool, | ||
38 | pub add_call_parenthesis: bool, | ||
39 | pub add_call_argument_snippets: bool, | ||
40 | } | ||
41 | |||
42 | impl Default for CompletionConfig { | ||
43 | fn default() -> Self { | ||
44 | CompletionConfig { | ||
45 | enable_postfix_completions: true, | ||
46 | add_call_parenthesis: true, | ||
47 | add_call_argument_snippets: true, | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | /// Main entry point for completion. We run completion as a two-phase process. | 37 | /// Main entry point for completion. We run completion as a two-phase process. |
53 | /// | 38 | /// |
54 | /// First, we look at the position and collect a so-called `CompletionContext. | 39 | /// First, we look at the position and collect a so-called `CompletionContext. |
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..c01a8f608 --- /dev/null +++ b/crates/ra_ide/src/completion/completion_config.rs | |||
@@ -0,0 +1,16 @@ | |||
1 | #[derive(Clone, Debug, PartialEq, Eq)] | ||
2 | pub struct CompletionConfig { | ||
3 | pub enable_postfix_completions: bool, | ||
4 | pub add_call_parenthesis: bool, | ||
5 | pub add_call_argument_snippets: bool, | ||
6 | } | ||
7 | |||
8 | impl Default for CompletionConfig { | ||
9 | fn default() -> Self { | ||
10 | CompletionConfig { | ||
11 | enable_postfix_completions: true, | ||
12 | add_call_parenthesis: true, | ||
13 | add_call_argument_snippets: true, | ||
14 | } | ||
15 | } | ||
16 | } | ||