Skip to content

Commit 3dcac4f

Browse files
More clean up
1 parent db385da commit 3dcac4f

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,6 @@ export function getDelimiterOccurrences(
3838
]),
3939
);
4040

41-
const isDisqualified = (range: Range): boolean => {
42-
const delimiter = disqualifyDelimitersIterator.getContaining(range);
43-
return delimiter != null && !delimiter.hasError();
44-
};
45-
46-
const getTextFragmentRange = (range: Range): Range | undefined => {
47-
return textFragmentsIterator.getContaining(range)?.range;
48-
};
49-
5041
const matchIterator = matchAllIterator(
5142
document.getText(),
5243
getDelimiterRegex(individualDelimiters),
@@ -61,10 +52,13 @@ export function getDelimiterOccurrences(
6152
document.positionAt(match.index! + text.length),
6253
);
6354

64-
if (!isDisqualified(range)) {
55+
const delimiter = disqualifyDelimitersIterator.getContaining(range);
56+
const isDisqualified = delimiter != null && !delimiter.hasError();
57+
58+
if (!isDisqualified) {
6559
results.push({
6660
delimiterInfo: delimiterTextToDelimiterInfoMap[text],
67-
textFragmentRange: getTextFragmentRange(range),
61+
textFragmentRange: textFragmentsIterator.getContaining(range)?.range,
6862
range,
6963
});
7064
}

0 commit comments

Comments
 (0)