@theia/navigator 1.77.0-next.84 → 1.77.0-next.89

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.
@@ -1 +1 @@
1
- {"version":3,"file":"navigator-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/navigator-frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AAC3C,OAAO,wDAAwD,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AA4B/D,wBA2CG"}
1
+ {"version":3,"file":"navigator-frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/navigator-frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AAC3C,OAAO,wDAAwD,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AA8B/D,wBA6CG"}
@@ -40,10 +40,13 @@ const navigator_deleted_editor_decorator_1 = require("./open-editors-widget/navi
40
40
  const navigator_symlink_decorator_1 = require("./navigator-symlink-decorator");
41
41
  const navigator_file_clipboard_1 = require("./navigator-file-clipboard");
42
42
  const browser_2 = require("@theia/filesystem/lib/browser");
43
+ const workspace_root_node_label_provider_1 = require("./workspace-root-node-label-provider");
43
44
  exports.default = new inversify_1.ContainerModule(bind => {
44
45
  (0, navigator_preferences_1.bindFileNavigatorPreferences)(bind);
45
46
  bind(navigator_filter_1.FileNavigatorFilter).toSelf().inSingletonScope();
46
47
  bind(navigator_context_key_service_1.NavigatorContextKeyService).toSelf().inSingletonScope();
48
+ bind(workspace_root_node_label_provider_1.WorkspaceRootNodeLabelProvider).toSelf().inSingletonScope();
49
+ bind(browser_1.LabelProviderContribution).toService(workspace_root_node_label_provider_1.WorkspaceRootNodeLabelProvider);
47
50
  bind(navigator_file_clipboard_1.NavigatorFileClipboard).toSelf().inSingletonScope();
48
51
  (0, browser_1.bindViewContribution)(bind, navigator_contribution_1.FileNavigatorContribution);
49
52
  bind(browser_1.FrontendApplicationContribution).toService(navigator_contribution_1.FileNavigatorContribution);
@@ -1 +1 @@
1
- {"version":3,"file":"navigator-frontend-module.js","sourceRoot":"","sources":["../../src/browser/navigator-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;AAC3C,kEAAgE;AAEhE,4DAA+D;AAC/D,qDAIiC;AACjC,yDAA4E;AAC5E,qEAAqE;AACrE,+DAAkE;AAClE,2EAAuE;AACvE,2EAA+E;AAC/E,yDAAyD;AACzD,mFAA6E;AAC7E,mFAA0F;AAC1F,qDAAiD;AACjD,+EAAmH;AACnH,+EAAyE;AACzE,uFAAkF;AAClF,yEAAoE;AACpE,mDAAsE;AACtE,6HAA0G;AAC1G,uGAAwF;AACxF,+EAAuE;AACvE,iHAA2G;AAC3G,+EAA0E;AAC1E,yEAAoE;AACpE,2DAAyE;AAEzE,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,IAAA,oDAA4B,EAAC,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,sCAAmB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAEtD,IAAI,CAAC,0DAA0B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC7D,IAAI,CAAC,iDAAsB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAEzD,IAAA,8BAAoB,EAAC,IAAI,EAAE,kDAAyB,CAAC,CAAC;IACtD,IAAI,CAAC,yCAA+B,CAAC,CAAC,SAAS,CAAC,kDAAyB,CAAC,CAAC;IAC3E,IAAI,CAAC,2CAAyB,CAA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ACtD,IAAI,CAAC,yCAA+B,CAAC,CAAC,EAAE,CAAC,8DAAgC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC9F,IAAI,CAAC,yCAA+B,CAAC,CAAC,EAAE,CAAC,8DAAgC,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAE9F,IAAI,CAAC,8BAAa,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAChD,IAAI,CAAC,sDAAwB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC3D,IAAI,CAAC,yCAA+B,CAAC,CAAC,SAAS,CAAC,sDAAwB,CAAC,CAAC;IAC1E,IAAI,CAAC,mCAAe,CAAC,CAAC,SAAS,CAAC,sDAAwB,CAAC,CAAC;IAE1D,IAAI,CAAC,uDAAyB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC5D,IAAI,CAAC,oDAAsB,CAAC,CAAC,SAAS,CAAC,uDAAyB,CAAC,CAAC;IAClE,IAAI,CAAC,mEAAwB,CAAC,CAAC,SAAS,CAAC,uDAAyB,CAAC,CAAC;AACxE,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"navigator-frontend-module.js","sourceRoot":"","sources":["../../src/browser/navigator-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;AAC3C,kEAAgE;AAEhE,4DAA+D;AAC/D,qDAKiC;AACjC,yDAA4E;AAC5E,qEAAqE;AACrE,+DAAkE;AAClE,2EAAuE;AACvE,2EAA+E;AAC/E,yDAAyD;AACzD,mFAA6E;AAC7E,mFAA0F;AAC1F,qDAAiD;AACjD,+EA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IAC1E,IAAI,CAAC,mCAAe,CAAC,CAAC,SAAS,CAAC,sDAAwB,CAAC,CAAC;IAE1D,IAAI,CAAC,uDAAyB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC5D,IAAI,CAAC,oDAAsB,CAAC,CAAC,SAAS,CAAC,uDAAyB,CAAC,CAAC;IAClE,IAAI,CAAC,mEAAwB,CAAC,CAAC,SAAS,CAAC,uDAAyB,CAAC,CAAC;AACxE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { LabelProviderContribution } from '@theia/core/lib/browser/label-provider';
2
+ import { FileTreeLabelProvider } from '@theia/filesystem/lib/browser/file-tree/file-tree-label-provider';
3
+ import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
4
+ import { WorkspaceRootNode } from './navigator-tree';
5
+ /**
6
+ * Shows the name given to a workspace root in the workspace file on its node in the navigator.
7
+ * The name is only shown for the root node: where the folder appears otherwise, e.g. nested in another root, it shows its folder name, as in VS Code.
8
+ */
9
+ export declare class WorkspaceRootNodeLabelProvider implements LabelProviderContribution {
10
+ protected readonly fileTreeLabelProvider: FileTreeLabelProvider;
11
+ protected readonly workspaceService: WorkspaceService;
12
+ canHandle(element: object): number;
13
+ /** Returns the name of the root, or `undefined` to fall back to the label of the file tree node. */
14
+ getName(node: WorkspaceRootNode): string | undefined;
15
+ }
16
+ //# sourceMappingURL=workspace-root-node-label-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-root-node-label-provider.d.ts","sourceRoot":"","sources":["../../src/browser/workspace-root-node-label-provider.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAC;AACzG,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD;;;GAGG;AACH,qBACa,8BAA+B,YAAW,yBAAyB;IAG5E,SAAS,CAAC,QAAQ,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAGhE,SAAS,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAEtD,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAIlC,oGAAoG;IACpG,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS;CAIvD"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 Vinay Kaushal 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.WorkspaceRootNodeLabelProvider = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const file_tree_label_provider_1 = require("@theia/filesystem/lib/browser/file-tree/file-tree-label-provider");
22
+ const workspace_service_1 = require("@theia/workspace/lib/browser/workspace-service");
23
+ const navigator_tree_1 = require("./navigator-tree");
24
+ /**
25
+ * Shows the name given to a workspace root in the workspace file on its node in the navigator.
26
+ * The name is only shown for the root node: where the folder appears otherwise, e.g. nested in another root, it shows its folder name, as in VS Code.
27
+ */
28
+ let WorkspaceRootNodeLabelProvider = class WorkspaceRootNodeLabelProvider {
29
+ canHandle(element) {
30
+ return navigator_tree_1.WorkspaceRootNode.is(element) ? this.fileTreeLabelProvider.canHandle(element) + 1 : 0;
31
+ }
32
+ /** Returns the name of the root, or `undefined` to fall back to the label of the file tree node. */
33
+ getName(node) {
34
+ return this.workspaceService.getConfiguredRootName(node.uri);
35
+ }
36
+ };
37
+ exports.WorkspaceRootNodeLabelProvider = WorkspaceRootNodeLabelProvider;
38
+ tslib_1.__decorate([
39
+ (0, inversify_1.inject)(file_tree_label_provider_1.FileTreeLabelProvider),
40
+ tslib_1.__metadata("design:type", file_tree_label_provider_1.FileTreeLabelProvider)
41
+ ], WorkspaceRootNodeLabelProvider.prototype, "fileTreeLabelProvider", void 0);
42
+ tslib_1.__decorate([
43
+ (0, inversify_1.inject)(workspace_service_1.WorkspaceService),
44
+ tslib_1.__metadata("design:type", workspace_service_1.WorkspaceService)
45
+ ], WorkspaceRootNodeLabelProvider.prototype, "workspaceService", void 0);
46
+ exports.WorkspaceRootNodeLabelProvider = WorkspaceRootNodeLabelProvider = tslib_1.__decorate([
47
+ (0, inversify_1.injectable)()
48
+ ], WorkspaceRootNodeLabelProvider);
49
+ //# sourceMappingURL=workspace-root-node-label-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-root-node-label-provider.js","sourceRoot":"","sources":["../../src/browser/workspace-root-node-label-provider.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,4DAAkE;AAElE,+GAAyG;AACzG,sFAAkF;AAClF,qDAAqD;AAErD;;;GAGG;AAEI,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAQvC,SAAS,CAAC,OAAe;QACrB,OAAO,kCAAiB,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjG,CAAC;IAED,oGAAoG;IACpG,OAAO,CAAC,IAAuB;QAC3B,OAAO,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;CAEJ,CAAA;AAjBY,wEAA8B;AAGpB;IADlB,IAAA,kBAAM,EAAC,gDAAqB,CAAC;sCACY,gDAAqB;6EAAC;AAG7C;IADlB,IAAA,kBAAM,EAAC,oCAAgB,CAAC;sCACY,oCAAgB;wEAAC;yCAN7C,8BAA8B;IAD1C,IAAA,sBAAU,GAAE;GACA,8BAA8B,CAiB1C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=workspace-root-node-label-provider.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-root-node-label-provider.spec.d.ts","sourceRoot":"","sources":["../../src/browser/workspace-root-node-label-provider.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 Vinay Kaushal 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 tslib_1 = require("tslib");
19
+ const jsdom_1 = require("@theia/core/lib/browser/test/jsdom");
20
+ let disableJSDOM = (0, jsdom_1.enableJSDOM)();
21
+ const chai_1 = require("chai");
22
+ const uri_1 = tslib_1.__importDefault(require("@theia/core/lib/common/uri"));
23
+ const files_1 = require("@theia/filesystem/lib/common/files");
24
+ const navigator_tree_1 = require("./navigator-tree");
25
+ const workspace_root_node_label_provider_1 = require("./workspace-root-node-label-provider");
26
+ disableJSDOM();
27
+ describe('WorkspaceRootNodeLabelProvider', () => {
28
+ before(() => disableJSDOM = (0, jsdom_1.enableJSDOM)());
29
+ after(() => disableJSDOM());
30
+ const backend = 'file:///home/user/project/backend';
31
+ let labelProvider;
32
+ function dirNode(uri, parent) {
33
+ const fileStat = files_1.FileStat.dir(uri);
34
+ return { id: uri, uri: fileStat.resource, fileStat, name: fileStat.resource.path.base, parent, children: [], expanded: false, selected: false };
35
+ }
36
+ function rootNode(uri) {
37
+ return dirNode(uri, navigator_tree_1.WorkspaceNode.createRoot());
38
+ }
39
+ beforeEach(() => {
40
+ labelProvider = new workspace_root_node_label_provider_1.WorkspaceRootNodeLabelProvider();
41
+ Object.assign(labelProvider, {
42
+ fileTreeLabelProvider: { canHandle: () => 101 },
43
+ workspaceService: {
44
+ getConfiguredRootName: (uri) => uri.isEqual(new uri_1.default(backend)) ? 'API Server' : undefined
45
+ }
46
+ });
47
+ });
48
+ it('shows the name of a workspace root on its root node, with priority over the file tree', () => {
49
+ const root = rootNode(backend);
50
+ (0, chai_1.expect)(labelProvider.canHandle(root)).to.equal(102);
51
+ (0, chai_1.expect)(labelProvider.getName(root)).to.equal('API Server');
52
+ });
53
+ it('does not handle a node of the same folder that is not a root node', () => {
54
+ // e.g. one root nested inside another
55
+ const nested = dirNode(backend, rootNode('file:///home/user/project'));
56
+ (0, chai_1.expect)(labelProvider.canHandle(nested)).to.equal(0);
57
+ });
58
+ it('falls back to the file tree label for a root without a name', () => {
59
+ const root = rootNode('file:///home/user/project/frontend');
60
+ (0, chai_1.expect)(labelProvider.getName(root)).to.be.undefined;
61
+ });
62
+ });
63
+ //# sourceMappingURL=workspace-root-node-label-provider.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-root-node-label-provider.spec.js","sourceRoot":"","sources":["../../src/browser/workspace-root-node-label-provider.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;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,8DAAiE;AACjE,IAAI,YAAY,GAAG,IAAA,mBAAW,GAAE,CAAC;AAEjC,+BAA8B;AAC9B,6EAA6C;AAC7C,8DAA8D;AAI9D,qDAAoE;AACpE,6FAAsF;AAEtF,YAAY,EAAE,CAAC;AAEf,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAE5C,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,GAAG,IAAA,mBAAW,GAAE,CAAC,CAAC;IAC3C,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;IAE5B,MAAM,OAAO,GAAG,mCAAmC,CAAC;IACpD,IAAI,aAA6C,CAAC;IAElD,SAAS,OAAO,CAAC,GAAW,EAAE,MAAyB;QACnD,MAAM,QAAQ,GAAG,gBAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACnC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACpJ,CAAC;IAED,SAAS,QAAQ,CAAC,GAAW;QACzB,OAAO,OAAO,CAAC,GAAG,EAAE,8BAAa,CAAC,UAAU,EAAE,CAAsB,CAAC;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AC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;IACxD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@theia/navigator",
3
- "version": "1.77.0-next.84+28288b6e7",
3
+ "version": "1.77.0-next.89+f8803521d",
4
4
  "description": "Theia - Navigator Extension",
5
5
  "dependencies": {
6
- "@theia/core": "1.77.0-next.84+28288b6e7",
7
- "@theia/filesystem": "1.77.0-next.84+28288b6e7",
8
- "@theia/workspace": "1.77.0-next.84+28288b6e7",
6
+ "@theia/core": "1.77.0-next.89+f8803521d",
7
+ "@theia/filesystem": "1.77.0-next.89+f8803521d",
8
+ "@theia/workspace": "1.77.0-next.89+f8803521d",
9
9
  "minimatch": "^10.2.6",
10
10
  "tslib": "^2.8.1"
11
11
  },
@@ -51,5 +51,5 @@
51
51
  "nyc": {
52
52
  "extends": "../../configs/nyc.json"
53
53
  },
54
- "gitHead": "28288b6e714db6a4941d4aee74680ea6a6ceaff9"
54
+ "gitHead": "f8803521dea069bef0e4d7e5449b3918c5e5cee2"
55
55
  }
@@ -21,7 +21,8 @@ import { ContainerModule } from '@theia/core/shared/inversify';
21
21
  import {
22
22
  bindViewContribution,
23
23
  FrontendApplicationContribution,
24
- ApplicationShellLayoutMigration
24
+ ApplicationShellLayoutMigration,
25
+ LabelProviderContribution
25
26
  } from '@theia/core/lib/browser';
26
27
  import { FileNavigatorWidget, FILE_NAVIGATOR_ID } from './navigator-widget';
27
28
  import { FileNavigatorContribution } from './navigator-contribution';
@@ -44,12 +45,15 @@ import { NavigatorDeletedEditorDecorator } from './open-editors-widget/navigator
44
45
  import { NavigatorSymlinkDecorator } from './navigator-symlink-decorator';
45
46
  import { NavigatorFileClipboard } from './navigator-file-clipboard';
46
47
  import { FileTreeDecoratorAdapter } from '@theia/filesystem/lib/browser';
48
+ import { WorkspaceRootNodeLabelProvider } from './workspace-root-node-label-provider';
47
49
 
48
50
  export default new ContainerModule(bind => {
49
51
  bindFileNavigatorPreferences(bind);
50
52
  bind(FileNavigatorFilter).toSelf().inSingletonScope();
51
53
 
52
54
  bind(NavigatorContextKeyService).toSelf().inSingletonScope();
55
+ bind(WorkspaceRootNodeLabelProvider).toSelf().inSingletonScope();
56
+ bind(LabelProviderContribution).toService(WorkspaceRootNodeLabelProvider);
53
57
  bind(NavigatorFileClipboard).toSelf().inSingletonScope();
54
58
 
55
59
  bindViewContribution(bind, FileNavigatorContribution);
@@ -0,0 +1,74 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2026 Vinay Kaushal 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 { enableJSDOM } from '@theia/core/lib/browser/test/jsdom';
18
+ let disableJSDOM = enableJSDOM();
19
+
20
+ import { expect } from 'chai';
21
+ import URI from '@theia/core/lib/common/uri';
22
+ import { FileStat } from '@theia/filesystem/lib/common/files';
23
+ import { DirNode } from '@theia/filesystem/lib/browser/file-tree/file-tree';
24
+ import { FileTreeLabelProvider } from '@theia/filesystem/lib/browser/file-tree/file-tree-label-provider';
25
+ import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
26
+ import { WorkspaceNode, WorkspaceRootNode } from './navigator-tree';
27
+ import { WorkspaceRootNodeLabelProvider } from './workspace-root-node-label-provider';
28
+
29
+ disableJSDOM();
30
+
31
+ describe('WorkspaceRootNodeLabelProvider', () => {
32
+
33
+ before(() => disableJSDOM = enableJSDOM());
34
+ after(() => disableJSDOM());
35
+
36
+ const backend = 'file:///home/user/project/backend';
37
+ let labelProvider: WorkspaceRootNodeLabelProvider;
38
+
39
+ function dirNode(uri: string, parent: DirNode['parent']): DirNode {
40
+ const fileStat = FileStat.dir(uri);
41
+ return { id: uri, uri: fileStat.resource, fileStat, name: fileStat.resource.path.base, parent, children: [], expanded: false, selected: false };
42
+ }
43
+
44
+ function rootNode(uri: string): WorkspaceRootNode {
45
+ return dirNode(uri, WorkspaceNode.createRoot()) as WorkspaceRootNode;
46
+ }
47
+
48
+ beforeEach(() => {
49
+ labelProvider = new WorkspaceRootNodeLabelProvider();
50
+ Object.assign(labelProvider, {
51
+ fileTreeLabelProvider: { canHandle: () => 101 } as unknown as FileTreeLabelProvider,
52
+ workspaceService: {
53
+ getConfiguredRootName: (uri: URI) => uri.isEqual(new URI(backend)) ? 'API Server' : undefined
54
+ } as unknown as WorkspaceService
55
+ });
56
+ });
57
+
58
+ it('shows the name of a workspace root on its root node, with priority over the file tree', () => {
59
+ const root = rootNode(backend);
60
+ expect(labelProvider.canHandle(root)).to.equal(102);
61
+ expect(labelProvider.getName(root)).to.equal('API Server');
62
+ });
63
+
64
+ it('does not handle a node of the same folder that is not a root node', () => {
65
+ // e.g. one root nested inside another
66
+ const nested = dirNode(backend, rootNode('file:///home/user/project'));
67
+ expect(labelProvider.canHandle(nested)).to.equal(0);
68
+ });
69
+
70
+ it('falls back to the file tree label for a root without a name', () => {
71
+ const root = rootNode('file:///home/user/project/frontend');
72
+ expect(labelProvider.getName(root)).to.be.undefined;
73
+ });
74
+ });
@@ -0,0 +1,45 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2026 Vinay Kaushal 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 { inject, injectable } from '@theia/core/shared/inversify';
18
+ import { LabelProviderContribution } from '@theia/core/lib/browser/label-provider';
19
+ import { FileTreeLabelProvider } from '@theia/filesystem/lib/browser/file-tree/file-tree-label-provider';
20
+ import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
21
+ import { WorkspaceRootNode } from './navigator-tree';
22
+
23
+ /**
24
+ * Shows the name given to a workspace root in the workspace file on its node in the navigator.
25
+ * The name is only shown for the root node: where the folder appears otherwise, e.g. nested in another root, it shows its folder name, as in VS Code.
26
+ */
27
+ @injectable()
28
+ export class WorkspaceRootNodeLabelProvider implements LabelProviderContribution {
29
+
30
+ @inject(FileTreeLabelProvider)
31
+ protected readonly fileTreeLabelProvider: FileTreeLabelProvider;
32
+
33
+ @inject(WorkspaceService)
34
+ protected readonly workspaceService: WorkspaceService;
35
+
36
+ canHandle(element: object): number {
37
+ return WorkspaceRootNode.is(element) ? this.fileTreeLabelProvider.canHandle(element) + 1 : 0;
38
+ }
39
+
40
+ /** Returns the name of the root, or `undefined` to fall back to the label of the file tree node. */
41
+ getName(node: WorkspaceRootNode): string | undefined {
42
+ return this.workspaceService.getConfiguredRootName(node.uri);
43
+ }
44
+
45
+ }