CodeEdit API
  • Introduction
  • Getting Started
    • Creating an Extension
    • Developing an Extension
    • Publishing an Extension
    • Debugging an Extension
  • Guides
    • Building a Completion Extension
    • Building a Treeview Extension
    • Creating a Custom UI
  • API Reference
    • API Object Model
    • CodeEdit Environment
      • Clipboard
    • Workspace
    • TextEditor
      • TextDocument
      • TextEdit
      • Selection
      • Position
      • Range
    • CompletionProvider
      • Context
    • HoverProvider
    • TreeProvider
    • Scope
    • Commands
    • FileSystem
    • Language Server
  • Activation Events
  • Best Practices
  • FAQ
Powered by GitBook
On this page
  • Constructor
  • Properties
  • Methods
  • Examples
Edit on GitHub
  1. API Reference
  2. TextEditor

Range

PreviousPositionNextCompletionProvider

Last updated 3 years ago

A range represents an ordered pair of two positions and is used to reference an area of text inside of a TextEditor object. Range objects are immutable.

Constructor

new Range(start: , end: ):

Properties

end:

isEmpty: boolean

isSingleLine: boolean

length: number

Methods

Examples

start:

isEqual(other: ): boolean

Returns true if the specified range is equal to the range instance, else false.

contains(positionOrRange: | ): boolean

Returns true or false depending on if a specified position or range is contained within the range instance.

intersection(range: ): | undefined

Returns a new range object representing the portion of the specified range that overlaps (intersects) the range instance. Undefined is returned if the compared ranges do not overlap.

union(other: ):

Returns a new range representing the combination (union) of the specified range and the range instance.

with(start?: , end?: ):

Returns a new range derived from the range instance and the specified start or end parameter.

Position
Position
Range
Position
Position
Range
Position
Range
Range
Range
Range
Range
Position
Position
Range