diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 9dbe60f0179..ee06e960550 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1174,6 +1174,10 @@ namespace ts { const children = n.getChildren(sourceFile); const i = binarySearchKey(children, position, (_, i) => i, (middle, _) => { + // This last callback is more of a selector than a comparator - + // `EqualTo` causes the `middle` result to be returned + // `GreaterThan` causes recursion on the left of the middle + // `LessThan` causes recursion on the right of the middle if (position < children[middle].end) { // first element whose end position is greater than the input position if (!children[middle - 1] || position >= children[middle - 1].end) {