diff options
Diffstat (limited to 'crates/ra_assists/src/lib.rs')
-rw-r--r-- | crates/ra_assists/src/lib.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 1745f44a5..dd26e192f 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -37,6 +37,7 @@ pub struct GroupLabel(pub String); | |||
37 | #[derive(Debug, Clone)] | 37 | #[derive(Debug, Clone)] |
38 | pub struct Assist { | 38 | pub struct Assist { |
39 | pub id: AssistId, | 39 | pub id: AssistId, |
40 | pub kind: AssistKind, | ||
40 | /// Short description of the assist, as shown in the UI. | 41 | /// Short description of the assist, as shown in the UI. |
41 | pub label: String, | 42 | pub label: String, |
42 | pub group: Option<GroupLabel>, | 43 | pub group: Option<GroupLabel>, |
@@ -51,6 +52,18 @@ pub struct ResolvedAssist { | |||
51 | pub source_change: SourceChange, | 52 | pub source_change: SourceChange, |
52 | } | 53 | } |
53 | 54 | ||
55 | #[derive(Debug, Copy, Clone)] | ||
56 | pub enum AssistKind { | ||
57 | None, | ||
58 | QuickFix, | ||
59 | Refactor, | ||
60 | RefactorExtract, | ||
61 | RefactorInline, | ||
62 | RefactorRewrite, | ||
63 | Source, | ||
64 | OrganizeImports, | ||
65 | } | ||
66 | |||
54 | impl Assist { | 67 | impl Assist { |
55 | /// Return all the assists applicable at the given position. | 68 | /// Return all the assists applicable at the given position. |
56 | /// | 69 | /// |
@@ -86,13 +99,14 @@ impl Assist { | |||
86 | 99 | ||
87 | pub(crate) fn new( | 100 | pub(crate) fn new( |
88 | id: AssistId, | 101 | id: AssistId, |
102 | kind: AssistKind, | ||
89 | label: String, | 103 | label: String, |
90 | group: Option<GroupLabel>, | 104 | group: Option<GroupLabel>, |
91 | target: TextRange, | 105 | target: TextRange, |
92 | ) -> Assist { | 106 | ) -> Assist { |
93 | // FIXME: make fields private, so that this invariant can't be broken | 107 | // FIXME: make fields private, so that this invariant can't be broken |
94 | assert!(label.starts_with(|c: char| c.is_uppercase())); | 108 | assert!(label.starts_with(|c: char| c.is_uppercase())); |
95 | Assist { id, label, group, target } | 109 | Assist { id, kind, label, group, target } |
96 | } | 110 | } |
97 | } | 111 | } |
98 | 112 | ||