From bccbee5ba3eea3decaf3d00a5dc09dd6cbc632f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20Ochagav=C3=ADa?= Date: Fri, 16 Nov 2018 12:02:45 +0100 Subject: Rename col to col_utf16 --- crates/ra_lsp_server/src/conv.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'crates/ra_lsp_server/src') 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 { fn conv_with(self, line_index: &LineIndex) -> TextUnit { let line_col = LineCol { line: self.line as u32, - col: (self.character as u32).into(), + col_utf16: self.character as u32, }; line_index.offset(line_col) } @@ -63,7 +63,10 @@ impl ConvWith for TextUnit { fn conv_with(self, line_index: &LineIndex) -> Position { let line_col = line_index.line_col(self); - Position::new(u64::from(line_col.line), u64::from(u32::from(line_col.col))) + Position::new( + u64::from(line_col.line), + u64::from(u32::from(line_col.col_utf16)), + ) } } @@ -201,8 +204,10 @@ impl TryConvWith for SourceChange { .map(|it| it.edits.as_slice()) .unwrap_or(&[]); let line_col = translate_offset_with_edit(&*line_index, pos.offset, edits); - let position = - Position::new(u64::from(line_col.line), u64::from(u32::from(line_col.col))); + let position = Position::new( + u64::from(line_col.line), + u64::from(u32::from(line_col.col_utf16)), + ); Some(TextDocumentPositionParams { text_document: TextDocumentIdentifier::new(pos.file_id.try_conv_with(world)?), position, @@ -245,12 +250,12 @@ fn translate_offset_with_edit( if in_edit_line_col.line == 0 { LineCol { line: edit_line_col.line, - col: edit_line_col.col + in_edit_line_col.col, + col_utf16: edit_line_col.col_utf16 + in_edit_line_col.col_utf16, } } else { LineCol { line: edit_line_col.line + in_edit_line_col.line, - col: in_edit_line_col.col, + col_utf16: in_edit_line_col.col_utf16, } } } -- cgit v1.2.3