Skip to content

Commit 794449a

Browse files
Added comments
1 parent 90254ce commit 794449a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/CollectionItemScopeHandler/RangeIterator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import type { Range } from "@cursorless/common";
22

3+
/**
4+
* An iterator that allows for efficient lookup of ranges that contain a separator.
5+
*/
36
export class RangeIterator<T extends Range> {
47
private index = 0;
58

packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/CollectionItemScopeHandler/createRangeTree.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import type { Range } from "@cursorless/common";
22
import { RangeNode } from "./RangeNode";
33

4+
/**
5+
* Creates a tree of ranges from a list of ranges. This improves containing lookup time.
6+
* @param ranges The ranges to create a tree from.
7+
* @returns The root nodes of the tree.
8+
*/
49
export function createRangeTree(ranges: Range[]): RangeNode[] {
510
const results: RangeNode[] = [];
6-
711
const parents: RangeNode[] = [];
812

913
for (const range of ranges) {

0 commit comments

Comments
 (0)