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

@@ -5,7 +5,7 @@ use std::{env, path::PathBuf, str::FromStr, sync::Arc, time::Instant};
use anyhow::{bail, format_err, Result};
use hir::PrefixKind;
use ide::{
Analysis, AnalysisHost, Change, CompletionConfig, DiagnosticsConfig, FilePosition, LineCol,
Analysis, AnalysisHost, Change, CompletionConfig, DiagnosticsConfig, FilePosition, LineColUtf16,
};
use ide_db::{
base_db::{
@@ -97,7 +97,7 @@ impl BenchCmd {
let offset = host
.analysis()
.file_line_index(file_id)?
.offset(LineCol { line: pos.line - 1, col_utf16: pos.column });
.offset(LineColUtf16 { line: pos.line - 1, col: pos.column });
let file_position = FilePosition { file_id, offset };
if is_completion {

View File

@@ -218,9 +218,9 @@ impl AnalysisStatsCmd {
bar.println(format!(
"{}:{}-{}:{}: {}",
start.line + 1,
start.col_utf16,
start.col,
end.line + 1,
end.col_utf16,
end.col,
ty.display(db)
));
} else {
@@ -250,9 +250,9 @@ impl AnalysisStatsCmd {
"{} {}:{}-{}:{}: Expected {}, got {}",
path,
start.line + 1,
start.col_utf16,
start.col,
end.line + 1,
end.col_utf16,
end.col,
mismatch.expected.display(db),
mismatch.actual.display(db)
));