diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-10 17:56:44 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-10 17:56:44 +0000 |
commit | e5df8c402847d5bedb8ebcb621aac46dbe215cdd (patch) | |
tree | 87f12e2619ac0074134b758ddcc1f6c1ccef863a /crates/ra_ide/src/completion.rs | |
parent | daf3609654b6e9b2ac2808a056c61438674a1dc9 (diff) | |
parent | 14094e44770559c13a1e8bdfcfb989d3bedd00d8 (diff) |
Merge #3551
3551: Move FeatureFlags r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/completion.rs')
-rw-r--r-- | crates/ra_ide/src/completion.rs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/crates/ra_ide/src/completion.rs b/crates/ra_ide/src/completion.rs index c378c2c62..a27e0fc15 100644 --- a/crates/ra_ide/src/completion.rs +++ b/crates/ra_ide/src/completion.rs | |||
@@ -33,6 +33,23 @@ pub use crate::completion::completion_item::{ | |||
33 | CompletionItem, CompletionItemKind, InsertTextFormat, | 33 | CompletionItem, CompletionItemKind, InsertTextFormat, |
34 | }; | 34 | }; |
35 | 35 | ||
36 | #[derive(Clone, Debug, PartialEq, Eq)] | ||
37 | pub struct CompletionOptions { | ||
38 | pub enable_postfix_completions: bool, | ||
39 | pub add_call_parenthesis: bool, | ||
40 | pub add_call_argument_snippets: bool, | ||
41 | } | ||
42 | |||
43 | impl Default for CompletionOptions { | ||
44 | fn default() -> Self { | ||
45 | CompletionOptions { | ||
46 | enable_postfix_completions: true, | ||
47 | add_call_parenthesis: true, | ||
48 | add_call_argument_snippets: true, | ||
49 | } | ||
50 | } | ||
51 | } | ||
52 | |||
36 | /// Main entry point for completion. We run completion as a two-phase process. | 53 | /// Main entry point for completion. We run completion as a two-phase process. |
37 | /// | 54 | /// |
38 | /// First, we look at the position and collect a so-called `CompletionContext. | 55 | /// First, we look at the position and collect a so-called `CompletionContext. |
@@ -55,8 +72,12 @@ pub use crate::completion::completion_item::{ | |||
55 | /// `foo` *should* be present among the completion variants. Filtering by | 72 | /// `foo` *should* be present among the completion variants. Filtering by |
56 | /// identifier prefix/fuzzy match should be done higher in the stack, together | 73 | /// identifier prefix/fuzzy match should be done higher in the stack, together |
57 | /// with ordering of completions (currently this is done by the client). | 74 | /// with ordering of completions (currently this is done by the client). |
58 | pub(crate) fn completions(db: &RootDatabase, position: FilePosition) -> Option<Completions> { | 75 | pub(crate) fn completions( |
59 | let ctx = CompletionContext::new(db, position)?; | 76 | db: &RootDatabase, |
77 | position: FilePosition, | ||
78 | opts: &CompletionOptions, | ||
79 | ) -> Option<Completions> { | ||
80 | let ctx = CompletionContext::new(db, position, opts)?; | ||
60 | 81 | ||
61 | let mut acc = Completions::default(); | 82 | let mut acc = Completions::default(); |
62 | 83 | ||