diff --git a/src/vs/workbench/api/node/extHostSearch.ts b/src/vs/workbench/api/node/extHostSearch.ts index b520cad5704..6195054e756 100644 --- a/src/vs/workbench/api/node/extHostSearch.ts +++ b/src/vs/workbench/api/node/extHostSearch.ts @@ -335,16 +335,22 @@ class QueryGlobTester { /** * Guaranteed async. */ - public async includedInQuery(testPath: string, basename?: string, siblingsFn?: () => string[] | TPromise): TPromise { - if (this._parsedExcludeExpression && await this._parsedExcludeExpression(testPath, basename, siblingsFn)) { - return false; - } + public includedInQuery(testPath: string, basename?: string, siblingsFn?: () => string[] | TPromise): TPromise { + const excludeP = this._parsedExcludeExpression ? + TPromise.as(this._parsedExcludeExpression(testPath, basename, siblingsFn)).then(result => !!result) : + TPromise.wrap(false); - if (this._parsedIncludeExpression && !await this._parsedIncludeExpression(testPath, basename, siblingsFn)) { - return false; - } + return excludeP.then(excluded => { + if (excluded) { + return false; + } - return true; + return this._parsedIncludeExpression ? + TPromise.as(this._parsedIncludeExpression(testPath, basename, siblingsFn)).then(result => !result) : + TPromise.wrap(true); + }).then(included => { + return included; + }); } public hasSiblingExcludeClauses(): boolean {