make search editor ranges work for hidden text

pull/110273/head
Connor Peet 2020-11-10 16:04:00 -08:00
parent 046654ae65
commit 00f32f9a26
No known key found for this signature in database
GPG Key ID: CF8FD2EA0DBC61BD
1 changed files with 4 additions and 4 deletions

View File

@ -223,17 +223,17 @@ function parseSearchResults(document: vscode.TextDocument, token?: vscode.Cancel
let lastEnd = resultStart;
let offset = 0;
let locations: Required<vscode.LocationLink>[] = [];
ELISION_REGEX.lastIndex = resultStart - 1;
ELISION_REGEX.lastIndex = resultStart;
for (let match: RegExpExecArray | null; (match = ELISION_REGEX.exec(line));) {
locations.push({
targetRange,
targetSelectionRange: new vscode.Range(lineNumber, offset, lineNumber, offset),
targetUri: currentTarget,
originSelectionRange: new vscode.Range(i, lastEnd, i, ELISION_REGEX.lastIndex),
originSelectionRange: new vscode.Range(i, lastEnd, i, ELISION_REGEX.lastIndex - match[0].length),
});
offset += (ELISION_REGEX.lastIndex - lastEnd) + Number(match[1]);
lastEnd = ELISION_REGEX.lastIndex + match[0].length;
offset += (ELISION_REGEX.lastIndex - lastEnd - match[0].length) + Number(match[1]);
lastEnd = ELISION_REGEX.lastIndex;
}
if (lastEnd < line.length) {