Skip to content
This page is available as Markdown at /api/traversal/functions/rangeintersects.md. For the full documentation index, see /llms.txt, or the complete corpus at /llms-full.txt.

rangeIntersects

rangeIntersects(snapshot, range, target): boolean

Defined in: range-intersects.ts:30

Returns true if range and the supplied target intersect. The target may be a Path, an EditorSelectionPoint, or another EditorSelection.

For a Path or EditorSelectionPoint target, “intersect” means the target lies at or between range’s start and end edges (inclusive).

For an EditorSelection target, “intersect” means either endpoint of target lies inside range, or range strictly encloses target.

Pass snapshot.context.selection as range to ask the question against the editor’s current selection.

Returns false when either range or target is null.

TraversalSnapshot

EditorSelection

Path | EditorSelectionPoint | EditorSelection

boolean