@theia/workspace 1.34.3 → 1.34.4

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.
Files changed (105) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +30 -30
  3. package/lib/browser/diff-service.d.ts +10 -10
  4. package/lib/browser/diff-service.js +85 -85
  5. package/lib/browser/index.d.ts +6 -6
  6. package/lib/browser/index.js +33 -33
  7. package/lib/browser/quick-open-workspace.d.ts +25 -25
  8. package/lib/browser/quick-open-workspace.js +137 -137
  9. package/lib/browser/untitled-workspace-exit-dialog.d.ts +19 -19
  10. package/lib/browser/untitled-workspace-exit-dialog.js +74 -74
  11. package/lib/browser/workspace-breadcrumbs-contribution.d.ts +10 -10
  12. package/lib/browser/workspace-breadcrumbs-contribution.js +66 -66
  13. package/lib/browser/workspace-commands.d.ts +117 -117
  14. package/lib/browser/workspace-commands.js +593 -593
  15. package/lib/browser/workspace-commands.spec.d.ts +1 -1
  16. package/lib/browser/workspace-commands.spec.js +127 -127
  17. package/lib/browser/workspace-compare-handler.d.ts +26 -26
  18. package/lib/browser/workspace-compare-handler.js +66 -66
  19. package/lib/browser/workspace-delete-handler.d.ts +75 -75
  20. package/lib/browser/workspace-delete-handler.js +214 -214
  21. package/lib/browser/workspace-duplicate-handler.d.ts +30 -30
  22. package/lib/browser/workspace-duplicate-handler.js +86 -86
  23. package/lib/browser/workspace-frontend-contribution.d.ts +135 -135
  24. package/lib/browser/workspace-frontend-contribution.js +568 -568
  25. package/lib/browser/workspace-frontend-contribution.spec.d.ts +1 -1
  26. package/lib/browser/workspace-frontend-contribution.spec.js +53 -53
  27. package/lib/browser/workspace-frontend-module.d.ts +3 -3
  28. package/lib/browser/workspace-frontend-module.js +88 -88
  29. package/lib/browser/workspace-input-dialog.d.ts +19 -19
  30. package/lib/browser/workspace-input-dialog.js +73 -73
  31. package/lib/browser/workspace-preferences.d.ts +11 -11
  32. package/lib/browser/workspace-preferences.js +46 -46
  33. package/lib/browser/workspace-schema-updater.d.ts +32 -32
  34. package/lib/browser/workspace-schema-updater.js +148 -148
  35. package/lib/browser/workspace-service.d.ts +182 -182
  36. package/lib/browser/workspace-service.js +729 -729
  37. package/lib/browser/workspace-storage-service.d.ts +15 -15
  38. package/lib/browser/workspace-storage-service.js +80 -80
  39. package/lib/browser/workspace-trust-preferences.d.ts +21 -21
  40. package/lib/browser/workspace-trust-preferences.js +65 -65
  41. package/lib/browser/workspace-trust-service.d.ts +26 -26
  42. package/lib/browser/workspace-trust-service.js +149 -149
  43. package/lib/browser/workspace-uri-contribution.d.ts +20 -20
  44. package/lib/browser/workspace-uri-contribution.js +113 -113
  45. package/lib/browser/workspace-uri-contribution.spec.d.ts +1 -1
  46. package/lib/browser/workspace-uri-contribution.spec.js +169 -169
  47. package/lib/browser/workspace-user-working-directory-provider.d.ts +12 -12
  48. package/lib/browser/workspace-user-working-directory-provider.js +62 -62
  49. package/lib/browser/workspace-utils.d.ts +15 -15
  50. package/lib/browser/workspace-utils.js +54 -54
  51. package/lib/browser/workspace-variable-contribution.d.ts +23 -23
  52. package/lib/browser/workspace-variable-contribution.js +237 -237
  53. package/lib/browser/workspace-window-title-updater.d.ts +7 -7
  54. package/lib/browser/workspace-window-title-updater.js +57 -57
  55. package/lib/common/index.d.ts +2 -2
  56. package/lib/common/index.js +29 -29
  57. package/lib/common/test/mock-workspace-server.d.ts +7 -7
  58. package/lib/common/test/mock-workspace-server.js +35 -35
  59. package/lib/common/utils.d.ts +21 -21
  60. package/lib/common/utils.js +73 -73
  61. package/lib/common/workspace-protocol.d.ts +26 -26
  62. package/lib/common/workspace-protocol.js +23 -23
  63. package/lib/node/default-workspace-server.d.ts +64 -64
  64. package/lib/node/default-workspace-server.js +248 -248
  65. package/lib/node/default-workspace-server.spec.d.ts +1 -1
  66. package/lib/node/default-workspace-server.spec.js +84 -84
  67. package/lib/node/index.d.ts +2 -2
  68. package/lib/node/index.js +29 -29
  69. package/lib/node/workspace-backend-module.d.ts +3 -3
  70. package/lib/node/workspace-backend-module.js +32 -32
  71. package/package.json +6 -6
  72. package/src/browser/diff-service.ts +62 -62
  73. package/src/browser/index.ts +22 -22
  74. package/src/browser/quick-open-workspace.ts +112 -112
  75. package/src/browser/untitled-workspace-exit-dialog.ts +70 -70
  76. package/src/browser/workspace-breadcrumbs-contribution.ts +56 -56
  77. package/src/browser/workspace-commands.spec.ts +153 -153
  78. package/src/browser/workspace-commands.ts +586 -586
  79. package/src/browser/workspace-compare-handler.ts +56 -56
  80. package/src/browser/workspace-delete-handler.ts +212 -212
  81. package/src/browser/workspace-duplicate-handler.ts +75 -75
  82. package/src/browser/workspace-frontend-contribution.spec.ts +63 -63
  83. package/src/browser/workspace-frontend-contribution.ts +558 -558
  84. package/src/browser/workspace-frontend-module.ts +115 -115
  85. package/src/browser/workspace-input-dialog.ts +60 -60
  86. package/src/browser/workspace-preferences.ts +58 -58
  87. package/src/browser/workspace-schema-updater.ts +148 -148
  88. package/src/browser/workspace-service.ts +772 -772
  89. package/src/browser/workspace-storage-service.ts +67 -67
  90. package/src/browser/workspace-trust-preferences.ts +76 -76
  91. package/src/browser/workspace-trust-service.ts +143 -143
  92. package/src/browser/workspace-uri-contribution.spec.ts +191 -191
  93. package/src/browser/workspace-uri-contribution.ts +97 -97
  94. package/src/browser/workspace-user-working-directory-provider.ts +48 -48
  95. package/src/browser/workspace-utils.ts +45 -45
  96. package/src/browser/workspace-variable-contribution.ts +222 -222
  97. package/src/browser/workspace-window-title-updater.ts +45 -45
  98. package/src/common/index.ts +18 -18
  99. package/src/common/test/mock-workspace-server.ts +29 -29
  100. package/src/common/utils.ts +69 -69
  101. package/src/common/workspace-protocol.ts +47 -47
  102. package/src/node/default-workspace-server.spec.ts +99 -99
  103. package/src/node/default-workspace-server.ts +242 -242
  104. package/src/node/index.ts +18 -18
  105. package/src/node/workspace-backend-module.ts +37 -37
@@ -1,150 +1,150 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2021 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 WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.WorkspaceTrustService = void 0;
28
- const browser_1 = require("@theia/core/lib/browser");
29
- const preference_service_1 = require("@theia/core/lib/browser/preferences/preference-service");
30
- const message_service_1 = require("@theia/core/lib/common/message-service");
31
- const nls_1 = require("@theia/core/lib/common/nls");
32
- const promise_util_1 = require("@theia/core/lib/common/promise-util");
33
- const inversify_1 = require("@theia/core/shared/inversify");
34
- const window_service_1 = require("@theia/core/lib/browser/window/window-service");
35
- const workspace_trust_preferences_1 = require("./workspace-trust-preferences");
36
- const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
37
- const workspace_service_1 = require("./workspace-service");
38
- const STORAGE_TRUSTED = 'trusted';
39
- let WorkspaceTrustService = class WorkspaceTrustService {
40
- constructor() {
41
- this.workspaceTrust = new promise_util_1.Deferred();
42
- }
43
- async init() {
44
- await this.workspaceService.ready;
45
- await this.resolveWorkspaceTrust();
46
- this.preferences.onPreferenceChanged(change => this.handlePreferenceChange(change));
47
- }
48
- getWorkspaceTrust() {
49
- return this.workspaceTrust.promise;
50
- }
51
- async resolveWorkspaceTrust(givenTrust) {
52
- if (!this.isWorkspaceTrustResolved()) {
53
- const trust = givenTrust !== null && givenTrust !== void 0 ? givenTrust : await this.calculateWorkspaceTrust();
54
- if (trust !== undefined) {
55
- await this.storeWorkspaceTrust(trust);
56
- this.workspaceTrust.resolve(trust);
57
- }
58
- }
59
- }
60
- isWorkspaceTrustResolved() {
61
- return this.workspaceTrust.state !== 'unresolved';
62
- }
63
- async calculateWorkspaceTrust() {
64
- if (!this.workspaceTrustPref[workspace_trust_preferences_1.WORKSPACE_TRUST_ENABLED]) {
65
- // in VS Code if workspace trust is disabled, we implicitly trust the workspace
66
- return true;
67
- }
68
- if (this.workspaceTrustPref[workspace_trust_preferences_1.WORKSPACE_TRUST_EMPTY_WINDOW] && !this.workspaceService.workspace) {
69
- return true;
70
- }
71
- if (this.workspaceTrustPref[workspace_trust_preferences_1.WORKSPACE_TRUST_STARTUP_PROMPT] === workspace_trust_preferences_1.WorkspaceTrustPrompt.NEVER) {
72
- return false;
73
- }
74
- return this.loadWorkspaceTrust();
75
- }
76
- async loadWorkspaceTrust() {
77
- if (this.workspaceTrustPref[workspace_trust_preferences_1.WORKSPACE_TRUST_STARTUP_PROMPT] === workspace_trust_preferences_1.WorkspaceTrustPrompt.ONCE) {
78
- return this.storage.getData(STORAGE_TRUSTED);
79
- }
80
- }
81
- async storeWorkspaceTrust(trust) {
82
- if (this.workspaceTrustPref[workspace_trust_preferences_1.WORKSPACE_TRUST_STARTUP_PROMPT] === workspace_trust_preferences_1.WorkspaceTrustPrompt.ONCE) {
83
- return this.storage.setData(STORAGE_TRUSTED, trust);
84
- }
85
- }
86
- async handlePreferenceChange(change) {
87
- if (change.preferenceName === workspace_trust_preferences_1.WORKSPACE_TRUST_STARTUP_PROMPT && change.newValue !== workspace_trust_preferences_1.WorkspaceTrustPrompt.ONCE) {
88
- this.storage.setData(STORAGE_TRUSTED, undefined);
89
- }
90
- if (change.preferenceName === workspace_trust_preferences_1.WORKSPACE_TRUST_ENABLED && this.isWorkspaceTrustResolved() && await this.confirmRestart()) {
91
- this.windowService.setSafeToShutDown();
92
- this.windowService.reload();
93
- }
94
- if (change.preferenceName === workspace_trust_preferences_1.WORKSPACE_TRUST_ENABLED || change.preferenceName === workspace_trust_preferences_1.WORKSPACE_TRUST_EMPTY_WINDOW) {
95
- this.resolveWorkspaceTrust();
96
- }
97
- }
98
- async confirmRestart() {
99
- const shouldRestart = await new browser_1.ConfirmDialog({
100
- title: nls_1.nls.localizeByDefault('A setting has changed that requires a restart to take effect.'),
101
- msg: nls_1.nls.localizeByDefault('Press the restart button to restart {0} and enable the setting.', frontend_application_config_provider_1.FrontendApplicationConfigProvider.get().applicationName),
102
- ok: nls_1.nls.localizeByDefault('Restart'),
103
- cancel: browser_1.Dialog.CANCEL,
104
- }).open();
105
- return shouldRestart === true;
106
- }
107
- async requestWorkspaceTrust() {
108
- if (!this.isWorkspaceTrustResolved()) {
109
- const isTrusted = await this.messageService.info(nls_1.nls.localize('theia/workspace/trustRequest', 'An extension requests workspace trust but the corresponding API is not yet fully supported. Do you want to trust this workspace?'), browser_1.Dialog.YES, browser_1.Dialog.NO);
110
- const trusted = isTrusted === browser_1.Dialog.YES;
111
- this.resolveWorkspaceTrust(trusted);
112
- }
113
- return this.workspaceTrust.promise;
114
- }
115
- };
116
- __decorate([
117
- (0, inversify_1.inject)(workspace_service_1.WorkspaceService),
118
- __metadata("design:type", workspace_service_1.WorkspaceService)
119
- ], WorkspaceTrustService.prototype, "workspaceService", void 0);
120
- __decorate([
121
- (0, inversify_1.inject)(preference_service_1.PreferenceService),
122
- __metadata("design:type", Object)
123
- ], WorkspaceTrustService.prototype, "preferences", void 0);
124
- __decorate([
125
- (0, inversify_1.inject)(browser_1.StorageService),
126
- __metadata("design:type", Object)
127
- ], WorkspaceTrustService.prototype, "storage", void 0);
128
- __decorate([
129
- (0, inversify_1.inject)(message_service_1.MessageService),
130
- __metadata("design:type", message_service_1.MessageService)
131
- ], WorkspaceTrustService.prototype, "messageService", void 0);
132
- __decorate([
133
- (0, inversify_1.inject)(workspace_trust_preferences_1.WorkspaceTrustPreferences),
134
- __metadata("design:type", Object)
135
- ], WorkspaceTrustService.prototype, "workspaceTrustPref", void 0);
136
- __decorate([
137
- (0, inversify_1.inject)(window_service_1.WindowService),
138
- __metadata("design:type", Object)
139
- ], WorkspaceTrustService.prototype, "windowService", void 0);
140
- __decorate([
141
- (0, inversify_1.postConstruct)(),
142
- __metadata("design:type", Function),
143
- __metadata("design:paramtypes", []),
144
- __metadata("design:returntype", Promise)
145
- ], WorkspaceTrustService.prototype, "init", null);
146
- WorkspaceTrustService = __decorate([
147
- (0, inversify_1.injectable)()
148
- ], WorkspaceTrustService);
149
- exports.WorkspaceTrustService = WorkspaceTrustService;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2021 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 WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.WorkspaceTrustService = void 0;
28
+ const browser_1 = require("@theia/core/lib/browser");
29
+ const preference_service_1 = require("@theia/core/lib/browser/preferences/preference-service");
30
+ const message_service_1 = require("@theia/core/lib/common/message-service");
31
+ const nls_1 = require("@theia/core/lib/common/nls");
32
+ const promise_util_1 = require("@theia/core/lib/common/promise-util");
33
+ const inversify_1 = require("@theia/core/shared/inversify");
34
+ const window_service_1 = require("@theia/core/lib/browser/window/window-service");
35
+ const workspace_trust_preferences_1 = require("./workspace-trust-preferences");
36
+ const frontend_application_config_provider_1 = require("@theia/core/lib/browser/frontend-application-config-provider");
37
+ const workspace_service_1 = require("./workspace-service");
38
+ const STORAGE_TRUSTED = 'trusted';
39
+ let WorkspaceTrustService = class WorkspaceTrustService {
40
+ constructor() {
41
+ this.workspaceTrust = new promise_util_1.Deferred();
42
+ }
43
+ async init() {
44
+ await this.workspaceService.ready;
45
+ await this.resolveWorkspaceTrust();
46
+ this.preferences.onPreferenceChanged(change => this.handlePreferenceChange(change));
47
+ }
48
+ getWorkspaceTrust() {
49
+ return this.workspaceTrust.promise;
50
+ }
51
+ async resolveWorkspaceTrust(givenTrust) {
52
+ if (!this.isWorkspaceTrustResolved()) {
53
+ const trust = givenTrust !== null && givenTrust !== void 0 ? givenTrust : await this.calculateWorkspaceTrust();
54
+ if (trust !== undefined) {
55
+ await this.storeWorkspaceTrust(trust);
56
+ this.workspaceTrust.resolve(trust);
57
+ }
58
+ }
59
+ }
60
+ isWorkspaceTrustResolved() {
61
+ return this.workspaceTrust.state !== 'unresolved';
62
+ }
63
+ async calculateWorkspaceTrust() {
64
+ if (!this.workspaceTrustPref[workspace_trust_preferences_1.WORKSPACE_TRUST_ENABLED]) {
65
+ // in VS Code if workspace trust is disabled, we implicitly trust the workspace
66
+ return true;
67
+ }
68
+ if (this.workspaceTrustPref[workspace_trust_preferences_1.WORKSPACE_TRUST_EMPTY_WINDOW] && !this.workspaceService.workspace) {
69
+ return true;
70
+ }
71
+ if (this.workspaceTrustPref[workspace_trust_preferences_1.WORKSPACE_TRUST_STARTUP_PROMPT] === workspace_trust_preferences_1.WorkspaceTrustPrompt.NEVER) {
72
+ return false;
73
+ }
74
+ return this.loadWorkspaceTrust();
75
+ }
76
+ async loadWorkspaceTrust() {
77
+ if (this.workspaceTrustPref[workspace_trust_preferences_1.WORKSPACE_TRUST_STARTUP_PROMPT] === workspace_trust_preferences_1.WorkspaceTrustPrompt.ONCE) {
78
+ return this.storage.getData(STORAGE_TRUSTED);
79
+ }
80
+ }
81
+ async storeWorkspaceTrust(trust) {
82
+ if (this.workspaceTrustPref[workspace_trust_preferences_1.WORKSPACE_TRUST_STARTUP_PROMPT] === workspace_trust_preferences_1.WorkspaceTrustPrompt.ONCE) {
83
+ return this.storage.setData(STORAGE_TRUSTED, trust);
84
+ }
85
+ }
86
+ async handlePreferenceChange(change) {
87
+ if (change.preferenceName === workspace_trust_preferences_1.WORKSPACE_TRUST_STARTUP_PROMPT && change.newValue !== workspace_trust_preferences_1.WorkspaceTrustPrompt.ONCE) {
88
+ this.storage.setData(STORAGE_TRUSTED, undefined);
89
+ }
90
+ if (change.preferenceName === workspace_trust_preferences_1.WORKSPACE_TRUST_ENABLED && this.isWorkspaceTrustResolved() && await this.confirmRestart()) {
91
+ this.windowService.setSafeToShutDown();
92
+ this.windowService.reload();
93
+ }
94
+ if (change.preferenceName === workspace_trust_preferences_1.WORKSPACE_TRUST_ENABLED || change.preferenceName === workspace_trust_preferences_1.WORKSPACE_TRUST_EMPTY_WINDOW) {
95
+ this.resolveWorkspaceTrust();
96
+ }
97
+ }
98
+ async confirmRestart() {
99
+ const shouldRestart = await new browser_1.ConfirmDialog({
100
+ title: nls_1.nls.localizeByDefault('A setting has changed that requires a restart to take effect.'),
101
+ msg: nls_1.nls.localizeByDefault('Press the restart button to restart {0} and enable the setting.', frontend_application_config_provider_1.FrontendApplicationConfigProvider.get().applicationName),
102
+ ok: nls_1.nls.localizeByDefault('Restart'),
103
+ cancel: browser_1.Dialog.CANCEL,
104
+ }).open();
105
+ return shouldRestart === true;
106
+ }
107
+ async requestWorkspaceTrust() {
108
+ if (!this.isWorkspaceTrustResolved()) {
109
+ const isTrusted = await this.messageService.info(nls_1.nls.localize('theia/workspace/trustRequest', 'An extension requests workspace trust but the corresponding API is not yet fully supported. Do you want to trust this workspace?'), browser_1.Dialog.YES, browser_1.Dialog.NO);
110
+ const trusted = isTrusted === browser_1.Dialog.YES;
111
+ this.resolveWorkspaceTrust(trusted);
112
+ }
113
+ return this.workspaceTrust.promise;
114
+ }
115
+ };
116
+ __decorate([
117
+ (0, inversify_1.inject)(workspace_service_1.WorkspaceService),
118
+ __metadata("design:type", workspace_service_1.WorkspaceService)
119
+ ], WorkspaceTrustService.prototype, "workspaceService", void 0);
120
+ __decorate([
121
+ (0, inversify_1.inject)(preference_service_1.PreferenceService),
122
+ __metadata("design:type", Object)
123
+ ], WorkspaceTrustService.prototype, "preferences", void 0);
124
+ __decorate([
125
+ (0, inversify_1.inject)(browser_1.StorageService),
126
+ __metadata("design:type", Object)
127
+ ], WorkspaceTrustService.prototype, "storage", void 0);
128
+ __decorate([
129
+ (0, inversify_1.inject)(message_service_1.MessageService),
130
+ __metadata("design:type", message_service_1.MessageService)
131
+ ], WorkspaceTrustService.prototype, "messageService", void 0);
132
+ __decorate([
133
+ (0, inversify_1.inject)(workspace_trust_preferences_1.WorkspaceTrustPreferences),
134
+ __metadata("design:type", Object)
135
+ ], WorkspaceTrustService.prototype, "workspaceTrustPref", void 0);
136
+ __decorate([
137
+ (0, inversify_1.inject)(window_service_1.WindowService),
138
+ __metadata("design:type", Object)
139
+ ], WorkspaceTrustService.prototype, "windowService", void 0);
140
+ __decorate([
141
+ (0, inversify_1.postConstruct)(),
142
+ __metadata("design:type", Function),
143
+ __metadata("design:paramtypes", []),
144
+ __metadata("design:returntype", Promise)
145
+ ], WorkspaceTrustService.prototype, "init", null);
146
+ WorkspaceTrustService = __decorate([
147
+ (0, inversify_1.injectable)()
148
+ ], WorkspaceTrustService);
149
+ exports.WorkspaceTrustService = WorkspaceTrustService;
150
150
  //# sourceMappingURL=workspace-trust-service.js.map
@@ -1,21 +1,21 @@
1
- import { DefaultUriLabelProviderContribution, URIIconReference } from '@theia/core/lib/browser/label-provider';
2
- import URI from '@theia/core/lib/common/uri';
3
- import { FileStat } from '@theia/filesystem/lib/common/files';
4
- import { WorkspaceService } from './workspace-service';
5
- import { WorkspaceVariableContribution } from './workspace-variable-contribution';
6
- export declare class WorkspaceUriLabelProviderContribution extends DefaultUriLabelProviderContribution {
7
- protected readonly workspaceVariable: WorkspaceVariableContribution;
8
- protected readonly workspaceService: WorkspaceService;
9
- init(): Promise<void>;
10
- canHandle(element: object): number;
11
- getIcon(element: URI | URIIconReference | FileStat): string;
12
- getName(element: URI | URIIconReference | FileStat): string | undefined;
13
- /**
14
- * trims the workspace root from a file uri, if it is a child.
15
- */
16
- getLongName(element: URI | URIIconReference | FileStat): string | undefined;
17
- getDetails(element: URI | URIIconReference | FileStat): string | undefined;
18
- protected asURIIconReference(element: URI | URIIconReference | FileStat): URI | URIIconReference;
19
- protected getUri(element: URI | URIIconReference | FileStat): URI | undefined;
20
- }
1
+ import { DefaultUriLabelProviderContribution, URIIconReference } from '@theia/core/lib/browser/label-provider';
2
+ import URI from '@theia/core/lib/common/uri';
3
+ import { FileStat } from '@theia/filesystem/lib/common/files';
4
+ import { WorkspaceService } from './workspace-service';
5
+ import { WorkspaceVariableContribution } from './workspace-variable-contribution';
6
+ export declare class WorkspaceUriLabelProviderContribution extends DefaultUriLabelProviderContribution {
7
+ protected readonly workspaceVariable: WorkspaceVariableContribution;
8
+ protected readonly workspaceService: WorkspaceService;
9
+ init(): Promise<void>;
10
+ canHandle(element: object): number;
11
+ getIcon(element: URI | URIIconReference | FileStat): string;
12
+ getName(element: URI | URIIconReference | FileStat): string | undefined;
13
+ /**
14
+ * trims the workspace root from a file uri, if it is a child.
15
+ */
16
+ getLongName(element: URI | URIIconReference | FileStat): string | undefined;
17
+ getDetails(element: URI | URIIconReference | FileStat): string | undefined;
18
+ protected asURIIconReference(element: URI | URIIconReference | FileStat): URI | URIIconReference;
19
+ protected getUri(element: URI | URIIconReference | FileStat): URI | undefined;
20
+ }
21
21
  //# sourceMappingURL=workspace-uri-contribution.d.ts.map
@@ -1,114 +1,114 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2017 TypeFox 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 WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.WorkspaceUriLabelProviderContribution = void 0;
28
- const label_provider_1 = require("@theia/core/lib/browser/label-provider");
29
- const uri_1 = require("@theia/core/lib/common/uri");
30
- const inversify_1 = require("@theia/core/shared/inversify");
31
- const files_1 = require("@theia/filesystem/lib/common/files");
32
- const workspace_service_1 = require("./workspace-service");
33
- const workspace_variable_contribution_1 = require("./workspace-variable-contribution");
34
- let WorkspaceUriLabelProviderContribution = class WorkspaceUriLabelProviderContribution extends label_provider_1.DefaultUriLabelProviderContribution {
35
- async init() {
36
- // no-op, backward compatibility
37
- }
38
- canHandle(element) {
39
- if ((element instanceof uri_1.default && element.scheme === 'file' || label_provider_1.URIIconReference.is(element) || files_1.FileStat.is(element))) {
40
- return 10;
41
- }
42
- return 0;
43
- }
44
- getIcon(element) {
45
- return super.getIcon(this.asURIIconReference(element));
46
- }
47
- getName(element) {
48
- return super.getName(this.asURIIconReference(element));
49
- }
50
- /**
51
- * trims the workspace root from a file uri, if it is a child.
52
- */
53
- getLongName(element) {
54
- const uri = this.getUri(element);
55
- if (uri) {
56
- const formatting = this.findFormatting(uri);
57
- if (formatting) {
58
- return this.formatUri(uri, formatting);
59
- }
60
- }
61
- const relativePath = uri && this.workspaceVariable.getWorkspaceRelativePath(uri);
62
- return relativePath || super.getLongName(this.asURIIconReference(element));
63
- }
64
- getDetails(element) {
65
- const uri = this.getUri(element);
66
- if (!uri) {
67
- return this.getLongName(element);
68
- }
69
- // Parent in order to omit the name - that's what comes out of `getName`, and `getDetails` should supplement, not duplicate.
70
- const relativePath = uri && this.workspaceVariable.getWorkspaceRelativePath(uri.parent);
71
- if (relativePath !== undefined) {
72
- const prefix = this.workspaceService.tryGetRoots().length > 1 ? this.getName(this.workspaceVariable.getWorkspaceRootUri(uri)) : '';
73
- const separator = prefix && relativePath ? ' • ' : '';
74
- return prefix + separator + relativePath;
75
- }
76
- return this.getLongName(uri.parent);
77
- }
78
- asURIIconReference(element) {
79
- var _a;
80
- if (files_1.FileStat.is(element)) {
81
- return label_provider_1.URIIconReference.create(element.isDirectory ? 'folder' : 'file', element.resource);
82
- }
83
- const uri = this.getUri(element);
84
- if (uri && ((_a = this.workspaceVariable.getWorkspaceRootUri(uri)) === null || _a === void 0 ? void 0 : _a.isEqual(uri))) {
85
- return label_provider_1.URIIconReference.create('folder', uri);
86
- }
87
- return element;
88
- }
89
- getUri(element) {
90
- if (files_1.FileStat.is(element)) {
91
- return element.resource;
92
- }
93
- return super.getUri(element);
94
- }
95
- };
96
- __decorate([
97
- (0, inversify_1.inject)(workspace_variable_contribution_1.WorkspaceVariableContribution),
98
- __metadata("design:type", workspace_variable_contribution_1.WorkspaceVariableContribution)
99
- ], WorkspaceUriLabelProviderContribution.prototype, "workspaceVariable", void 0);
100
- __decorate([
101
- (0, inversify_1.inject)(workspace_service_1.WorkspaceService),
102
- __metadata("design:type", workspace_service_1.WorkspaceService)
103
- ], WorkspaceUriLabelProviderContribution.prototype, "workspaceService", void 0);
104
- __decorate([
105
- (0, inversify_1.postConstruct)(),
106
- __metadata("design:type", Function),
107
- __metadata("design:paramtypes", []),
108
- __metadata("design:returntype", Promise)
109
- ], WorkspaceUriLabelProviderContribution.prototype, "init", null);
110
- WorkspaceUriLabelProviderContribution = __decorate([
111
- (0, inversify_1.injectable)()
112
- ], WorkspaceUriLabelProviderContribution);
113
- exports.WorkspaceUriLabelProviderContribution = WorkspaceUriLabelProviderContribution;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2017 TypeFox 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 WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.WorkspaceUriLabelProviderContribution = void 0;
28
+ const label_provider_1 = require("@theia/core/lib/browser/label-provider");
29
+ const uri_1 = require("@theia/core/lib/common/uri");
30
+ const inversify_1 = require("@theia/core/shared/inversify");
31
+ const files_1 = require("@theia/filesystem/lib/common/files");
32
+ const workspace_service_1 = require("./workspace-service");
33
+ const workspace_variable_contribution_1 = require("./workspace-variable-contribution");
34
+ let WorkspaceUriLabelProviderContribution = class WorkspaceUriLabelProviderContribution extends label_provider_1.DefaultUriLabelProviderContribution {
35
+ async init() {
36
+ // no-op, backward compatibility
37
+ }
38
+ canHandle(element) {
39
+ if ((element instanceof uri_1.default && element.scheme === 'file' || label_provider_1.URIIconReference.is(element) || files_1.FileStat.is(element))) {
40
+ return 10;
41
+ }
42
+ return 0;
43
+ }
44
+ getIcon(element) {
45
+ return super.getIcon(this.asURIIconReference(element));
46
+ }
47
+ getName(element) {
48
+ return super.getName(this.asURIIconReference(element));
49
+ }
50
+ /**
51
+ * trims the workspace root from a file uri, if it is a child.
52
+ */
53
+ getLongName(element) {
54
+ const uri = this.getUri(element);
55
+ if (uri) {
56
+ const formatting = this.findFormatting(uri);
57
+ if (formatting) {
58
+ return this.formatUri(uri, formatting);
59
+ }
60
+ }
61
+ const relativePath = uri && this.workspaceVariable.getWorkspaceRelativePath(uri);
62
+ return relativePath || super.getLongName(this.asURIIconReference(element));
63
+ }
64
+ getDetails(element) {
65
+ const uri = this.getUri(element);
66
+ if (!uri) {
67
+ return this.getLongName(element);
68
+ }
69
+ // Parent in order to omit the name - that's what comes out of `getName`, and `getDetails` should supplement, not duplicate.
70
+ const relativePath = uri && this.workspaceVariable.getWorkspaceRelativePath(uri.parent);
71
+ if (relativePath !== undefined) {
72
+ const prefix = this.workspaceService.tryGetRoots().length > 1 ? this.getName(this.workspaceVariable.getWorkspaceRootUri(uri)) : '';
73
+ const separator = prefix && relativePath ? ' • ' : '';
74
+ return prefix + separator + relativePath;
75
+ }
76
+ return this.getLongName(uri.parent);
77
+ }
78
+ asURIIconReference(element) {
79
+ var _a;
80
+ if (files_1.FileStat.is(element)) {
81
+ return label_provider_1.URIIconReference.create(element.isDirectory ? 'folder' : 'file', element.resource);
82
+ }
83
+ const uri = this.getUri(element);
84
+ if (uri && ((_a = this.workspaceVariable.getWorkspaceRootUri(uri)) === null || _a === void 0 ? void 0 : _a.isEqual(uri))) {
85
+ return label_provider_1.URIIconReference.create('folder', uri);
86
+ }
87
+ return element;
88
+ }
89
+ getUri(element) {
90
+ if (files_1.FileStat.is(element)) {
91
+ return element.resource;
92
+ }
93
+ return super.getUri(element);
94
+ }
95
+ };
96
+ __decorate([
97
+ (0, inversify_1.inject)(workspace_variable_contribution_1.WorkspaceVariableContribution),
98
+ __metadata("design:type", workspace_variable_contribution_1.WorkspaceVariableContribution)
99
+ ], WorkspaceUriLabelProviderContribution.prototype, "workspaceVariable", void 0);
100
+ __decorate([
101
+ (0, inversify_1.inject)(workspace_service_1.WorkspaceService),
102
+ __metadata("design:type", workspace_service_1.WorkspaceService)
103
+ ], WorkspaceUriLabelProviderContribution.prototype, "workspaceService", void 0);
104
+ __decorate([
105
+ (0, inversify_1.postConstruct)(),
106
+ __metadata("design:type", Function),
107
+ __metadata("design:paramtypes", []),
108
+ __metadata("design:returntype", Promise)
109
+ ], WorkspaceUriLabelProviderContribution.prototype, "init", null);
110
+ WorkspaceUriLabelProviderContribution = __decorate([
111
+ (0, inversify_1.injectable)()
112
+ ], WorkspaceUriLabelProviderContribution);
113
+ exports.WorkspaceUriLabelProviderContribution = WorkspaceUriLabelProviderContribution;
114
114
  //# sourceMappingURL=workspace-uri-contribution.js.map
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=workspace-uri-contribution.spec.d.ts.map