mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Swap
This commit is contained in:
parent
663e11c4b0
commit
59b4916294
1 changed files with 9 additions and 9 deletions
|
@ -9,15 +9,6 @@ use nohash_hasher::IntMap;
|
||||||
|
|
||||||
pub use text_size::{TextRange, TextSize};
|
pub use text_size::{TextRange, TextSize};
|
||||||
|
|
||||||
/// Maps flat [`TextSize`] offsets into `(line, column)` representation.
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
||||||
pub struct LineIndex {
|
|
||||||
/// Offset the beginning of each line, zero-based.
|
|
||||||
newlines: Box<[TextSize]>,
|
|
||||||
/// List of non-ASCII characters on each line.
|
|
||||||
line_wide_chars: IntMap<u32, Box<[WideChar]>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Line/Column information in native, utf8 format.
|
/// Line/Column information in native, utf8 format.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||||
pub struct LineCol {
|
pub struct LineCol {
|
||||||
|
@ -77,6 +68,15 @@ impl WideChar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Maps flat [`TextSize`] offsets into `(line, column)` representation.
|
||||||
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
|
pub struct LineIndex {
|
||||||
|
/// Offset the beginning of each line, zero-based.
|
||||||
|
newlines: Box<[TextSize]>,
|
||||||
|
/// List of non-ASCII characters on each line.
|
||||||
|
line_wide_chars: IntMap<u32, Box<[WideChar]>>,
|
||||||
|
}
|
||||||
|
|
||||||
impl LineIndex {
|
impl LineIndex {
|
||||||
/// Returns a `LineIndex` for the `text`.
|
/// Returns a `LineIndex` for the `text`.
|
||||||
pub fn new(text: &str) -> LineIndex {
|
pub fn new(text: &str) -> LineIndex {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue