Skip to content

Commit

Permalink
More clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasArvidsson committed Dec 26, 2024
1 parent db385da commit 3dcac4f
Showing 1 changed file with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ export function getDelimiterOccurrences(
]),
);

const isDisqualified = (range: Range): boolean => {
const delimiter = disqualifyDelimitersIterator.getContaining(range);
return delimiter != null && !delimiter.hasError();
};

const getTextFragmentRange = (range: Range): Range | undefined => {
return textFragmentsIterator.getContaining(range)?.range;
};

const matchIterator = matchAllIterator(
document.getText(),
getDelimiterRegex(individualDelimiters),
Expand All @@ -61,10 +52,13 @@ export function getDelimiterOccurrences(
document.positionAt(match.index! + text.length),
);

if (!isDisqualified(range)) {
const delimiter = disqualifyDelimitersIterator.getContaining(range);
const isDisqualified = delimiter != null && !delimiter.hasError();

if (!isDisqualified) {
results.push({
delimiterInfo: delimiterTextToDelimiterInfoMap[text],
textFragmentRange: getTextFragmentRange(range),
textFragmentRange: textFragmentsIterator.getContaining(range)?.range,
range,
});
}
Expand Down

0 comments on commit 3dcac4f

Please sign in to comment.