aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/conv.rs
diff options
context:
space:
mode:
authorAdolfo OchagavĂ­a <[email protected]>2018-11-16 11:02:45 +0000
committerAdolfo OchagavĂ­a <[email protected]>2018-11-16 11:15:50 +0000
commitbccbee5ba3eea3decaf3d00a5dc09dd6cbc632f1 (patch)
treea499262a1aa2ed51a4af0bbbdf4028aa2cc01fd0 /crates/ra_lsp_server/src/conv.rs
parent136d1864bcb5046e7f334ac347a8a94946d1ba90 (diff)
Rename col to col_utf16
Diffstat (limited to 'crates/ra_lsp_server/src/conv.rs')
-rw-r--r--crates/ra_lsp_server/src/conv.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs
index a102b9105..5d5a0c55e 100644
--- a/crates/ra_lsp_server/src/conv.rs
+++ b/crates/ra_lsp_server/src/conv.rs
@@ -51,7 +51,7 @@ impl ConvWith for Position {
51 fn conv_with(self, line_index: &LineIndex) -> TextUnit { 51 fn conv_with(self, line_index: &LineIndex) -> TextUnit {
52 let line_col = LineCol { 52 let line_col = LineCol {
53 line: self.line as u32, 53 line: self.line as u32,
54 col: (self.character as u32).into(), 54 col_utf16: self.character as u32,
55 }; 55 };
56 line_index.offset(line_col) 56 line_index.offset(line_col)
57 } 57 }
@@ -63,7 +63,10 @@ impl ConvWith for TextUnit {
63 63
64 fn conv_with(self, line_index: &LineIndex) -> Position { 64 fn conv_with(self, line_index: &LineIndex) -> Position {
65 let line_col = line_index.line_col(self); 65 let line_col = line_index.line_col(self);
66 Position::new(u64::from(line_col.line), u64::from(u32::from(line_col.col))) 66 Position::new(
67 u64::from(line_col.line),
68 u64::from(u32::from(line_col.col_utf16)),
69 )
67 } 70 }
68} 71}
69 72
@@ -201,8 +204,10 @@ impl TryConvWith for SourceChange {
201 .map(|it| it.edits.as_slice()) 204 .map(|it| it.edits.as_slice())
202 .unwrap_or(&[]); 205 .unwrap_or(&[]);
203 let line_col = translate_offset_with_edit(&*line_index, pos.offset, edits); 206 let line_col = translate_offset_with_edit(&*line_index, pos.offset, edits);
204 let position = 207 let position = Position::new(
205 Position::new(u64::from(line_col.line), u64::from(u32::from(line_col.col))); 208 u64::from(line_col.line),
209 u64::from(u32::from(line_col.col_utf16)),
210 );
206 Some(TextDocumentPositionParams { 211 Some(TextDocumentPositionParams {
207 text_document: TextDocumentIdentifier::new(pos.file_id.try_conv_with(world)?), 212 text_document: TextDocumentIdentifier::new(pos.file_id.try_conv_with(world)?),
208 position, 213 position,
@@ -245,12 +250,12 @@ fn translate_offset_with_edit(
245 if in_edit_line_col.line == 0 { 250 if in_edit_line_col.line == 0 {
246 LineCol { 251 LineCol {
247 line: edit_line_col.line, 252 line: edit_line_col.line,
248 col: edit_line_col.col + in_edit_line_col.col, 253 col_utf16: edit_line_col.col_utf16 + in_edit_line_col.col_utf16,
249 } 254 }
250 } else { 255 } else {
251 LineCol { 256 LineCol {
252 line: edit_line_col.line + in_edit_line_col.line, 257 line: edit_line_col.line + in_edit_line_col.line,
253 col: in_edit_line_col.col, 258 col_utf16: in_edit_line_col.col_utf16,
254 } 259 }
255 } 260 }
256} 261}