Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 369e430

Browse files
committed
Improve doc
1 parent 1cf7480 commit 369e430

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/line-index/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ impl LineIndex {
214214
Some(LineCol { line: line_col.line, col })
215215
}
216216

217-
/// Returns an iterator over the ranges for the lines.
217+
/// Given a range [start, end), returns a sorted iterator of non-empty ranges [start, x1), [x1,
218+
/// x2), ..., [xn, end) where all the xi, which are positions of newlines, are inside the range
219+
/// [start, end).
218220
pub fn lines(&self, range: TextRange) -> impl Iterator<Item = TextRange> + '_ {
219221
let lo = self.newlines.partition_point(|&it| it < range.start());
220222
let hi = self.newlines.partition_point(|&it| it <= range.end());

0 commit comments

Comments
 (0)