aboutsummaryrefslogtreecommitdiff
path: root/crates/assists/src/assist_config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/assists/src/assist_config.rs')
-rw-r--r--crates/assists/src/assist_config.rs30
1 files changed, 30 insertions, 0 deletions
diff --git a/crates/assists/src/assist_config.rs b/crates/assists/src/assist_config.rs
new file mode 100644
index 000000000..cda2abfb9
--- /dev/null
+++ b/crates/assists/src/assist_config.rs
@@ -0,0 +1,30 @@
1//! Settings for tweaking assists.
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//! assists if we are allowed to.
6
7use crate::AssistKind;
8
9#[derive(Clone, Debug, PartialEq, Eq)]
10pub struct AssistConfig {
11 pub snippet_cap: Option<SnippetCap>,
12 pub allowed: Option<Vec<AssistKind>>,
13}
14
15impl AssistConfig {
16 pub fn allow_snippets(&mut self, yes: bool) {
17 self.snippet_cap = if yes { Some(SnippetCap { _private: () }) } else { None }
18 }
19}
20
21#[derive(Clone, Copy, Debug, PartialEq, Eq)]
22pub struct SnippetCap {
23 _private: (),
24}
25
26impl Default for AssistConfig {
27 fn default() -> Self {
28 AssistConfig { snippet_cap: Some(SnippetCap { _private: () }), allowed: None }
29 }
30}