diff --git a/src/vs/workbench/common/resources.ts b/src/vs/workbench/common/resources.ts index ea523a95f66..6acefead117 100644 --- a/src/vs/workbench/common/resources.ts +++ b/src/vs/workbench/common/resources.ts @@ -148,7 +148,13 @@ export class ResourceGlobMatcher { public matches(resource: URI): boolean { const root = this.contextService.getRoot(resource); - const expressionForRoot = this.mapRootToParsedExpression.get(root ? root.toString() : ResourceGlobMatcher.NO_ROOT); + + let expressionForRoot: ParsedExpression; + if (root && this.mapRootToParsedExpression.has(root.toString())) { + expressionForRoot = this.mapRootToParsedExpression.get(root.toString()); + } else { + expressionForRoot = this.mapRootToParsedExpression.get(ResourceGlobMatcher.NO_ROOT); + } // If the resource if from a workspace, convert its absolute path to a relative // path so that glob patterns have a higher probability to match. For example