Skip to content

Commit b3050bd

Browse files
committed
Introduce internal snippet cap
1 parent bd3b239 commit b3050bd

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

crates/ra_ide/src/completion/completion_config.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
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+
17
#[derive(Clone, Debug, PartialEq, Eq)]
28
pub struct CompletionConfig {
39
pub enable_postfix_completions: bool,
410
pub add_call_parenthesis: bool,
511
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: (),
618
}
719

820
impl Default for CompletionConfig {
@@ -11,6 +23,7 @@ impl Default for CompletionConfig {
1123
enable_postfix_completions: true,
1224
add_call_parenthesis: true,
1325
add_call_argument_snippets: true,
26+
snippet_cap: Some(SnippetCap { _private: () }),
1427
}
1528
}
1629
}

crates/rust-analyzer/src/config.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl Default for Config {
104104
enable_postfix_completions: true,
105105
add_call_parenthesis: true,
106106
add_call_argument_snippets: true,
107+
..CompletionConfig::default()
107108
},
108109
call_info_full: true,
109110
}

0 commit comments

Comments
 (0)