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.rs32
1 files changed, 2 insertions, 30 deletions
diff --git a/crates/assists/src/assist_config.rs b/crates/assists/src/assist_config.rs
index c458d9054..4fe8ea761 100644
--- a/crates/assists/src/assist_config.rs
+++ b/crates/assists/src/assist_config.rs
@@ -4,8 +4,7 @@
4//! module, and we use to statically check that we only produce snippet 4//! module, and we use to statically check that we only produce snippet
5//! assists if we are allowed to. 5//! assists if we are allowed to.
6 6
7use hir::PrefixKind; 7use ide_db::helpers::{insert_use::MergeBehavior, SnippetCap};
8use ide_db::helpers::insert_use::MergeBehavior;
9 8
10use crate::AssistKind; 9use crate::AssistKind;
11 10
@@ -16,35 +15,8 @@ pub struct AssistConfig {
16 pub insert_use: InsertUseConfig, 15 pub insert_use: InsertUseConfig,
17} 16}
18 17
19impl AssistConfig {
20 pub fn allow_snippets(&mut self, yes: bool) {
21 self.snippet_cap = if yes { Some(SnippetCap { _private: () }) } else { None }
22 }
23}
24
25#[derive(Clone, Copy, Debug, PartialEq, Eq)]
26pub struct SnippetCap {
27 _private: (),
28}
29
30impl Default for AssistConfig {
31 fn default() -> Self {
32 AssistConfig {
33 snippet_cap: Some(SnippetCap { _private: () }),
34 allowed: None,
35 insert_use: InsertUseConfig::default(),
36 }
37 }
38}
39
40#[derive(Clone, Copy, Debug, PartialEq, Eq)] 18#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub struct InsertUseConfig { 19pub struct InsertUseConfig {
42 pub merge: Option<MergeBehavior>, 20 pub merge: Option<MergeBehavior>,
43 pub prefix_kind: PrefixKind, 21 pub prefix_kind: hir::PrefixKind,
44}
45
46impl Default for InsertUseConfig {
47 fn default() -> Self {
48 InsertUseConfig { merge: Some(MergeBehavior::Full), prefix_kind: PrefixKind::Plain }
49 }
50} 22}