Prepare for utf-8 offsets
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user