View Source Lexical.Document.Range (lexical_shared v0.5.0)

A range in a document

Note that ranges represent a cursor position, and so are inclusive of lines, but exclusive of the end position.

Note: To select an entire line, construct a range that runs from the first character on the line to the first character on the next line.

whole_line =
  Range.new(
    Position.new(doc, 1, 1),
    Position.new(doc, 2, 1)
  )

Link to this section Summary

Functions

Returns whether the range contains the given position.

Builds a new range.

Link to this section Types

@type t() :: %Lexical.Document.Range{
  end: Lexical.Document.Position.t(),
  start: Lexical.Document.Position.t()
}

Link to this section Functions

Link to this function

contains?(range, position)

View Source

Returns whether the range contains the given position.

Builds a new range.