mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
Ensure that a search with an immediately canceled token does not actually start a search. Fix possibly flaky findFiles test
This commit is contained in:
@@ -372,6 +372,10 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape {
|
||||
}
|
||||
}
|
||||
|
||||
if (token && token.isCancellationRequested) {
|
||||
return TPromise.wrap([]);
|
||||
}
|
||||
|
||||
const result = this._proxy.$startFileSearch(includePattern, includeFolder, excludePatternOrDisregardExcludes, maxResults, requestId);
|
||||
if (token) {
|
||||
token.onCancellationRequested(() => this._proxy.$cancelSearch(requestId));
|
||||
@@ -428,10 +432,14 @@ export class ExtHostWorkspace implements ExtHostWorkspaceShape {
|
||||
};
|
||||
|
||||
if (token) {
|
||||
token.onCancellationRequested(() => {
|
||||
isCanceled = true;
|
||||
this._proxy.$cancelSearch(requestId);
|
||||
});
|
||||
if (token.isCancellationRequested) {
|
||||
return TPromise.wrap(undefined);
|
||||
} else {
|
||||
token.onCancellationRequested(() => {
|
||||
isCanceled = true;
|
||||
this._proxy.$cancelSearch(requestId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return this._proxy.$startTextSearch(query, queryOptions, requestId).then(
|
||||
|
||||
Reference in New Issue
Block a user