mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
Split SourceLocation
into LineColumn
and SourceLocation
(#17587)
This commit is contained in:
parent
4443f6653c
commit
1c65e0ad25
29 changed files with 695 additions and 537 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
use std::cell::OnceCell;
|
||||
|
||||
use ruff_source_file::{LineIndex, LineRanges, OneIndexed, SourceCode, SourceLocation};
|
||||
use ruff_source_file::{LineColumn, LineIndex, LineRanges, OneIndexed, SourceCode};
|
||||
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -36,8 +36,8 @@ impl<'a> Locator<'a> {
|
|||
#[deprecated(
|
||||
note = "This is expensive, avoid using outside of the diagnostic phase. Prefer the other `Locator` methods instead."
|
||||
)]
|
||||
pub fn compute_source_location(&self, offset: TextSize) -> SourceLocation {
|
||||
self.to_source_code().source_location(offset)
|
||||
pub fn compute_source_location(&self, offset: TextSize) -> LineColumn {
|
||||
self.to_source_code().line_column(offset)
|
||||
}
|
||||
|
||||
pub fn to_index(&self) -> &LineIndex {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue