Fix #55612 - fix findTextInFiles cancellation

This commit is contained in:
Rob Lourens
2018-08-01 15:48:12 -07:00
parent 560724f619
commit 55ae86a53d
3 changed files with 39 additions and 20 deletions

View File

@@ -395,7 +395,13 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape {
excludePattern: options.exclude && globPatternToString(options.exclude)
};
let isCanceled = false;
this._activeSearchCallbacks[requestId] = p => {
if (isCanceled) {
return;
}
p.lineMatches.forEach(lineMatch => {
lineMatch.offsetAndLengths.forEach(offsetAndLength => {
const range = new Range(lineMatch.lineNumber, offsetAndLength[0], lineMatch.lineNumber, offsetAndLength[0] + offsetAndLength[1]);
@@ -409,7 +415,10 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape {
};
if (token) {
token.onCancellationRequested(() => this._proxy.$cancelSearch(requestId));
token.onCancellationRequested(() => {
isCanceled = true;
this._proxy.$cancelSearch(requestId);
});
}
return this._proxy.$startTextSearch(query, queryOptions, requestId).then(