Skip to content

Commit 46aa82e

Browse files
Update packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler/RangeLookupList.ts
Co-authored-by: Pokey Rule <[email protected]>
1 parent 195f94c commit 46aa82e

File tree

1 file changed

+6
-3
lines changed
  • packages/cursorless-engine/src/processTargets/modifiers/scopeHandlers/SurroundingPairScopeHandler

1 file changed

+6
-3
lines changed

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

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

33
/**
4-
* An iterator that allows for efficient lookup of ranges that contain a search item.
5-
* The items must be sorted in document order.
4+
* Given a list of ranges (the haystack), allows the client to search for a sequence of ranges (the needles).
5+
* Has the following requirements:
6+
* - the haystack must be sorted in document order
7+
* - **the needles must be in document order as well**. This enables us to avoid backtracking as you search for a sequence of items.
8+
* - the haystack entries must not overlap. Adjacent is fine
69
*/
7-
export class RangeLookupList<T extends { range: Range }> {
10+
export class OneWayRangeFinder<T extends { range: Range }> {
811
private index = 0;
912

1013
/**

0 commit comments

Comments
 (0)