Skip to content

Commit e0dbc9f

Browse files
Update comments
1 parent 47dbf97 commit e0dbc9f

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/RangeLookupList.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class RangeLookupList<T extends { range: Range }> {
88
private index = 0;
99

1010
/**
11-
* @param items The items to iterate over. Must be sorted in document order.
11+
* @param items The items to search in. Must be sorted in document order.
1212
*/
1313
constructor(public items: T[]) {}
1414

packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/RangeLookupTree.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@ import type { Range } from "@cursorless/common";
22
import { RangeTreeNode } from "./RangeTreeNode";
33
import { RangeLookupList } from "./RangeLookupList";
44

5+
/**
6+
* A tree of ranges that allows for efficient lookup of ranges that contain a search item.
7+
* The items must be sorted in document order.
8+
*/
59
export class RangeLookupTree<T extends { range: Range }> {
610
private children: RangeLookupList<RangeTreeNode<T>>;
711

12+
/**
13+
* @param items The items to search in. Must be sorted in document order.
14+
*/
815
constructor(items: T[]) {
916
this.children = createNodes(items);
1017
}
@@ -16,11 +23,6 @@ export class RangeLookupTree<T extends { range: Range }> {
1623
}
1724
}
1825

19-
/**
20-
* Creates a tree of ranges from a list of ranges. This improves containing lookup time.
21-
* @param items The ranges to create a tree from. They must be sorted in document order.
22-
* @returns The root nodes of the tree.
23-
*/
2426
function createNodes<T extends { range: Range }>(
2527
items: T[],
2628
): RangeLookupList<RangeTreeNode<T>> {

0 commit comments

Comments
 (0)