1
>
/*---------------------------------------------------------------------------------------------
resources.ts
2
>
* Copyright (c) Microsoft Corporation. All rights reserved.
3
>
* Licensed under the MIT License. See License.txt in the project root for license information.
4
>
*--------------------------------------------------------------------------------------------*/
5
>
6
>
import { URI } from '../../base/common/uri.js';
7
>
import { equals } from '../../base/common/objects.js';
8
>
import { isAbsolute } from '../../base/common/path.js';
9
>
import { Emitter } from '../../base/common/event.js';
10
>
import { relativePath } from '../../base/common/resources.js';
11
>
import { Disposable } from '../../base/common/lifecycle.js';
12
>
import { ParsedExpression, IExpression, parse } from '../../base/common/glob.js';
13
>
import { IWorkspaceContextService } from '../../platform/workspace/common/workspace.js';
14
>
import { IConfigurationService, IConfigurationChangeEvent } from '../../platform/configuration/common/configuration.js';
15
>
import { Schemas } from '../../base/common/network.js';
16
>
import { ResourceSet } from '../../base/common/map.js';
17
>
import { getDriveLetter } from '../../base/common/extpath.js';
18
>
19
>
interface IConfiguredExpression {
20
>
readonly expression: IExpression;
21
>
readonly hasAbsolutePath: boolean;
22
>
}
23
>
24
>
export class ResourceGlobMatcher extends Disposable {
25
>
26
>
private static readonly NO_FOLDER = null;
27
>
28
>
private readonly _onExpressionChange = this._register(new Emitter<void>());
29
>
readonly onExpressionChange = this._onExpressionChange.event;
30
>
31
>
private readonly mapFolderToParsedExpression = new Map<string | null, ParsedExpression>();
32
>
private readonly mapFolderToConfiguredExpression = new Map<string | null, IConfiguredExpression>();
33
>
34
>
constructor(
35
private getExpression: (folder?: URI) => IExpression | undefined,
36
private shouldUpdate: (event: IConfigurationChangeEvent) => boolean,