diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-25 11:16:02 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-25 11:16:02 +0100 |
commit | 29fc409e7fe5b12dcf6bfbcca622d79c4c8fcb72 (patch) | |
tree | e42f7bd1490bca66e0786d5bf2b3194aeaa57a93 /crates/ra_assists/src/assist_ctx.rs | |
parent | 27a7718880d93f55f905da606d108d3b3c682ab4 (diff) | |
parent | e87346950039a54c3f0b02d6056cbb92ca38eb28 (diff) |
Merge #4131
4131: Switch to text-size r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/assist_ctx.rs')
-rw-r--r-- | crates/ra_assists/src/assist_ctx.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index 279163257..2fe7c3de3 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs | |||
@@ -5,7 +5,7 @@ use ra_fmt::{leading_indent, reindent}; | |||
5 | use ra_ide_db::RootDatabase; | 5 | use ra_ide_db::RootDatabase; |
6 | use ra_syntax::{ | 6 | use ra_syntax::{ |
7 | algo::{self, find_covering_element, find_node_at_offset}, | 7 | algo::{self, find_covering_element, find_node_at_offset}, |
8 | AstNode, SourceFile, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextUnit, | 8 | AstNode, SourceFile, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, TextSize, |
9 | TokenAtOffset, | 9 | TokenAtOffset, |
10 | }; | 10 | }; |
11 | use ra_text_edit::TextEditBuilder; | 11 | use ra_text_edit::TextEditBuilder; |
@@ -178,7 +178,7 @@ impl<'a> AssistGroup<'a> { | |||
178 | #[derive(Default)] | 178 | #[derive(Default)] |
179 | pub(crate) struct ActionBuilder { | 179 | pub(crate) struct ActionBuilder { |
180 | edit: TextEditBuilder, | 180 | edit: TextEditBuilder, |
181 | cursor_position: Option<TextUnit>, | 181 | cursor_position: Option<TextSize>, |
182 | target: Option<TextRange>, | 182 | target: Option<TextRange>, |
183 | file: AssistFile, | 183 | file: AssistFile, |
184 | } | 184 | } |
@@ -211,12 +211,12 @@ impl ActionBuilder { | |||
211 | } | 211 | } |
212 | 212 | ||
213 | /// Append specified `text` at the given `offset` | 213 | /// Append specified `text` at the given `offset` |
214 | pub(crate) fn insert(&mut self, offset: TextUnit, text: impl Into<String>) { | 214 | pub(crate) fn insert(&mut self, offset: TextSize, text: impl Into<String>) { |
215 | self.edit.insert(offset, text.into()) | 215 | self.edit.insert(offset, text.into()) |
216 | } | 216 | } |
217 | 217 | ||
218 | /// Specify desired position of the cursor after the assist is applied. | 218 | /// Specify desired position of the cursor after the assist is applied. |
219 | pub(crate) fn set_cursor(&mut self, offset: TextUnit) { | 219 | pub(crate) fn set_cursor(&mut self, offset: TextSize) { |
220 | self.cursor_position = Some(offset) | 220 | self.cursor_position = Some(offset) |
221 | } | 221 | } |
222 | 222 | ||