Skip to main content

Crate squawk_line_index

Crate squawk_line_index 

Source
Expand description

See LineIndex.

Forked from rust-analyzer’s line-index. Our changes are tagged with a SQUAWK: comment so they can be reapplied when resyncing with upstream:

  • \r and \r\n start a new line, not just \n. Upstream only breaks on \n, which leaves a classic Mac file looking like one enormous line.
  • [newlines] adds helpers upstream doesn’t have.

Structs§

Line
LineCol
(line, column) information in the native, UTF-8 encoding.
LineIndex
Maps flat TextSize offsets to/from (line, column) representation.
NewlineWithTrailingNewline
Like UniversalNewlineIterator, but includes a trailing newline as an empty line.
TextRange
A range in text, represented as a pair of TextSize.
TextSize
A measure of text length. Also, equivalently, an index into text.
UniversalNewlineIterator
Like str::lines, but accommodates LF, CRLF, and CR line endings, the latter of which are not supported by str::lines.
WideLineCol
(line, column) information in wide encodings.

Enums§

LineEnding
The line ending style used in Python source code. See https://docs.python.org/3/reference/lexical_analysis.html#physical-lines
WideEncoding
A kind of wide character encoding.

Traits§

UniversalNewlines
Extension trait for str that provides a UniversalNewlineIterator.

Functions§

find_newline
Finds the next newline character. Returns its position and the LineEnding.