DocumentRange

Represents a range within a document, defined by a start and end position.

A DocumentRange encapsulates two Position objects, representing the beginning and end of the range, respectively. These positions are zero-based and valid for navigating and selecting content within a textual document.

This class provides utilities for working with document ranges, including calculating the number of lines covered by the range, determining if the range spans multiple lines, and extracting a substring from a given text based on the range.

Constructors

Link copied to clipboard

Properties

Link copied to clipboard

The ending position of the range (exclusive).

Link copied to clipboard

Indicates whether the range spans across multiple lines.

Link copied to clipboard
val lines: Int

The number of lines covered by the range defined by the start and end positions. This computation includes both the start and end lines in the count.

Link copied to clipboard

The starting position of the range (inclusive).

Functions

Link copied to clipboard

Extracts a substring from the given text based on the start and end positions of the DocumentRange.