diff options
Diffstat (limited to 'crates/ra_assists/src/assist_ctx.rs')
-rw-r--r-- | crates/ra_assists/src/assist_ctx.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index 7fb11d5f5..e240c35d6 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs | |||
@@ -16,7 +16,7 @@ pub(crate) enum Assist { | |||
16 | 16 | ||
17 | /// `AssistCtx` allows to apply an assist or check if it could be applied. | 17 | /// `AssistCtx` allows to apply an assist or check if it could be applied. |
18 | /// | 18 | /// |
19 | /// Assists use a somewhat overengineered approach, given the current needs. The | 19 | /// Assists use a somewhat over-engineered approach, given the current needs. The |
20 | /// assists workflow consists of two phases. In the first phase, a user asks for | 20 | /// assists workflow consists of two phases. In the first phase, a user asks for |
21 | /// the list of available assists. In the second phase, the user picks a | 21 | /// the list of available assists. In the second phase, the user picks a |
22 | /// particular assist and it gets applied. | 22 | /// particular assist and it gets applied. |
@@ -106,6 +106,7 @@ impl<'a, DB: HirDatabase> AssistCtx<'a, DB> { | |||
106 | pub(crate) struct AssistBuilder { | 106 | pub(crate) struct AssistBuilder { |
107 | edit: TextEditBuilder, | 107 | edit: TextEditBuilder, |
108 | cursor_position: Option<TextUnit>, | 108 | cursor_position: Option<TextUnit>, |
109 | target: Option<TextRange>, | ||
109 | } | 110 | } |
110 | 111 | ||
111 | impl AssistBuilder { | 112 | impl AssistBuilder { |
@@ -138,7 +139,15 @@ impl AssistBuilder { | |||
138 | self.cursor_position = Some(offset) | 139 | self.cursor_position = Some(offset) |
139 | } | 140 | } |
140 | 141 | ||
142 | pub(crate) fn target(&mut self, target: TextRange) { | ||
143 | self.target = Some(target) | ||
144 | } | ||
145 | |||
141 | fn build(self) -> AssistAction { | 146 | fn build(self) -> AssistAction { |
142 | AssistAction { edit: self.edit.finish(), cursor_position: self.cursor_position } | 147 | AssistAction { |
148 | edit: self.edit.finish(), | ||
149 | cursor_position: self.cursor_position, | ||
150 | target: self.target, | ||
151 | } | ||
143 | } | 152 | } |
144 | } | 153 | } |