From a3622eb629bf7acea933d956f8cee902ae357fca Mon Sep 17 00:00:00 2001 From: robojumper Date: Fri, 8 Feb 2019 22:43:13 +0100 Subject: Add some assist ranges --- crates/ra_assists/src/assist_ctx.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'crates/ra_assists/src/assist_ctx.rs') diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index 0bf640241..41c8ac2f6 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 { /// `AssistCtx` allows to apply an assist or check if it could be applied. /// -/// Assists use a somewhat overengineered approach, given the current needs. The +/// Assists use a somewhat over-engineered approach, given the current needs. The /// assists workflow consists of two phases. In the first phase, a user asks for /// the list of available assists. In the second phase, the user picks a /// particular assist and it gets applied. @@ -106,6 +106,7 @@ impl<'a, DB: HirDatabase> AssistCtx<'a, DB> { pub(crate) struct AssistBuilder { edit: TextEditBuilder, cursor_position: Option, + target: Option, } impl AssistBuilder { @@ -138,7 +139,15 @@ impl AssistBuilder { self.cursor_position = Some(offset) } + pub(crate) fn target(&mut self, target: TextRange) { + self.target = Some(target) + } + fn build(self) -> AssistAction { - AssistAction { edit: self.edit.finish(), cursor_position: self.cursor_position } + AssistAction { + edit: self.edit.finish(), + cursor_position: self.cursor_position, + target: self.target, + } } } -- cgit v1.2.3