diff options
Diffstat (limited to 'crates/assists/src/assist_context.rs')
-rw-r--r-- | crates/assists/src/assist_context.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/crates/assists/src/assist_context.rs b/crates/assists/src/assist_context.rs index 79574b9ac..11c171fc2 100644 --- a/crates/assists/src/assist_context.rs +++ b/crates/assists/src/assist_context.rs | |||
@@ -6,6 +6,7 @@ use algo::find_covering_element; | |||
6 | use base_db::{FileId, FileRange}; | 6 | use base_db::{FileId, FileRange}; |
7 | use hir::Semantics; | 7 | use hir::Semantics; |
8 | use ide_db::{ | 8 | use ide_db::{ |
9 | label::Label, | ||
9 | source_change::{SourceChange, SourceFileEdit}, | 10 | source_change::{SourceChange, SourceFileEdit}, |
10 | RootDatabase, | 11 | RootDatabase, |
11 | }; | 12 | }; |
@@ -157,8 +158,9 @@ impl Assists { | |||
157 | if !self.is_allowed(&id) { | 158 | if !self.is_allowed(&id) { |
158 | return None; | 159 | return None; |
159 | } | 160 | } |
160 | let label = Assist::new(id, label.into(), None, target); | 161 | let label = Label::new(label.into()); |
161 | self.add_impl(label, f) | 162 | let assist = Assist { id, label, group: None, target }; |
163 | self.add_impl(assist, f) | ||
162 | } | 164 | } |
163 | 165 | ||
164 | pub(crate) fn add_group( | 166 | pub(crate) fn add_group( |
@@ -172,12 +174,12 @@ impl Assists { | |||
172 | if !self.is_allowed(&id) { | 174 | if !self.is_allowed(&id) { |
173 | return None; | 175 | return None; |
174 | } | 176 | } |
175 | 177 | let label = Label::new(label.into()); | |
176 | let label = Assist::new(id, label.into(), Some(group.clone()), target); | 178 | let assist = Assist { id, label, group: Some(group.clone()), target }; |
177 | self.add_impl(label, f) | 179 | self.add_impl(assist, f) |
178 | } | 180 | } |
179 | 181 | ||
180 | fn add_impl(&mut self, label: Assist, f: impl FnOnce(&mut AssistBuilder)) -> Option<()> { | 182 | fn add_impl(&mut self, assist: Assist, f: impl FnOnce(&mut AssistBuilder)) -> Option<()> { |
181 | let source_change = if self.resolve { | 183 | let source_change = if self.resolve { |
182 | let mut builder = AssistBuilder::new(self.file); | 184 | let mut builder = AssistBuilder::new(self.file); |
183 | f(&mut builder); | 185 | f(&mut builder); |
@@ -186,7 +188,7 @@ impl Assists { | |||
186 | None | 188 | None |
187 | }; | 189 | }; |
188 | 190 | ||
189 | self.buf.push((label, source_change)); | 191 | self.buf.push((assist, source_change)); |
190 | Some(()) | 192 | Some(()) |
191 | } | 193 | } |
192 | 194 | ||