@theia/workspace 1.70.0-next.1 → 1.70.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/index.d.ts +1 -0
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +1 -0
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/workspace-files-exclude-filter-provider.d.ts +15 -0
- package/lib/browser/workspace-files-exclude-filter-provider.d.ts.map +1 -0
- package/lib/browser/workspace-files-exclude-filter-provider.js +58 -0
- package/lib/browser/workspace-files-exclude-filter-provider.js.map +1 -0
- package/lib/browser/workspace-frontend-module.d.ts.map +1 -1
- package/lib/browser/workspace-frontend-module.js +6 -0
- package/lib/browser/workspace-frontend-module.js.map +1 -1
- package/lib/browser/workspace-search-filter-service.d.ts +29 -0
- package/lib/browser/workspace-search-filter-service.d.ts.map +1 -0
- package/lib/browser/workspace-search-filter-service.js +72 -0
- package/lib/browser/workspace-search-filter-service.js.map +1 -0
- package/lib/browser/workspace-search-filter-service.spec.d.ts +2 -0
- package/lib/browser/workspace-search-filter-service.spec.d.ts.map +1 -0
- package/lib/browser/workspace-search-filter-service.spec.js +119 -0
- package/lib/browser/workspace-search-filter-service.spec.js.map +1 -0
- package/package.json +5 -5
- package/src/browser/index.ts +1 -0
- package/src/browser/workspace-files-exclude-filter-provider.ts +48 -0
- package/src/browser/workspace-frontend-module.ts +7 -0
- package/src/browser/workspace-search-filter-service.spec.ts +139 -0
- package/src/browser/workspace-search-filter-service.ts +74 -0
package/lib/browser/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAgBA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAgBA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC"}
|
package/lib/browser/index.js
CHANGED
|
@@ -23,4 +23,5 @@ tslib_1.__exportStar(require("./workspace-frontend-contribution"), exports);
|
|
|
23
23
|
tslib_1.__exportStar(require("./workspace-frontend-module"), exports);
|
|
24
24
|
tslib_1.__exportStar(require("./workspace-trust-service"), exports);
|
|
25
25
|
tslib_1.__exportStar(require("./metadata-storage"), exports);
|
|
26
|
+
tslib_1.__exportStar(require("./workspace-search-filter-service"), exports);
|
|
26
27
|
//# sourceMappingURL=index.js.map
|
package/lib/browser/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,+DAAqC;AACrC,8DAAoC;AACpC,kEAAwC;AACxC,4EAAkD;AAClD,sEAA4C;AAC5C,oEAA0C;AAC1C,6DAAmC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,+DAAqC;AACrC,8DAAoC;AACpC,kEAAwC;AACxC,4EAAkD;AAClD,sEAA4C;AAC5C,oEAA0C;AAC1C,6DAAmC;AACnC,4EAAkD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Emitter, Event } from '@theia/core';
|
|
2
|
+
import { FileSystemPreferences } from '@theia/filesystem/lib/common';
|
|
3
|
+
import { WorkspaceSearchFilterProvider } from './workspace-search-filter-service';
|
|
4
|
+
/**
|
|
5
|
+
* A workspace search filter provider that contributes the user-configurable
|
|
6
|
+
* "Files: Exclude" settings from the preferences.
|
|
7
|
+
*/
|
|
8
|
+
export declare class WorkspaceFilesExcludeFilterProvider implements WorkspaceSearchFilterProvider {
|
|
9
|
+
protected readonly fsPreferences: FileSystemPreferences;
|
|
10
|
+
protected readonly onExclusionGlobsChangedEmitter: Emitter<void>;
|
|
11
|
+
readonly onExclusionGlobsChanged: Event<void>;
|
|
12
|
+
protected init(): void;
|
|
13
|
+
getExclusionGlobs(): string[];
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=workspace-files-exclude-filter-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-files-exclude-filter-provider.d.ts","sourceRoot":"","sources":["../../src/browser/workspace-files-exclude-filter-provider.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAElF;;;GAGG;AACH,qBACa,mCAAoC,YAAW,6BAA6B;IAGrF,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;IAExD,SAAS,CAAC,QAAQ,CAAC,8BAA8B,gBAAuB;IACxE,QAAQ,CAAC,uBAAuB,EAAE,KAAK,CAAC,IAAI,CAAC,CAA6C;IAG1F,SAAS,CAAC,IAAI,IAAI,IAAI;IAQtB,iBAAiB,IAAI,MAAM,EAAE;CAIhC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.WorkspaceFilesExcludeFilterProvider = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const core_1 = require("@theia/core");
|
|
21
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
const common_1 = require("@theia/filesystem/lib/common");
|
|
23
|
+
/**
|
|
24
|
+
* A workspace search filter provider that contributes the user-configurable
|
|
25
|
+
* "Files: Exclude" settings from the preferences.
|
|
26
|
+
*/
|
|
27
|
+
let WorkspaceFilesExcludeFilterProvider = class WorkspaceFilesExcludeFilterProvider {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.onExclusionGlobsChangedEmitter = new core_1.Emitter();
|
|
30
|
+
this.onExclusionGlobsChanged = this.onExclusionGlobsChangedEmitter.event;
|
|
31
|
+
}
|
|
32
|
+
init() {
|
|
33
|
+
this.fsPreferences.onPreferenceChanged(e => {
|
|
34
|
+
if (e.preferenceName === 'files.exclude') {
|
|
35
|
+
this.onExclusionGlobsChangedEmitter.fire();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
getExclusionGlobs() {
|
|
40
|
+
const filesExclude = this.fsPreferences['files.exclude'];
|
|
41
|
+
return Object.keys(filesExclude).filter(key => !!filesExclude[key]);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.WorkspaceFilesExcludeFilterProvider = WorkspaceFilesExcludeFilterProvider;
|
|
45
|
+
tslib_1.__decorate([
|
|
46
|
+
(0, inversify_1.inject)(common_1.FileSystemPreferences),
|
|
47
|
+
tslib_1.__metadata("design:type", Object)
|
|
48
|
+
], WorkspaceFilesExcludeFilterProvider.prototype, "fsPreferences", void 0);
|
|
49
|
+
tslib_1.__decorate([
|
|
50
|
+
(0, inversify_1.postConstruct)(),
|
|
51
|
+
tslib_1.__metadata("design:type", Function),
|
|
52
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
53
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
54
|
+
], WorkspaceFilesExcludeFilterProvider.prototype, "init", null);
|
|
55
|
+
exports.WorkspaceFilesExcludeFilterProvider = WorkspaceFilesExcludeFilterProvider = tslib_1.__decorate([
|
|
56
|
+
(0, inversify_1.injectable)()
|
|
57
|
+
], WorkspaceFilesExcludeFilterProvider);
|
|
58
|
+
//# sourceMappingURL=workspace-files-exclude-filter-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-files-exclude-filter-provider.js","sourceRoot":"","sources":["../../src/browser/workspace-files-exclude-filter-provider.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE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"version":3,"file":"workspace-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/workspace-frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAc,MAAM,8BAA8B,CAAC;;AA8C3E,wBAwEG"}
|
|
@@ -50,6 +50,8 @@ const workspace_window_title_updater_1 = require("./workspace-window-title-updat
|
|
|
50
50
|
const canonical_uri_service_1 = require("./canonical-uri-service");
|
|
51
51
|
const metadata_storage_1 = require("./metadata-storage");
|
|
52
52
|
const workspace_metadata_store_1 = require("./metadata-storage/workspace-metadata-store");
|
|
53
|
+
const workspace_search_filter_service_1 = require("./workspace-search-filter-service");
|
|
54
|
+
const workspace_files_exclude_filter_provider_1 = require("./workspace-files-exclude-filter-provider");
|
|
53
55
|
exports.default = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
|
|
54
56
|
(0, workspace_preferences_1.bindWorkspacePreferences)(bind);
|
|
55
57
|
(0, workspace_trust_preferences_1.bindWorkspaceTrustPreferences)(bind);
|
|
@@ -97,5 +99,9 @@ exports.default = new inversify_1.ContainerModule((bind, unbind, isBound, rebind
|
|
|
97
99
|
bind(workspace_trust_service_1.WorkspaceTrustService).toSelf().inSingletonScope();
|
|
98
100
|
rebind(user_working_directory_provider_1.UserWorkingDirectoryProvider).to(workspace_user_working_directory_provider_1.WorkspaceUserWorkingDirectoryProvider).inSingletonScope();
|
|
99
101
|
rebind(window_title_updater_1.WindowTitleUpdater).to(workspace_window_title_updater_1.WorkspaceWindowTitleUpdater).inSingletonScope();
|
|
102
|
+
(0, common_1.bindRootContributionProvider)(bind, workspace_search_filter_service_1.WorkspaceSearchFilterProvider);
|
|
103
|
+
bind(workspace_search_filter_service_1.WorkspaceSearchFilterService).toSelf().inSingletonScope();
|
|
104
|
+
bind(workspace_files_exclude_filter_provider_1.WorkspaceFilesExcludeFilterProvider).toSelf().inSingletonScope();
|
|
105
|
+
bind(workspace_search_filter_service_1.WorkspaceSearchFilterProvider).toService(workspace_files_exclude_filter_provider_1.WorkspaceFilesExcludeFilterProvider);
|
|
100
106
|
});
|
|
101
107
|
//# sourceMappingURL=workspace-frontend-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-frontend-module.js","sourceRoot":"","sources":["../../src/browser/workspace-frontend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,6CAA2C;AAE3C,4DAA2E;AAC3E,mDAA6G;AAC7G,qDAA+H;AAC/H,2DASuC;AACvC,6EAAyE;AACzE,2EAAmF;AACnF,kEAA4E;AAC5E,sCAA2G;AAC3G,uFAAkF;AAClF,2DAAyF;AACzF,6DAAgH;AAChH,uFAAkF;AAClF,2EAAsE;AACtE,6EAAqF;AACrF,2EAA2E;AAC3E,iEAA4D;AAC5D,yEAAoE;AACpE,+EAA0E;AAC1E,uDAAmD;AACnD,2EAAsE;AACtE,iDAA6C;AAC7C,iFAAmF;AACnF,yEAAoE;AACpE,6FAAwF;AACxF,mIAA8H;AAC9H,uEAAoG;AACpG,uFAAsF;AACtF,6GAAuG;AACvG,2GAAoG;AACpG,8FAAyF;AACzF,qFAA+E;AAC/E,mEAA8D;AAC9D,yDAAyI;AACzI,0FAAyF;
|
|
1
|
+
{"version":3,"file":"workspace-frontend-module.js","sourceRoot":"","sources":["../../src/browser/workspace-frontend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACv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AM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACvD,IAAI,CAAC,iCAAwB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAE3D,IAAI,CAAC,iDAAsB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACzD,IAAI,CAAC,0CAAsB,CAAC,CAAC,SAAS,CAAC,iDAAsB,CAAC,CAAC;IAC/D,MAAM,CAAC,mEAA+B,CAAC,CAAC,EAAE,CAAC,qEAAgC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAEhG,IAAA,qCAA4B,EAAC,IAAI,EAAE,0DAAgC,CAAC,CAAC;IACrE,IAAI,CAAC,+CAAqB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACxD,MAAM,CAAC,8DAA4B,CAAC,CAAC,EAAE,CAAC,iFAAqC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAElG,MAAM,CAAC,yCAAkB,CAAC,CAAC,EAAE,CAAC,4DAA2B,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAE9E,IAAA,qCAA4B,EAAC,IAAI,EAAE,+DAA6B,CAAC,CAAC;IAClE,IAAI,CAAC,8DAA4B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC/D,IAAI,CAAC,6EAAmC,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IACtE,IAAI,CAAC,+DAA6B,CAAC,CAAC,SAAS,CAAC,6EAAmC,CAAC,CAAC;AACvF,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ContributionProvider, Emitter, Event } from '@theia/core';
|
|
2
|
+
export declare const WorkspaceSearchFilterProvider: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* Interface for a provider of workspace search filters to the {@link WorkspaceSearchFilterService}.
|
|
5
|
+
* Currently, only exclusion globs can be provided.
|
|
6
|
+
*/
|
|
7
|
+
export interface WorkspaceSearchFilterProvider {
|
|
8
|
+
/** Obtain zero or more file glob patterns for exclusions from searches in the workspace. */
|
|
9
|
+
getExclusionGlobs(): string[];
|
|
10
|
+
/** An event signalling when the exclusion globs provided by this provider have changed. */
|
|
11
|
+
readonly onExclusionGlobsChanged: Event<void>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A service providing workspace search filters to clients performing searches over files in the
|
|
15
|
+
* workspace. Clients may use these filters in whatever way makes most sense for them.
|
|
16
|
+
*/
|
|
17
|
+
export declare class WorkspaceSearchFilterService {
|
|
18
|
+
protected readonly providers: ContributionProvider<WorkspaceSearchFilterProvider>;
|
|
19
|
+
protected readonly onExclusionGlobsChangedEmitter: Emitter<void>;
|
|
20
|
+
/** An event signalling when the exclusion globs provided by this provider have changed. */
|
|
21
|
+
readonly onExclusionGlobsChanged: Event<void>;
|
|
22
|
+
protected exclusionGlobs: string[] | undefined;
|
|
23
|
+
protected init(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Obtain zero or more glob patterns matching files to exclude from searches in the workspace.
|
|
26
|
+
*/
|
|
27
|
+
getExclusionGlobs(): string[];
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=workspace-search-filter-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-search-filter-service.d.ts","sourceRoot":"","sources":["../../src/browser/workspace-search-filter-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGnE,eAAO,MAAM,6BAA6B,eAA0C,CAAC;AAErF;;;GAGG;AACH,MAAM,WAAW,6BAA6B;IAC1C,4FAA4F;IAC5F,iBAAiB,IAAI,MAAM,EAAE,CAAC;IAC9B,2FAA2F;IAC3F,QAAQ,CAAC,uBAAuB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;CACjD;AAED;;;GAGG;AACH,qBACa,4BAA4B;IAGrC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,oBAAoB,CAAC,6BAA6B,CAAC,CAAC;IAElF,SAAS,CAAC,QAAQ,CAAC,8BAA8B,gBAAuB;IACxE,2FAA2F;IAC3F,QAAQ,CAAC,uBAAuB,EAAE,KAAK,CAAC,IAAI,CAAC,CAA6C;IAE1F,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAG/C,SAAS,CAAC,IAAI,IAAI,IAAI;IAStB;;OAEG;IACH,iBAAiB,IAAI,MAAM,EAAE;CAYhC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.WorkspaceSearchFilterService = exports.WorkspaceSearchFilterProvider = void 0;
|
|
19
|
+
const tslib_1 = require("tslib");
|
|
20
|
+
const core_1 = require("@theia/core");
|
|
21
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
22
|
+
exports.WorkspaceSearchFilterProvider = Symbol('WorkspaceSearchFilterProvider');
|
|
23
|
+
/**
|
|
24
|
+
* A service providing workspace search filters to clients performing searches over files in the
|
|
25
|
+
* workspace. Clients may use these filters in whatever way makes most sense for them.
|
|
26
|
+
*/
|
|
27
|
+
let WorkspaceSearchFilterService = class WorkspaceSearchFilterService {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.onExclusionGlobsChangedEmitter = new core_1.Emitter();
|
|
30
|
+
/** An event signalling when the exclusion globs provided by this provider have changed. */
|
|
31
|
+
this.onExclusionGlobsChanged = this.onExclusionGlobsChangedEmitter.event;
|
|
32
|
+
}
|
|
33
|
+
init() {
|
|
34
|
+
for (const provider of this.providers.getContributions()) {
|
|
35
|
+
provider.onExclusionGlobsChanged(() => {
|
|
36
|
+
this.exclusionGlobs = undefined;
|
|
37
|
+
this.onExclusionGlobsChangedEmitter.fire();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Obtain zero or more glob patterns matching files to exclude from searches in the workspace.
|
|
43
|
+
*/
|
|
44
|
+
getExclusionGlobs() {
|
|
45
|
+
if (this.exclusionGlobs === undefined) {
|
|
46
|
+
const globs = new Set();
|
|
47
|
+
for (const provider of this.providers.getContributions()) {
|
|
48
|
+
for (const glob of provider.getExclusionGlobs()) {
|
|
49
|
+
globs.add(glob);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
this.exclusionGlobs = [...globs];
|
|
53
|
+
}
|
|
54
|
+
return this.exclusionGlobs;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.WorkspaceSearchFilterService = WorkspaceSearchFilterService;
|
|
58
|
+
tslib_1.__decorate([
|
|
59
|
+
(0, inversify_1.inject)(core_1.ContributionProvider),
|
|
60
|
+
(0, inversify_1.named)(exports.WorkspaceSearchFilterProvider),
|
|
61
|
+
tslib_1.__metadata("design:type", Object)
|
|
62
|
+
], WorkspaceSearchFilterService.prototype, "providers", void 0);
|
|
63
|
+
tslib_1.__decorate([
|
|
64
|
+
(0, inversify_1.postConstruct)(),
|
|
65
|
+
tslib_1.__metadata("design:type", Function),
|
|
66
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
67
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
68
|
+
], WorkspaceSearchFilterService.prototype, "init", null);
|
|
69
|
+
exports.WorkspaceSearchFilterService = WorkspaceSearchFilterService = tslib_1.__decorate([
|
|
70
|
+
(0, inversify_1.injectable)()
|
|
71
|
+
], WorkspaceSearchFilterService);
|
|
72
|
+
//# sourceMappingURL=workspace-search-filter-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-search-filter-service.js","sourceRoot":"","sources":["../../src/browser/workspace-search-filter-service.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,sCAAmE;AACnE,4DAAwF;AAE3E,QAAA,6BAA6B,GAAG,MAAM,CAAC,+BAA+B,CAAC,CAAC;AAarF;;;GAGG;AAEI,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAAlC;QAKgB,mCAA8B,GAAG,IAAI,cAAO,EAAQ,CAAC;QACxE,2FAA2F;QAClF,4BAAuB,GAAgB,IAAI,CAAC,8BAA8B,CAAC,KAAK,CAAC;IA6B9F,CAAC;IAxBa,IAAI;QACV,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAE,CAAC;YACvD,QAAQ,CAAC,uBAAuB,CAAC,GAAG,EAAE;gBAClC,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;gBAChC,IAAI,CAAC,8BAA8B,CAAC,IAAI,EAAE,CAAC;YAC/C,CAAC,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED;;OAEG;IACH,iBAAiB;QACb,IAAI,IAAI,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;YACpC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;YAChC,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,EAAE,CAAC;gBACvD,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,iBAAiB,EAAE,EAAE,CAAC;oBAC9C,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACpB,CAAC;YACL,CAAC;YACD,IAAI,CAAC,cAAc,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;QACrC,CAAC;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;CACJ,CAAA;AApCY,oEAA4B;AAGlB;IADlB,IAAA,kBAAM,EAAC,2BAAoB,CAAC;IAAE,IAAA,iBAAK,EAAC,qCAA6B,CAAC;;+DACe;AASxE;IADT,IAAA,yBAAa,GAAE;;;;wDAQf;uCAnBQ,4BAA4B;IADxC,IAAA,sBAAU,GAAE;GACA,4BAA4B,CAoCxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-search-filter-service.spec.d.ts","sourceRoot":"","sources":["../../src/browser/workspace-search-filter-service.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const chai_1 = require("chai");
|
|
19
|
+
const sinon = require("sinon");
|
|
20
|
+
const core_1 = require("@theia/core");
|
|
21
|
+
const workspace_search_filter_service_1 = require("./workspace-search-filter-service");
|
|
22
|
+
class MockProvider {
|
|
23
|
+
constructor(globs = []) {
|
|
24
|
+
this.globs = globs;
|
|
25
|
+
this.onExclusionGlobsChangedEmitter = new core_1.Emitter();
|
|
26
|
+
this.onExclusionGlobsChanged = this.onExclusionGlobsChangedEmitter.event;
|
|
27
|
+
}
|
|
28
|
+
getExclusionGlobs() {
|
|
29
|
+
return this.globs;
|
|
30
|
+
}
|
|
31
|
+
setGlobs(globs) {
|
|
32
|
+
this.globs = globs;
|
|
33
|
+
this.onExclusionGlobsChangedEmitter.fire();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function createService(providers) {
|
|
37
|
+
const service = new workspace_search_filter_service_1.WorkspaceSearchFilterService();
|
|
38
|
+
const contributionProvider = {
|
|
39
|
+
getContributions: () => providers
|
|
40
|
+
};
|
|
41
|
+
service.providers = contributionProvider;
|
|
42
|
+
service['init']();
|
|
43
|
+
return service;
|
|
44
|
+
}
|
|
45
|
+
describe('WorkspaceSearchFilterService', () => {
|
|
46
|
+
afterEach(() => {
|
|
47
|
+
sinon.restore();
|
|
48
|
+
});
|
|
49
|
+
describe('getExclusionGlobs', () => {
|
|
50
|
+
it('should return empty array when no providers are registered', () => {
|
|
51
|
+
const service = createService([]);
|
|
52
|
+
(0, chai_1.expect)(service.getExclusionGlobs()).to.deep.equal([]);
|
|
53
|
+
});
|
|
54
|
+
it('should return globs from a single provider', () => {
|
|
55
|
+
const provider = new MockProvider(['**/*.log', '**/node_modules']);
|
|
56
|
+
const service = createService([provider]);
|
|
57
|
+
(0, chai_1.expect)(service.getExclusionGlobs()).to.deep.equal(['**/*.log', '**/node_modules']);
|
|
58
|
+
});
|
|
59
|
+
it('should aggregate globs from multiple providers', () => {
|
|
60
|
+
const providerA = new MockProvider(['**/*.log']);
|
|
61
|
+
const providerB = new MockProvider(['**/node_modules']);
|
|
62
|
+
const service = createService([providerA, providerB]);
|
|
63
|
+
(0, chai_1.expect)(service.getExclusionGlobs()).to.include.members(['**/*.log', '**/node_modules']);
|
|
64
|
+
(0, chai_1.expect)(service.getExclusionGlobs()).to.have.lengthOf(2);
|
|
65
|
+
});
|
|
66
|
+
it('should deduplicate globs across providers', () => {
|
|
67
|
+
const providerA = new MockProvider(['**/*.log', '**/dist']);
|
|
68
|
+
const providerB = new MockProvider(['**/*.log', '**/node_modules']);
|
|
69
|
+
const service = createService([providerA, providerB]);
|
|
70
|
+
const globs = service.getExclusionGlobs();
|
|
71
|
+
(0, chai_1.expect)(globs).to.have.lengthOf(3);
|
|
72
|
+
(0, chai_1.expect)(globs).to.include.members(['**/*.log', '**/dist', '**/node_modules']);
|
|
73
|
+
});
|
|
74
|
+
it('should handle providers that return empty arrays', () => {
|
|
75
|
+
const providerA = new MockProvider([]);
|
|
76
|
+
const providerB = new MockProvider(['**/*.log']);
|
|
77
|
+
const service = createService([providerA, providerB]);
|
|
78
|
+
(0, chai_1.expect)(service.getExclusionGlobs()).to.deep.equal(['**/*.log']);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
describe('onExclusionGlobsChanged', () => {
|
|
82
|
+
it('should fire when a provider fires a change event', () => {
|
|
83
|
+
const provider = new MockProvider(['**/*.log']);
|
|
84
|
+
const service = createService([provider]);
|
|
85
|
+
const spy = sinon.spy();
|
|
86
|
+
service.onExclusionGlobsChanged(spy);
|
|
87
|
+
provider.setGlobs(['**/dist']);
|
|
88
|
+
(0, chai_1.expect)(spy.calledOnce).to.be.true;
|
|
89
|
+
});
|
|
90
|
+
it('should fire once per provider change event', () => {
|
|
91
|
+
const providerA = new MockProvider(['**/*.log']);
|
|
92
|
+
const providerB = new MockProvider(['**/node_modules']);
|
|
93
|
+
const service = createService([providerA, providerB]);
|
|
94
|
+
const spy = sinon.spy();
|
|
95
|
+
service.onExclusionGlobsChanged(spy);
|
|
96
|
+
providerA.setGlobs(['**/dist']);
|
|
97
|
+
providerB.setGlobs(['**/build']);
|
|
98
|
+
(0, chai_1.expect)(spy.calledTwice).to.be.true;
|
|
99
|
+
});
|
|
100
|
+
it('should not fire when no provider changes', () => {
|
|
101
|
+
const provider = new MockProvider(['**/*.log']);
|
|
102
|
+
const service = createService([provider]);
|
|
103
|
+
const spy = sinon.spy();
|
|
104
|
+
service.onExclusionGlobsChanged(spy);
|
|
105
|
+
(0, chai_1.expect)(spy.called).to.be.false;
|
|
106
|
+
});
|
|
107
|
+
it('should recalculate when any provider fires a change event', () => {
|
|
108
|
+
const providerA = new MockProvider(['**/*.log']);
|
|
109
|
+
const providerB = new MockProvider(['**/node_modules']);
|
|
110
|
+
const service = createService([providerA, providerB]);
|
|
111
|
+
service.getExclusionGlobs();
|
|
112
|
+
providerB.setGlobs(['**/build']);
|
|
113
|
+
const globs = service.getExclusionGlobs();
|
|
114
|
+
(0, chai_1.expect)(globs).to.include.members(['**/*.log', '**/build']);
|
|
115
|
+
(0, chai_1.expect)(globs).to.not.include('**/node_modules');
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
//# sourceMappingURL=workspace-search-filter-service.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-search-filter-service.spec.js","sourceRoot":"","sources":["../../src/browser/workspace-search-filter-service.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACv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,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC;YAEtD,OAAO,CAAC,iBAAiB,EAAE,CAAC;YAC5B,SAAS,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC;YAEjC,MAAM,KAAK,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;YAC1C,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;YAC3D,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/workspace",
|
|
3
|
-
"version": "1.70.0-next.
|
|
3
|
+
"version": "1.70.0-next.7+a230181f5",
|
|
4
4
|
"description": "Theia - Workspace Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.70.0-next.
|
|
7
|
-
"@theia/filesystem": "1.70.0-next.
|
|
8
|
-
"@theia/variable-resolver": "1.70.0-next.
|
|
6
|
+
"@theia/core": "1.70.0-next.7+a230181f5",
|
|
7
|
+
"@theia/filesystem": "1.70.0-next.7+a230181f5",
|
|
8
|
+
"@theia/variable-resolver": "1.70.0-next.7+a230181f5",
|
|
9
9
|
"jsonc-parser": "^2.2.0",
|
|
10
10
|
"tslib": "^2.6.2",
|
|
11
11
|
"valid-filename": "^2.0.1"
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"nyc": {
|
|
53
53
|
"extends": "../../configs/nyc.json"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "a230181f5951eaba3fb82e11a14dc03dbff8feca"
|
|
56
56
|
}
|
package/src/browser/index.ts
CHANGED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { Emitter, Event } from '@theia/core';
|
|
18
|
+
import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
+
import { FileSystemPreferences } from '@theia/filesystem/lib/common';
|
|
20
|
+
import { WorkspaceSearchFilterProvider } from './workspace-search-filter-service';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A workspace search filter provider that contributes the user-configurable
|
|
24
|
+
* "Files: Exclude" settings from the preferences.
|
|
25
|
+
*/
|
|
26
|
+
@injectable()
|
|
27
|
+
export class WorkspaceFilesExcludeFilterProvider implements WorkspaceSearchFilterProvider {
|
|
28
|
+
|
|
29
|
+
@inject(FileSystemPreferences)
|
|
30
|
+
protected readonly fsPreferences: FileSystemPreferences;
|
|
31
|
+
|
|
32
|
+
protected readonly onExclusionGlobsChangedEmitter = new Emitter<void>();
|
|
33
|
+
readonly onExclusionGlobsChanged: Event<void> = this.onExclusionGlobsChangedEmitter.event;
|
|
34
|
+
|
|
35
|
+
@postConstruct()
|
|
36
|
+
protected init(): void {
|
|
37
|
+
this.fsPreferences.onPreferenceChanged(e => {
|
|
38
|
+
if (e.preferenceName === 'files.exclude') {
|
|
39
|
+
this.onExclusionGlobsChangedEmitter.fire();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
getExclusionGlobs(): string[] {
|
|
45
|
+
const filesExclude = this.fsPreferences['files.exclude'];
|
|
46
|
+
return Object.keys(filesExclude).filter(key => !!filesExclude[key]);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -59,6 +59,8 @@ import { WorkspaceWindowTitleUpdater } from './workspace-window-title-updater';
|
|
|
59
59
|
import { CanonicalUriService } from './canonical-uri-service';
|
|
60
60
|
import { WorkspaceMetadataStorageService, WorkspaceMetadataStorageServiceImpl, WorkspaceMetadataStoreFactory } from './metadata-storage';
|
|
61
61
|
import { WorkspaceMetadataStoreImpl } from './metadata-storage/workspace-metadata-store';
|
|
62
|
+
import { WorkspaceSearchFilterService, WorkspaceSearchFilterProvider } from './workspace-search-filter-service';
|
|
63
|
+
import { WorkspaceFilesExcludeFilterProvider } from './workspace-files-exclude-filter-provider';
|
|
62
64
|
|
|
63
65
|
export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Unbind, isBound: interfaces.IsBound, rebind: interfaces.Rebind) => {
|
|
64
66
|
bindWorkspacePreferences(bind);
|
|
@@ -127,4 +129,9 @@ export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Un
|
|
|
127
129
|
rebind(UserWorkingDirectoryProvider).to(WorkspaceUserWorkingDirectoryProvider).inSingletonScope();
|
|
128
130
|
|
|
129
131
|
rebind(WindowTitleUpdater).to(WorkspaceWindowTitleUpdater).inSingletonScope();
|
|
132
|
+
|
|
133
|
+
bindRootContributionProvider(bind, WorkspaceSearchFilterProvider);
|
|
134
|
+
bind(WorkspaceSearchFilterService).toSelf().inSingletonScope();
|
|
135
|
+
bind(WorkspaceFilesExcludeFilterProvider).toSelf().inSingletonScope();
|
|
136
|
+
bind(WorkspaceSearchFilterProvider).toService(WorkspaceFilesExcludeFilterProvider);
|
|
130
137
|
});
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { expect } from 'chai';
|
|
18
|
+
import * as sinon from 'sinon';
|
|
19
|
+
import { Emitter } from '@theia/core';
|
|
20
|
+
import { ContributionProvider } from '@theia/core/lib/common';
|
|
21
|
+
import { WorkspaceSearchFilterProvider, WorkspaceSearchFilterService } from './workspace-search-filter-service';
|
|
22
|
+
|
|
23
|
+
class MockProvider implements WorkspaceSearchFilterProvider {
|
|
24
|
+
protected readonly onExclusionGlobsChangedEmitter = new Emitter<void>();
|
|
25
|
+
readonly onExclusionGlobsChanged = this.onExclusionGlobsChangedEmitter.event;
|
|
26
|
+
|
|
27
|
+
constructor(protected globs: string[] = []) { }
|
|
28
|
+
|
|
29
|
+
getExclusionGlobs(): string[] {
|
|
30
|
+
return this.globs;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
setGlobs(globs: string[]): void {
|
|
34
|
+
this.globs = globs;
|
|
35
|
+
this.onExclusionGlobsChangedEmitter.fire();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function createService(providers: WorkspaceSearchFilterProvider[]): WorkspaceSearchFilterService {
|
|
40
|
+
const service = new WorkspaceSearchFilterService();
|
|
41
|
+
const contributionProvider: ContributionProvider<WorkspaceSearchFilterProvider> = {
|
|
42
|
+
getContributions: () => providers
|
|
43
|
+
};
|
|
44
|
+
(service as unknown as { providers: ContributionProvider<WorkspaceSearchFilterProvider> }).providers = contributionProvider;
|
|
45
|
+
service['init']();
|
|
46
|
+
return service;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
describe('WorkspaceSearchFilterService', () => {
|
|
50
|
+
|
|
51
|
+
afterEach(() => {
|
|
52
|
+
sinon.restore();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('getExclusionGlobs', () => {
|
|
56
|
+
|
|
57
|
+
it('should return empty array when no providers are registered', () => {
|
|
58
|
+
const service = createService([]);
|
|
59
|
+
expect(service.getExclusionGlobs()).to.deep.equal([]);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('should return globs from a single provider', () => {
|
|
63
|
+
const provider = new MockProvider(['**/*.log', '**/node_modules']);
|
|
64
|
+
const service = createService([provider]);
|
|
65
|
+
expect(service.getExclusionGlobs()).to.deep.equal(['**/*.log', '**/node_modules']);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should aggregate globs from multiple providers', () => {
|
|
69
|
+
const providerA = new MockProvider(['**/*.log']);
|
|
70
|
+
const providerB = new MockProvider(['**/node_modules']);
|
|
71
|
+
const service = createService([providerA, providerB]);
|
|
72
|
+
expect(service.getExclusionGlobs()).to.include.members(['**/*.log', '**/node_modules']);
|
|
73
|
+
expect(service.getExclusionGlobs()).to.have.lengthOf(2);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should deduplicate globs across providers', () => {
|
|
77
|
+
const providerA = new MockProvider(['**/*.log', '**/dist']);
|
|
78
|
+
const providerB = new MockProvider(['**/*.log', '**/node_modules']);
|
|
79
|
+
const service = createService([providerA, providerB]);
|
|
80
|
+
const globs = service.getExclusionGlobs();
|
|
81
|
+
expect(globs).to.have.lengthOf(3);
|
|
82
|
+
expect(globs).to.include.members(['**/*.log', '**/dist', '**/node_modules']);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should handle providers that return empty arrays', () => {
|
|
86
|
+
const providerA = new MockProvider([]);
|
|
87
|
+
const providerB = new MockProvider(['**/*.log']);
|
|
88
|
+
const service = createService([providerA, providerB]);
|
|
89
|
+
expect(service.getExclusionGlobs()).to.deep.equal(['**/*.log']);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe('onExclusionGlobsChanged', () => {
|
|
94
|
+
|
|
95
|
+
it('should fire when a provider fires a change event', () => {
|
|
96
|
+
const provider = new MockProvider(['**/*.log']);
|
|
97
|
+
const service = createService([provider]);
|
|
98
|
+
const spy = sinon.spy();
|
|
99
|
+
service.onExclusionGlobsChanged(spy);
|
|
100
|
+
|
|
101
|
+
provider.setGlobs(['**/dist']);
|
|
102
|
+
expect(spy.calledOnce).to.be.true;
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it('should fire once per provider change event', () => {
|
|
106
|
+
const providerA = new MockProvider(['**/*.log']);
|
|
107
|
+
const providerB = new MockProvider(['**/node_modules']);
|
|
108
|
+
const service = createService([providerA, providerB]);
|
|
109
|
+
const spy = sinon.spy();
|
|
110
|
+
service.onExclusionGlobsChanged(spy);
|
|
111
|
+
|
|
112
|
+
providerA.setGlobs(['**/dist']);
|
|
113
|
+
providerB.setGlobs(['**/build']);
|
|
114
|
+
expect(spy.calledTwice).to.be.true;
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should not fire when no provider changes', () => {
|
|
118
|
+
const provider = new MockProvider(['**/*.log']);
|
|
119
|
+
const service = createService([provider]);
|
|
120
|
+
const spy = sinon.spy();
|
|
121
|
+
service.onExclusionGlobsChanged(spy);
|
|
122
|
+
|
|
123
|
+
expect(spy.called).to.be.false;
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('should recalculate when any provider fires a change event', () => {
|
|
127
|
+
const providerA = new MockProvider(['**/*.log']);
|
|
128
|
+
const providerB = new MockProvider(['**/node_modules']);
|
|
129
|
+
const service = createService([providerA, providerB]);
|
|
130
|
+
|
|
131
|
+
service.getExclusionGlobs();
|
|
132
|
+
providerB.setGlobs(['**/build']);
|
|
133
|
+
|
|
134
|
+
const globs = service.getExclusionGlobs();
|
|
135
|
+
expect(globs).to.include.members(['**/*.log', '**/build']);
|
|
136
|
+
expect(globs).to.not.include('**/node_modules');
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { ContributionProvider, Emitter, Event } from '@theia/core';
|
|
18
|
+
import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
+
|
|
20
|
+
export const WorkspaceSearchFilterProvider = Symbol('WorkspaceSearchFilterProvider');
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Interface for a provider of workspace search filters to the {@link WorkspaceSearchFilterService}.
|
|
24
|
+
* Currently, only exclusion globs can be provided.
|
|
25
|
+
*/
|
|
26
|
+
export interface WorkspaceSearchFilterProvider {
|
|
27
|
+
/** Obtain zero or more file glob patterns for exclusions from searches in the workspace. */
|
|
28
|
+
getExclusionGlobs(): string[];
|
|
29
|
+
/** An event signalling when the exclusion globs provided by this provider have changed. */
|
|
30
|
+
readonly onExclusionGlobsChanged: Event<void>;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A service providing workspace search filters to clients performing searches over files in the
|
|
35
|
+
* workspace. Clients may use these filters in whatever way makes most sense for them.
|
|
36
|
+
*/
|
|
37
|
+
@injectable()
|
|
38
|
+
export class WorkspaceSearchFilterService {
|
|
39
|
+
|
|
40
|
+
@inject(ContributionProvider) @named(WorkspaceSearchFilterProvider)
|
|
41
|
+
protected readonly providers: ContributionProvider<WorkspaceSearchFilterProvider>;
|
|
42
|
+
|
|
43
|
+
protected readonly onExclusionGlobsChangedEmitter = new Emitter<void>();
|
|
44
|
+
/** An event signalling when the exclusion globs provided by this provider have changed. */
|
|
45
|
+
readonly onExclusionGlobsChanged: Event<void> = this.onExclusionGlobsChangedEmitter.event;
|
|
46
|
+
|
|
47
|
+
protected exclusionGlobs: string[] | undefined;
|
|
48
|
+
|
|
49
|
+
@postConstruct()
|
|
50
|
+
protected init(): void {
|
|
51
|
+
for (const provider of this.providers.getContributions()) {
|
|
52
|
+
provider.onExclusionGlobsChanged(() => {
|
|
53
|
+
this.exclusionGlobs = undefined;
|
|
54
|
+
this.onExclusionGlobsChangedEmitter.fire();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Obtain zero or more glob patterns matching files to exclude from searches in the workspace.
|
|
61
|
+
*/
|
|
62
|
+
getExclusionGlobs(): string[] {
|
|
63
|
+
if (this.exclusionGlobs === undefined) {
|
|
64
|
+
const globs = new Set<string>();
|
|
65
|
+
for (const provider of this.providers.getContributions()) {
|
|
66
|
+
for (const glob of provider.getExclusionGlobs()) {
|
|
67
|
+
globs.add(glob);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
this.exclusionGlobs = [...globs];
|
|
71
|
+
}
|
|
72
|
+
return this.exclusionGlobs;
|
|
73
|
+
}
|
|
74
|
+
}
|