Prepare for utf-8 offsets

This commit is contained in:
Aleksey Kladov
2021-02-12 21:24:10 +03:00
parent cc49502ab4
commit 2cb4ac9eb4
7 changed files with 30 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
//! Conversion lsp_types types to rust-analyzer specific ones.
use std::convert::TryFrom;
use ide::{Annotation, AnnotationKind, AssistKind, LineCol, LineIndex};
use ide::{Annotation, AnnotationKind, AssistKind, LineColUtf16, LineIndex};
use ide_db::base_db::{FileId, FilePosition, FileRange};
use syntax::{TextRange, TextSize};
use vfs::AbsPathBuf;
@@ -18,7 +18,7 @@ pub(crate) fn vfs_path(url: &lsp_types::Url) -> Result<vfs::VfsPath> {
}
pub(crate) fn offset(line_index: &LineIndex, position: lsp_types::Position) -> TextSize {
let line_col = LineCol { line: position.line as u32, col_utf16: position.character as u32 };
let line_col = LineColUtf16 { line: position.line as u32, col: position.character as u32 };
line_index.offset(line_col)
}