diff options
author | Jeremy Kolb <[email protected]> | 2020-06-28 23:36:05 +0100 |
---|---|---|
committer | kjeremy <[email protected]> | 2020-07-02 22:13:02 +0100 |
commit | b98c16a034620913f3dbc67bd3f48ad2686face7 (patch) | |
tree | 10f90c96791cfd82bb160a1a5c7474ccc17d5b8b /crates/ra_assists/src/assist_context.rs | |
parent | 4cb8bf03c588dcf244d25785de3878b6ef3f7958 (diff) |
Categorize assists
Diffstat (limited to 'crates/ra_assists/src/assist_context.rs')
-rw-r--r-- | crates/ra_assists/src/assist_context.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_assists/src/assist_context.rs b/crates/ra_assists/src/assist_context.rs index 3640bb4d2..c35d0254a 100644 --- a/crates/ra_assists/src/assist_context.rs +++ b/crates/ra_assists/src/assist_context.rs | |||
@@ -19,7 +19,7 @@ use ra_text_edit::TextEditBuilder; | |||
19 | 19 | ||
20 | use crate::{ | 20 | use crate::{ |
21 | assist_config::{AssistConfig, SnippetCap}, | 21 | assist_config::{AssistConfig, SnippetCap}, |
22 | Assist, AssistId, GroupLabel, ResolvedAssist, | 22 | Assist, AssistId, AssistKind, GroupLabel, ResolvedAssist, |
23 | }; | 23 | }; |
24 | 24 | ||
25 | /// `AssistContext` allows to apply an assist or check if it could be applied. | 25 | /// `AssistContext` allows to apply an assist or check if it could be applied. |
@@ -135,22 +135,24 @@ impl Assists { | |||
135 | pub(crate) fn add( | 135 | pub(crate) fn add( |
136 | &mut self, | 136 | &mut self, |
137 | id: AssistId, | 137 | id: AssistId, |
138 | kind: AssistKind, | ||
138 | label: impl Into<String>, | 139 | label: impl Into<String>, |
139 | target: TextRange, | 140 | target: TextRange, |
140 | f: impl FnOnce(&mut AssistBuilder), | 141 | f: impl FnOnce(&mut AssistBuilder), |
141 | ) -> Option<()> { | 142 | ) -> Option<()> { |
142 | let label = Assist::new(id, label.into(), None, target); | 143 | let label = Assist::new(id, kind, label.into(), None, target); |
143 | self.add_impl(label, f) | 144 | self.add_impl(label, f) |
144 | } | 145 | } |
145 | pub(crate) fn add_group( | 146 | pub(crate) fn add_group( |
146 | &mut self, | 147 | &mut self, |
147 | group: &GroupLabel, | 148 | group: &GroupLabel, |
148 | id: AssistId, | 149 | id: AssistId, |
150 | kind: AssistKind, | ||
149 | label: impl Into<String>, | 151 | label: impl Into<String>, |
150 | target: TextRange, | 152 | target: TextRange, |
151 | f: impl FnOnce(&mut AssistBuilder), | 153 | f: impl FnOnce(&mut AssistBuilder), |
152 | ) -> Option<()> { | 154 | ) -> Option<()> { |
153 | let label = Assist::new(id, label.into(), Some(group.clone()), target); | 155 | let label = Assist::new(id, kind, label.into(), Some(group.clone()), target); |
154 | self.add_impl(label, f) | 156 | self.add_impl(label, f) |
155 | } | 157 | } |
156 | fn add_impl(&mut self, label: Assist, f: impl FnOnce(&mut AssistBuilder)) -> Option<()> { | 158 | fn add_impl(&mut self, label: Assist, f: impl FnOnce(&mut AssistBuilder)) -> Option<()> { |