@theia/workspace 1.77.0-next.99 → 1.78.0-next.0

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 (201) hide show
  1. package/lib/browser/canonical-uri-service.js +12 -16
  2. package/lib/browser/canonical-uri-service.js.map +1 -1
  3. package/lib/browser/diff-service.js +23 -29
  4. package/lib/browser/diff-service.js.map +1 -1
  5. package/lib/browser/index.d.ts +8 -8
  6. package/lib/browser/index.d.ts.map +1 -1
  7. package/lib/browser/index.js +8 -11
  8. package/lib/browser/index.js.map +1 -1
  9. package/lib/browser/metadata-storage/index.d.ts +2 -2
  10. package/lib/browser/metadata-storage/index.d.ts.map +1 -1
  11. package/lib/browser/metadata-storage/index.js +2 -9
  12. package/lib/browser/metadata-storage/index.js.map +1 -1
  13. package/lib/browser/metadata-storage/workspace-metadata-storage-service.d.ts +6 -2
  14. package/lib/browser/metadata-storage/workspace-metadata-storage-service.d.ts.map +1 -1
  15. package/lib/browser/metadata-storage/workspace-metadata-storage-service.js +34 -36
  16. package/lib/browser/metadata-storage/workspace-metadata-storage-service.js.map +1 -1
  17. package/lib/browser/metadata-storage/workspace-metadata-storage-service.spec.js +70 -74
  18. package/lib/browser/metadata-storage/workspace-metadata-storage-service.spec.js.map +1 -1
  19. package/lib/browser/metadata-storage/workspace-metadata-store.d.ts +1 -1
  20. package/lib/browser/metadata-storage/workspace-metadata-store.d.ts.map +1 -1
  21. package/lib/browser/metadata-storage/workspace-metadata-store.js +19 -28
  22. package/lib/browser/metadata-storage/workspace-metadata-store.js.map +1 -1
  23. package/lib/browser/quick-open-workspace.d.ts +2 -2
  24. package/lib/browser/quick-open-workspace.d.ts.map +1 -1
  25. package/lib/browser/quick-open-workspace.js +31 -40
  26. package/lib/browser/quick-open-workspace.js.map +1 -1
  27. package/lib/browser/test/with-workspace-service-defaults.d.ts +1 -1
  28. package/lib/browser/test/with-workspace-service-defaults.d.ts.map +1 -1
  29. package/lib/browser/test/with-workspace-service-defaults.js +3 -6
  30. package/lib/browser/test/with-workspace-service-defaults.js.map +1 -1
  31. package/lib/browser/untitled-workspace-exit-dialog.js +14 -18
  32. package/lib/browser/untitled-workspace-exit-dialog.js.map +1 -1
  33. package/lib/browser/workspace-breadcrumbs-contribution.d.ts +1 -1
  34. package/lib/browser/workspace-breadcrumbs-contribution.d.ts.map +1 -1
  35. package/lib/browser/workspace-breadcrumbs-contribution.js +13 -17
  36. package/lib/browser/workspace-breadcrumbs-contribution.js.map +1 -1
  37. package/lib/browser/workspace-commands.d.ts +5 -5
  38. package/lib/browser/workspace-commands.d.ts.map +1 -1
  39. package/lib/browser/workspace-commands.js +129 -146
  40. package/lib/browser/workspace-commands.js.map +1 -1
  41. package/lib/browser/workspace-commands.spec.js +50 -53
  42. package/lib/browser/workspace-commands.spec.js.map +1 -1
  43. package/lib/browser/workspace-compare-handler.d.ts +1 -1
  44. package/lib/browser/workspace-compare-handler.d.ts.map +1 -1
  45. package/lib/browser/workspace-compare-handler.js +8 -12
  46. package/lib/browser/workspace-compare-handler.js.map +1 -1
  47. package/lib/browser/workspace-delete-handler.d.ts +2 -2
  48. package/lib/browser/workspace-delete-handler.d.ts.map +1 -1
  49. package/lib/browser/workspace-delete-handler.js +42 -51
  50. package/lib/browser/workspace-delete-handler.js.map +1 -1
  51. package/lib/browser/workspace-duplicate-handler.d.ts +2 -2
  52. package/lib/browser/workspace-duplicate-handler.d.ts.map +1 -1
  53. package/lib/browser/workspace-duplicate-handler.js +20 -27
  54. package/lib/browser/workspace-duplicate-handler.js.map +1 -1
  55. package/lib/browser/workspace-files-exclude-filter-provider.d.ts +1 -1
  56. package/lib/browser/workspace-files-exclude-filter-provider.d.ts.map +1 -1
  57. package/lib/browser/workspace-files-exclude-filter-provider.js +12 -19
  58. package/lib/browser/workspace-files-exclude-filter-provider.js.map +1 -1
  59. package/lib/browser/workspace-frontend-contribution.d.ts +4 -4
  60. package/lib/browser/workspace-frontend-contribution.d.ts.map +1 -1
  61. package/lib/browser/workspace-frontend-contribution.js +125 -141
  62. package/lib/browser/workspace-frontend-contribution.js.map +1 -1
  63. package/lib/browser/workspace-frontend-module.js +85 -87
  64. package/lib/browser/workspace-frontend-module.js.map +1 -1
  65. package/lib/browser/workspace-input-dialog.js +13 -18
  66. package/lib/browser/workspace-input-dialog.js.map +1 -1
  67. package/lib/browser/workspace-schema-updater.d.ts +1 -1
  68. package/lib/browser/workspace-schema-updater.d.ts.map +1 -1
  69. package/lib/browser/workspace-schema-updater.js +33 -41
  70. package/lib/browser/workspace-schema-updater.js.map +1 -1
  71. package/lib/browser/workspace-search-filter-service.js +13 -20
  72. package/lib/browser/workspace-search-filter-service.js.map +1 -1
  73. package/lib/browser/workspace-search-filter-service.spec.js +18 -21
  74. package/lib/browser/workspace-search-filter-service.spec.js.map +1 -1
  75. package/lib/browser/workspace-service.d.ts +3 -3
  76. package/lib/browser/workspace-service.d.ts.map +1 -1
  77. package/lib/browser/workspace-service.js +107 -130
  78. package/lib/browser/workspace-service.js.map +1 -1
  79. package/lib/browser/workspace-service.spec.js +106 -109
  80. package/lib/browser/workspace-service.spec.js.map +1 -1
  81. package/lib/browser/workspace-storage-service.d.ts +1 -1
  82. package/lib/browser/workspace-storage-service.d.ts.map +1 -1
  83. package/lib/browser/workspace-storage-service.js +13 -21
  84. package/lib/browser/workspace-storage-service.js.map +1 -1
  85. package/lib/browser/workspace-trust-dialog.js +9 -13
  86. package/lib/browser/workspace-trust-dialog.js.map +1 -1
  87. package/lib/browser/workspace-trust-service.d.ts +3 -3
  88. package/lib/browser/workspace-trust-service.d.ts.map +1 -1
  89. package/lib/browser/workspace-trust-service.js +106 -127
  90. package/lib/browser/workspace-trust-service.js.map +1 -1
  91. package/lib/browser/workspace-trust-service.spec.js +159 -150
  92. package/lib/browser/workspace-trust-service.spec.js.map +1 -1
  93. package/lib/browser/workspace-uri-contribution.d.ts +2 -2
  94. package/lib/browser/workspace-uri-contribution.d.ts.map +1 -1
  95. package/lib/browser/workspace-uri-contribution.js +23 -31
  96. package/lib/browser/workspace-uri-contribution.js.map +1 -1
  97. package/lib/browser/workspace-uri-contribution.spec.js +95 -98
  98. package/lib/browser/workspace-uri-contribution.spec.js.map +1 -1
  99. package/lib/browser/workspace-user-working-directory-provider.d.ts +1 -1
  100. package/lib/browser/workspace-user-working-directory-provider.d.ts.map +1 -1
  101. package/lib/browser/workspace-user-working-directory-provider.js +13 -18
  102. package/lib/browser/workspace-user-working-directory-provider.js.map +1 -1
  103. package/lib/browser/workspace-utils.d.ts +1 -1
  104. package/lib/browser/workspace-utils.d.ts.map +1 -1
  105. package/lib/browser/workspace-utils.js +8 -12
  106. package/lib/browser/workspace-utils.js.map +1 -1
  107. package/lib/browser/workspace-variable-contribution.d.ts +1 -1
  108. package/lib/browser/workspace-variable-contribution.d.ts.map +1 -1
  109. package/lib/browser/workspace-variable-contribution.js +37 -47
  110. package/lib/browser/workspace-variable-contribution.js.map +1 -1
  111. package/lib/browser/workspace-window-title-updater.d.ts +1 -1
  112. package/lib/browser/workspace-window-title-updater.d.ts.map +1 -1
  113. package/lib/browser/workspace-window-title-updater.js +12 -16
  114. package/lib/browser/workspace-window-title-updater.js.map +1 -1
  115. package/lib/browser-only/browser-only-workspace-server.d.ts +1 -1
  116. package/lib/browser-only/browser-only-workspace-server.d.ts.map +1 -1
  117. package/lib/browser-only/browser-only-workspace-server.js +17 -22
  118. package/lib/browser-only/browser-only-workspace-server.js.map +1 -1
  119. package/lib/browser-only/workspace-frontend-only-module.js +8 -10
  120. package/lib/browser-only/workspace-frontend-only-module.js.map +1 -1
  121. package/lib/common/index.d.ts +4 -4
  122. package/lib/common/index.d.ts.map +1 -1
  123. package/lib/common/index.js +4 -7
  124. package/lib/common/index.js.map +1 -1
  125. package/lib/common/test/mock-workspace-server.d.ts +1 -1
  126. package/lib/common/test/mock-workspace-server.d.ts.map +1 -1
  127. package/lib/common/test/mock-workspace-server.js +5 -8
  128. package/lib/common/test/mock-workspace-server.js.map +1 -1
  129. package/lib/common/untitled-workspace-service.d.ts +1 -1
  130. package/lib/common/untitled-workspace-service.d.ts.map +1 -1
  131. package/lib/common/untitled-workspace-service.js +8 -12
  132. package/lib/common/untitled-workspace-service.js.map +1 -1
  133. package/lib/common/workspace-file-service.js +11 -14
  134. package/lib/common/workspace-file-service.js.map +1 -1
  135. package/lib/common/workspace-preferences.js +14 -19
  136. package/lib/common/workspace-preferences.js.map +1 -1
  137. package/lib/common/workspace-protocol.js +2 -5
  138. package/lib/common/workspace-protocol.js.map +1 -1
  139. package/lib/common/workspace-trust-preferences.js +29 -34
  140. package/lib/common/workspace-trust-preferences.js.map +1 -1
  141. package/lib/electron-browser/electron-workspace-contribution.d.ts +1 -1
  142. package/lib/electron-browser/electron-workspace-contribution.d.ts.map +1 -1
  143. package/lib/electron-browser/electron-workspace-contribution.js +11 -15
  144. package/lib/electron-browser/electron-workspace-contribution.js.map +1 -1
  145. package/lib/electron-browser/electron-workspace-module.js +6 -8
  146. package/lib/electron-browser/electron-workspace-module.js.map +1 -1
  147. package/lib/node/default-workspace-server.d.ts +1 -1
  148. package/lib/node/default-workspace-server.d.ts.map +1 -1
  149. package/lib/node/default-workspace-server.js +51 -63
  150. package/lib/node/default-workspace-server.js.map +1 -1
  151. package/lib/node/default-workspace-server.spec.js +29 -32
  152. package/lib/node/default-workspace-server.spec.js.map +1 -1
  153. package/lib/node/index.d.ts +2 -2
  154. package/lib/node/index.d.ts.map +1 -1
  155. package/lib/node/index.js +2 -5
  156. package/lib/node/index.js.map +1 -1
  157. package/lib/node/workspace-backend-module.js +21 -23
  158. package/lib/node/workspace-backend-module.js.map +1 -1
  159. package/package.json +18 -6
  160. package/src/browser/index.ts +8 -8
  161. package/src/browser/metadata-storage/index.ts +2 -2
  162. package/src/browser/metadata-storage/workspace-metadata-storage-service.spec.ts +4 -5
  163. package/src/browser/metadata-storage/workspace-metadata-storage-service.ts +10 -3
  164. package/src/browser/metadata-storage/workspace-metadata-store.ts +1 -1
  165. package/src/browser/quick-open-workspace.ts +2 -2
  166. package/src/browser/test/with-workspace-service-defaults.ts +1 -1
  167. package/src/browser/untitled-workspace-exit-dialog.ts +1 -1
  168. package/src/browser/workspace-breadcrumbs-contribution.ts +1 -1
  169. package/src/browser/workspace-commands.spec.ts +6 -6
  170. package/src/browser/workspace-commands.ts +7 -8
  171. package/src/browser/workspace-compare-handler.ts +1 -1
  172. package/src/browser/workspace-delete-handler.ts +2 -2
  173. package/src/browser/workspace-duplicate-handler.ts +2 -2
  174. package/src/browser/workspace-files-exclude-filter-provider.ts +1 -1
  175. package/src/browser/workspace-frontend-contribution.ts +6 -6
  176. package/src/browser/workspace-frontend-module.ts +25 -25
  177. package/src/browser/workspace-schema-updater.ts +1 -1
  178. package/src/browser/workspace-search-filter-service.spec.ts +1 -1
  179. package/src/browser/workspace-service.spec.ts +1 -1
  180. package/src/browser/workspace-service.ts +3 -3
  181. package/src/browser/workspace-storage-service.ts +1 -1
  182. package/src/browser/workspace-trust-service.spec.ts +15 -3
  183. package/src/browser/workspace-trust-service.ts +5 -5
  184. package/src/browser/workspace-uri-contribution.spec.ts +3 -3
  185. package/src/browser/workspace-uri-contribution.ts +2 -2
  186. package/src/browser/workspace-user-working-directory-provider.ts +1 -1
  187. package/src/browser/workspace-utils.ts +1 -1
  188. package/src/browser/workspace-variable-contribution.ts +1 -1
  189. package/src/browser/workspace-window-title-updater.ts +1 -1
  190. package/src/browser-only/browser-only-workspace-server.ts +1 -1
  191. package/src/browser-only/workspace-frontend-only-module.ts +2 -2
  192. package/src/common/index.ts +4 -4
  193. package/src/common/test/mock-workspace-server.ts +1 -1
  194. package/src/common/untitled-workspace-service.ts +1 -1
  195. package/src/electron-browser/electron-workspace-contribution.ts +1 -1
  196. package/src/electron-browser/electron-workspace-module.ts +1 -1
  197. package/src/node/default-workspace-server.spec.ts +2 -2
  198. package/src/node/default-workspace-server.ts +1 -1
  199. package/src/node/index.ts +2 -2
  200. package/src/node/workspace-backend-module.ts +3 -3
  201. package/src/typings/valid-filename.d.ts +20 -0
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // *****************************************************************************
3
2
  // Copyright (C) 2017 TypeFox and others.
4
3
  //
@@ -14,31 +13,29 @@
14
13
  //
15
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
15
  // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.WorkspaceData = exports.WorkspaceService = exports.WorkspaceHandlingContribution = exports.WorkspaceOpenHandlerContribution = void 0;
19
- const tslib_1 = require("tslib");
20
- const inversify_1 = require("@theia/core/shared/inversify");
21
- const uri_1 = tslib_1.__importDefault(require("@theia/core/lib/common/uri"));
22
- const path_1 = require("@theia/core/lib/common/path");
23
- const common_1 = require("../common");
24
- const window_service_1 = require("@theia/core/lib/browser/window/window-service");
25
- const window_1 = require("@theia/core/lib/common/window");
26
- const browser_1 = require("@theia/core/lib/browser");
27
- const promise_util_1 = require("@theia/core/lib/common/promise-util");
28
- const env_variables_1 = require("@theia/core/lib/common/env-variables");
29
- const core_1 = require("@theia/core");
30
- const workspace_preferences_1 = require("../common/workspace-preferences");
31
- const jsoncparser = tslib_1.__importStar(require("jsonc-parser"));
32
- const ajv_1 = tslib_1.__importDefault(require("@theia/core/shared/ajv"));
33
- const files_1 = require("@theia/filesystem/lib/common/files");
34
- const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
35
- const window_title_service_1 = require("@theia/core/lib/browser/window/window-title-service");
36
- const common_2 = require("@theia/filesystem/lib/common");
37
- const workspace_schema_updater_1 = require("./workspace-schema-updater");
38
- const frontend_application_state_1 = require("@theia/core/lib/common/frontend-application-state");
39
- const preferences_1 = require("@theia/core/lib/common/preferences");
40
- exports.WorkspaceOpenHandlerContribution = Symbol('WorkspaceOpenHandlerContribution');
41
- exports.WorkspaceHandlingContribution = Symbol('WorkspaceHandlingContribution');
16
+ import { __decorate } from "tslib";
17
+ import { injectable, inject, postConstruct, named } from '@theia/core/shared/inversify';
18
+ import URI from '@theia/core/lib/common/uri';
19
+ import { Path } from '@theia/core/lib/common/path';
20
+ import { WorkspaceServer, UntitledWorkspaceService, WorkspaceFileService } from '../common/index.js';
21
+ import { WindowService } from '@theia/core/lib/browser/window/window-service';
22
+ import { DEFAULT_WINDOW_HASH } from '@theia/core/lib/common/window';
23
+ import { LabelProvider } from '@theia/core/lib/browser';
24
+ import { Deferred } from '@theia/core/lib/common/promise-util';
25
+ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
26
+ import { ILogger, Disposable, DisposableCollection, Emitter, environment, MessageService, nls, ContributionProvider } from '@theia/core';
27
+ import { WorkspacePreferences } from '../common/workspace-preferences.js';
28
+ import * as jsoncparser from 'jsonc-parser';
29
+ import Ajv from '@theia/core/shared/ajv';
30
+ import { FileStat } from '@theia/filesystem/lib/common/files';
31
+ import { FileService } from '@theia/filesystem/lib/browser/file-service';
32
+ import { WindowTitleService } from '@theia/core/lib/browser/window/window-title-service';
33
+ import { FileSystemPreferences } from '@theia/filesystem/lib/common';
34
+ import { workspaceSchema, WorkspaceSchemaUpdater } from './workspace-schema-updater.js';
35
+ import { StopReason } from '@theia/core/lib/common/frontend-application-state';
36
+ import { PreferenceSchemaService, PreferenceScope, PreferenceService } from '@theia/core/lib/common/preferences';
37
+ export const WorkspaceOpenHandlerContribution = Symbol('WorkspaceOpenHandlerContribution');
38
+ export const WorkspaceHandlingContribution = Symbol('WorkspaceHandlingContribution');
42
39
  /**
43
40
  * The workspace service.
44
41
  */
@@ -49,11 +46,11 @@ let WorkspaceService = class WorkspaceService {
49
46
  this.configuredRootNames = new Map();
50
47
  /** The names of the roots read by the last `computeRoots`, not yet published. */
51
48
  this.computedRootNames = new Map();
52
- this.deferredRoots = new promise_util_1.Deferred();
53
- this._ready = new promise_util_1.Deferred();
54
- this.onWorkspaceChangeEmitter = new core_1.Emitter();
55
- this.onWorkspaceLocationChangedEmitter = new core_1.Emitter();
56
- this.toDisposeOnWorkspace = new core_1.DisposableCollection();
49
+ this.deferredRoots = new Deferred();
50
+ this._ready = new Deferred();
51
+ this.onWorkspaceChangeEmitter = new Emitter();
52
+ this.onWorkspaceLocationChangedEmitter = new Emitter();
53
+ this.toDisposeOnWorkspace = new DisposableCollection();
57
54
  this.rootWatchers = new Map();
58
55
  }
59
56
  get ready() {
@@ -65,7 +62,7 @@ let WorkspaceService = class WorkspaceService {
65
62
  async doInit() {
66
63
  let wsUriString = await this.getDefaultWorkspaceUri();
67
64
  if (wsUriString) {
68
- const wsUri = new uri_1.default(wsUriString);
65
+ const wsUri = new URI(wsUriString);
69
66
  if (wsUri.scheme !== 'file') {
70
67
  let handled = false;
71
68
  for (const handler of this.openHandlerContribution.getContributions()) {
@@ -92,7 +89,7 @@ let WorkspaceService = class WorkspaceService {
92
89
  // No handler could open this non-file URI, or it failed/timed out.
93
90
  // Fall back to the most recent local workspace.
94
91
  const recents = await this.server.getRecentWorkspaces();
95
- wsUriString = recents.find(r => new uri_1.default(r).scheme === 'file');
92
+ wsUriString = recents.find(r => new URI(r).scheme === 'file');
96
93
  }
97
94
  }
98
95
  let wsStat = await this.toFileStat(wsUriString);
@@ -101,7 +98,7 @@ let WorkspaceService = class WorkspaceService {
101
98
  // to a path that doesn't exist locally. Fall back to the most recent
102
99
  // local workspace.
103
100
  const recents = await this.server.getRecentWorkspaces();
104
- const fallback = recents.find(r => new uri_1.default(r).scheme === 'file');
101
+ const fallback = recents.find(r => new URI(r).scheme === 'file');
105
102
  if (fallback) {
106
103
  wsStat = await this.toFileStat(fallback);
107
104
  }
@@ -135,7 +132,7 @@ let WorkspaceService = class WorkspaceService {
135
132
  async doGetDefaultWorkspaceUri() {
136
133
  // If an empty window is explicitly requested do not restore a previous workspace.
137
134
  // Note: `window.location.hash` includes leading "#" if non-empty.
138
- if (window.location.hash === `#${window_1.DEFAULT_WINDOW_HASH}`) {
135
+ if (window.location.hash === `#${DEFAULT_WINDOW_HASH}`) {
139
136
  window.location.hash = '';
140
137
  return undefined;
141
138
  }
@@ -149,10 +146,10 @@ let WorkspaceService = class WorkspaceService {
149
146
  const firstSlash = unc.indexOf('/');
150
147
  const authority = firstSlash >= 0 ? unc.slice(0, firstSlash) : unc;
151
148
  const path = firstSlash >= 0 ? unc.slice(firstSlash) : '/';
152
- workspaceUri = new uri_1.default().withPath(path).withAuthority(authority).withScheme('file');
149
+ workspaceUri = new URI().withPath(path).withAuthority(authority).withScheme('file');
153
150
  }
154
151
  else {
155
- workspaceUri = new uri_1.default().withPath(wpPath).withScheme('file');
152
+ workspaceUri = new URI().withPath(wpPath).withScheme('file');
156
153
  }
157
154
  let workspaceStat;
158
155
  try {
@@ -160,7 +157,7 @@ let WorkspaceService = class WorkspaceService {
160
157
  }
161
158
  catch { }
162
159
  if (workspaceStat && !workspaceStat.isDirectory && !this.isWorkspaceFile(workspaceStat)) {
163
- this.messageService.error(core_1.nls.localize('theia/workspace/notWorkspaceFile', 'Not a valid workspace file: {0}', this.labelProvider.getLongName(workspaceUri)));
160
+ this.messageService.error(nls.localize('theia/workspace/notWorkspaceFile', 'Not a valid workspace file: {0}', this.labelProvider.getLongName(workspaceUri)));
164
161
  return undefined;
165
162
  }
166
163
  return workspaceUri.toString();
@@ -249,7 +246,7 @@ let WorkspaceService = class WorkspaceService {
249
246
  this.configuredRootNames = newRootNames;
250
247
  this.rootNamesCache = undefined;
251
248
  this.deferredRoots.resolve(this._roots); // in order to resolve first
252
- this.deferredRoots = new promise_util_1.Deferred();
249
+ this.deferredRoots = new Deferred();
253
250
  this.deferredRoots.resolve(this._roots);
254
251
  this.onWorkspaceChangeEmitter.fire(this._roots);
255
252
  }
@@ -275,7 +272,7 @@ let WorkspaceService = class WorkspaceService {
275
272
  roots.push(valid);
276
273
  }
277
274
  else {
278
- roots.push(files_1.FileStat.dir(path));
275
+ roots.push(FileStat.dir(path));
279
276
  }
280
277
  // `getWorkspaceDataFromFile` already drops invalid names, but an override of it may not
281
278
  if (typeof name === 'string' && name) {
@@ -319,7 +316,7 @@ let WorkspaceService = class WorkspaceService {
319
316
  const fullName = this._workspace.resource.path.toString();
320
317
  if (this.isWorkspaceFile(this._workspace)) {
321
318
  if (this.isUntitledWorkspace(this._workspace.resource)) {
322
- const untitled = core_1.nls.localizeByDefault('Untitled (Workspace)');
319
+ const untitled = nls.localizeByDefault('Untitled (Workspace)');
323
320
  rootName = untitled;
324
321
  rootPath = untitled;
325
322
  }
@@ -348,12 +345,12 @@ let WorkspaceService = class WorkspaceService {
348
345
  * In Electron, we use `onWillStop` so the workspace is persisted before the window closes.
349
346
  */
350
347
  onStop() {
351
- if (!core_1.environment.electron.is()) {
348
+ if (!environment.electron.is()) {
352
349
  this.setMostRecentlyUsedWorkspace();
353
350
  }
354
351
  }
355
352
  onWillStop() {
356
- if (core_1.environment.electron.is() && this.workspace) {
353
+ if (environment.electron.is() && this.workspace) {
357
354
  return {
358
355
  reason: 'Set workspace root as most recently used',
359
356
  action: async () => {
@@ -428,7 +425,7 @@ let WorkspaceService = class WorkspaceService {
428
425
  const stat = await this.toFileStat(uri);
429
426
  if (stat) {
430
427
  if (!stat.isDirectory && !this.isWorkspaceFile(stat)) {
431
- const message = core_1.nls.localize('theia/workspace/notWorkspaceFile', 'Not a valid workspace file: {0}', this.labelProvider.getLongName(uri));
428
+ const message = nls.localize('theia/workspace/notWorkspaceFile', 'Not a valid workspace file: {0}', this.labelProvider.getLongName(uri));
432
429
  this.messageService.error(message);
433
430
  throw new Error(message);
434
431
  }
@@ -485,7 +482,7 @@ let WorkspaceService = class WorkspaceService {
485
482
  const toAdd = [];
486
483
  const namesToAdd = new Map();
487
484
  for (const root of rootsToAdd) {
488
- const { uri, name } = root instanceof uri_1.default ? { uri: root, name: undefined } : root;
485
+ const { uri, name } = root instanceof URI ? { uri: root, name: undefined } : root;
489
486
  const uriString = uri.toString();
490
487
  if (!dedup.has(uriString)) {
491
488
  dedup.add(uriString);
@@ -508,11 +505,11 @@ let WorkspaceService = class WorkspaceService {
508
505
  const newData = WorkspaceData.buildWorkspaceData(roots.map(path => ({ path, name: namesToAdd.get(path) })), currentData);
509
506
  await this.writeWorkspaceFile(this._workspace, newData);
510
507
  await this.updateWorkspace();
511
- return toRemove.map(root => new uri_1.default(root));
508
+ return toRemove.map(root => new URI(root));
512
509
  }
513
510
  async getUntitledWorkspace() {
514
- const configDirURI = new uri_1.default(await this.envVariableServer.getConfigDirUri());
515
- return this.untitledWorkspaceService.getUntitledWorkspaceUri(configDirURI, uri => this.fileService.exists(uri).then(exists => !exists), () => this.messageService.warn(core_1.nls.localize('theia/workspace/untitled-cleanup', 'There appear to be many untitled workspace files. Please check {0} and remove any unused files.', configDirURI.resolve('workspaces').path.fsPath())));
511
+ const configDirURI = new URI(await this.envVariableServer.getConfigDirUri());
512
+ return this.untitledWorkspaceService.getUntitledWorkspaceUri(configDirURI, uri => this.fileService.exists(uri).then(exists => !exists), () => this.messageService.warn(nls.localize('theia/workspace/untitled-cleanup', 'There appear to be many untitled workspace files. Please check {0} and remove any unused files.', configDirURI.resolve('workspaces').path.fsPath())));
516
513
  }
517
514
  async writeWorkspaceFile(workspaceFile, workspaceData) {
518
515
  if (workspaceFile) {
@@ -527,7 +524,7 @@ let WorkspaceService = class WorkspaceService {
527
524
  * Clears current workspace root.
528
525
  */
529
526
  async close() {
530
- if (await this.windowService.isSafeToShutDown(frontend_application_state_1.StopReason.Reload)) {
527
+ if (await this.windowService.isSafeToShutDown(StopReason.Reload)) {
531
528
  this.windowService.setSafeToShutDown();
532
529
  this._workspace = undefined;
533
530
  this._roots.length = 0;
@@ -556,7 +553,7 @@ let WorkspaceService = class WorkspaceService {
556
553
  return undefined;
557
554
  }
558
555
  try {
559
- const normalizedUri = new uri_1.default(WorkspaceData.normalizeFolderUri(uri.toString()));
556
+ const normalizedUri = new URI(WorkspaceData.normalizeFolderUri(uri.toString()));
560
557
  return await this.fileService.resolve(normalizedUri);
561
558
  }
562
559
  catch (error) {
@@ -624,16 +621,16 @@ let WorkspaceService = class WorkspaceService {
624
621
  * @param uri URI or FileStat of the workspace file
625
622
  */
626
623
  async save(uri) {
627
- const resource = uri instanceof uri_1.default ? uri : uri.resource;
624
+ const resource = uri instanceof URI ? uri : uri.resource;
628
625
  if (!await this.fileService.exists(resource)) {
629
626
  await this.fileService.create(resource);
630
627
  }
631
628
  const workspaceData = { folders: [], settings: {} };
632
629
  if (!this.saved) {
633
- for (const p of Object.keys(this.schemaService.getJSONSchema(preferences_1.PreferenceScope.Workspace).properties)) {
630
+ for (const p of Object.keys(this.schemaService.getJSONSchema(PreferenceScope.Workspace).properties)) {
634
631
  // The goal is to ensure that workspace-scoped preferences are preserved in the new workspace.
635
632
  // Preferences valid in folder scope will take effect in their folders without being copied.
636
- if (this.schemaService.isValidInScope(p, preferences_1.PreferenceScope.Folder)) {
633
+ if (this.schemaService.isValidInScope(p, PreferenceScope.Folder)) {
637
634
  continue;
638
635
  }
639
636
  const preferences = this.preferenceImpl.inspect(p);
@@ -679,11 +676,11 @@ let WorkspaceService = class WorkspaceService {
679
676
  return;
680
677
  }
681
678
  const excludes = this.getExcludes(uriStr);
682
- const watcher = this.fileService.watch(new uri_1.default(uriStr), {
679
+ const watcher = this.fileService.watch(new URI(uriStr), {
683
680
  recursive: true,
684
681
  excludes
685
682
  });
686
- this.rootWatchers.set(uriStr, new core_1.DisposableCollection(watcher, core_1.Disposable.create(() => this.rootWatchers.delete(uriStr))));
683
+ this.rootWatchers.set(uriStr, new DisposableCollection(watcher, Disposable.create(() => this.rootWatchers.delete(uriStr))));
687
684
  }
688
685
  getExcludes(uri) {
689
686
  const patterns = this.fsPreferences.get('files.watcherExclude', undefined, uri);
@@ -831,8 +828,8 @@ let WorkspaceService = class WorkspaceService {
831
828
  * @returns `undefined` if the path is absolute, does not start with a root name or leaves its root.
832
829
  */
833
830
  resolveRootPrefixedPath(rootPrefixedPath) {
834
- const path = new path_1.Path(path_1.Path.normalizePathSeparator(rootPrefixedPath)).normalize();
835
- if (path.isAbsolute || path_1.Path.isDrive(path.toString().split('/')[0])) {
831
+ const path = new Path(Path.normalizePathSeparator(rootPrefixedPath)).normalize();
832
+ if (path.isAbsolute || Path.isDrive(path.toString().split('/')[0])) {
836
833
  return undefined;
837
834
  }
838
835
  const segments = path.toString().split('/').filter(segment => segment.length > 0);
@@ -855,9 +852,9 @@ let WorkspaceService = class WorkspaceService {
855
852
  * or none if the path is absolute, leaves its root or does not contain the basename of a root.
856
853
  */
857
854
  resolveSupraRelativePath(supraRelativePath) {
858
- const path = new path_1.Path(path_1.Path.normalizePathSeparator(supraRelativePath)).normalize();
855
+ const path = new Path(Path.normalizePathSeparator(supraRelativePath)).normalize();
859
856
  const segments = path.toString().split('/').filter(segment => segment.length > 0);
860
- if (path.isAbsolute || path_1.Path.isDrive(segments[0] ?? '') || segments.includes('..')) {
857
+ if (path.isAbsolute || Path.isDrive(segments[0] ?? '') || segments.includes('..')) {
861
858
  return [];
862
859
  }
863
860
  const candidates = [];
@@ -987,7 +984,7 @@ let WorkspaceService = class WorkspaceService {
987
984
  return this.untitledWorkspaceService.isUntitledWorkspace(candidate);
988
985
  }
989
986
  async isSafeToReload(withURI) {
990
- return !withURI || !this.untitledWorkspaceService.isUntitledWorkspace(withURI) || new uri_1.default(await this.getDefaultWorkspaceUri()).isEqual(withURI);
987
+ return !withURI || !this.untitledWorkspaceService.isUntitledWorkspace(withURI) || new URI(await this.getDefaultWorkspaceUri()).isEqual(withURI);
991
988
  }
992
989
  /**
993
990
  *
@@ -998,92 +995,72 @@ let WorkspaceService = class WorkspaceService {
998
995
  return this.schemaUpdater.updateSchema({ key, schema });
999
996
  }
1000
997
  };
1001
- exports.WorkspaceService = WorkspaceService;
1002
- tslib_1.__decorate([
1003
- (0, inversify_1.inject)(file_service_1.FileService),
1004
- tslib_1.__metadata("design:type", file_service_1.FileService)
998
+ __decorate([
999
+ inject(FileService)
1005
1000
  ], WorkspaceService.prototype, "fileService", void 0);
1006
- tslib_1.__decorate([
1007
- (0, inversify_1.inject)(common_1.WorkspaceServer),
1008
- tslib_1.__metadata("design:type", Object)
1001
+ __decorate([
1002
+ inject(WorkspaceServer)
1009
1003
  ], WorkspaceService.prototype, "server", void 0);
1010
- tslib_1.__decorate([
1011
- (0, inversify_1.inject)(window_service_1.WindowService),
1012
- tslib_1.__metadata("design:type", Object)
1004
+ __decorate([
1005
+ inject(WindowService)
1013
1006
  ], WorkspaceService.prototype, "windowService", void 0);
1014
- tslib_1.__decorate([
1015
- (0, inversify_1.inject)(core_1.ILogger),
1016
- (0, inversify_1.named)('workspace:WorkspaceService'),
1017
- tslib_1.__metadata("design:type", Object)
1007
+ __decorate([
1008
+ inject(ILogger),
1009
+ named('workspace:WorkspaceService')
1018
1010
  ], WorkspaceService.prototype, "logger", void 0);
1019
- tslib_1.__decorate([
1020
- (0, inversify_1.inject)(workspace_preferences_1.WorkspacePreferences),
1021
- tslib_1.__metadata("design:type", Object)
1011
+ __decorate([
1012
+ inject(WorkspacePreferences)
1022
1013
  ], WorkspaceService.prototype, "preferences", void 0);
1023
- tslib_1.__decorate([
1024
- (0, inversify_1.inject)(preferences_1.PreferenceService),
1025
- tslib_1.__metadata("design:type", Object)
1014
+ __decorate([
1015
+ inject(PreferenceService)
1026
1016
  ], WorkspaceService.prototype, "preferenceImpl", void 0);
1027
- tslib_1.__decorate([
1028
- (0, inversify_1.inject)(preferences_1.PreferenceSchemaService),
1029
- tslib_1.__metadata("design:type", Object)
1017
+ __decorate([
1018
+ inject(PreferenceSchemaService)
1030
1019
  ], WorkspaceService.prototype, "schemaService", void 0);
1031
- tslib_1.__decorate([
1032
- (0, inversify_1.inject)(env_variables_1.EnvVariablesServer),
1033
- tslib_1.__metadata("design:type", Object)
1020
+ __decorate([
1021
+ inject(EnvVariablesServer)
1034
1022
  ], WorkspaceService.prototype, "envVariableServer", void 0);
1035
- tslib_1.__decorate([
1036
- (0, inversify_1.inject)(core_1.MessageService),
1037
- tslib_1.__metadata("design:type", core_1.MessageService)
1023
+ __decorate([
1024
+ inject(MessageService)
1038
1025
  ], WorkspaceService.prototype, "messageService", void 0);
1039
- tslib_1.__decorate([
1040
- (0, inversify_1.inject)(browser_1.LabelProvider),
1041
- tslib_1.__metadata("design:type", browser_1.LabelProvider)
1026
+ __decorate([
1027
+ inject(LabelProvider)
1042
1028
  ], WorkspaceService.prototype, "labelProvider", void 0);
1043
- tslib_1.__decorate([
1044
- (0, inversify_1.inject)(common_2.FileSystemPreferences),
1045
- tslib_1.__metadata("design:type", Object)
1029
+ __decorate([
1030
+ inject(FileSystemPreferences)
1046
1031
  ], WorkspaceService.prototype, "fsPreferences", void 0);
1047
- tslib_1.__decorate([
1048
- (0, inversify_1.inject)(workspace_schema_updater_1.WorkspaceSchemaUpdater),
1049
- tslib_1.__metadata("design:type", workspace_schema_updater_1.WorkspaceSchemaUpdater)
1032
+ __decorate([
1033
+ inject(WorkspaceSchemaUpdater)
1050
1034
  ], WorkspaceService.prototype, "schemaUpdater", void 0);
1051
- tslib_1.__decorate([
1052
- (0, inversify_1.inject)(common_1.UntitledWorkspaceService),
1053
- tslib_1.__metadata("design:type", common_1.UntitledWorkspaceService)
1035
+ __decorate([
1036
+ inject(UntitledWorkspaceService)
1054
1037
  ], WorkspaceService.prototype, "untitledWorkspaceService", void 0);
1055
- tslib_1.__decorate([
1056
- (0, inversify_1.inject)(common_1.WorkspaceFileService),
1057
- tslib_1.__metadata("design:type", common_1.WorkspaceFileService)
1038
+ __decorate([
1039
+ inject(WorkspaceFileService)
1058
1040
  ], WorkspaceService.prototype, "workspaceFileService", void 0);
1059
- tslib_1.__decorate([
1060
- (0, inversify_1.inject)(window_title_service_1.WindowTitleService),
1061
- tslib_1.__metadata("design:type", window_title_service_1.WindowTitleService)
1041
+ __decorate([
1042
+ inject(WindowTitleService)
1062
1043
  ], WorkspaceService.prototype, "windowTitleService", void 0);
1063
- tslib_1.__decorate([
1064
- (0, inversify_1.inject)(core_1.ContributionProvider),
1065
- (0, inversify_1.named)(exports.WorkspaceOpenHandlerContribution),
1066
- tslib_1.__metadata("design:type", Object)
1044
+ __decorate([
1045
+ inject(ContributionProvider),
1046
+ named(WorkspaceOpenHandlerContribution)
1067
1047
  ], WorkspaceService.prototype, "openHandlerContribution", void 0);
1068
- tslib_1.__decorate([
1069
- (0, inversify_1.inject)(core_1.ContributionProvider),
1070
- (0, inversify_1.named)(exports.WorkspaceHandlingContribution),
1071
- tslib_1.__metadata("design:type", Object)
1048
+ __decorate([
1049
+ inject(ContributionProvider),
1050
+ named(WorkspaceHandlingContribution)
1072
1051
  ], WorkspaceService.prototype, "workspaceHandlingContribution", void 0);
1073
- tslib_1.__decorate([
1074
- (0, inversify_1.postConstruct)(),
1075
- tslib_1.__metadata("design:type", Function),
1076
- tslib_1.__metadata("design:paramtypes", []),
1077
- tslib_1.__metadata("design:returntype", void 0)
1052
+ __decorate([
1053
+ postConstruct()
1078
1054
  ], WorkspaceService.prototype, "init", null);
1079
- exports.WorkspaceService = WorkspaceService = tslib_1.__decorate([
1080
- (0, inversify_1.injectable)()
1055
+ WorkspaceService = __decorate([
1056
+ injectable()
1081
1057
  ], WorkspaceService);
1082
- var WorkspaceData;
1058
+ export { WorkspaceService };
1059
+ export var WorkspaceData;
1083
1060
  (function (WorkspaceData) {
1084
1061
  // The `name` of a folder is not validated when loading, so that a workspace file with an invalid name still loads,
1085
1062
  // and the folder falls back to its folder name, as in VS Code. The editor still validates it against `workspaceSchema`.
1086
- const validateSchema = new ajv_1.default().compile(withoutFolderName(workspace_schema_updater_1.workspaceSchema));
1063
+ const validateSchema = new Ajv().compile(withoutFolderName(workspaceSchema));
1087
1064
  function withoutFolderName(schema) {
1088
1065
  const copy = structuredClone(schema);
1089
1066
  delete copy.properties?.folders.items?.properties?.name;
@@ -1100,7 +1077,7 @@ var WorkspaceData;
1100
1077
  * Normalizes the given folder URI the same way as the URIs of the workspace roots, so that they can be compared.
1101
1078
  */
1102
1079
  function normalizeFolderUri(folderUri) {
1103
- return new uri_1.default(folderUri.endsWith('/') ? folderUri.slice(0, -1) : folderUri).normalizePath().toString();
1080
+ return new URI(folderUri.endsWith('/') ? folderUri.slice(0, -1) : folderUri).normalizePath().toString();
1104
1081
  }
1105
1082
  WorkspaceData.normalizeFolderUri = normalizeFolderUri;
1106
1083
  /**
@@ -1116,9 +1093,9 @@ var WorkspaceData;
1116
1093
  }
1117
1094
  const roots = new Map();
1118
1095
  for (const folder of folders) {
1119
- const path = typeof folder === 'string' ? folder : files_1.FileStat.is(folder) ? folder.resource.toString() : folder.path;
1096
+ const path = typeof folder === 'string' ? folder : FileStat.is(folder) ? folder.resource.toString() : folder.path;
1120
1097
  if (!roots.has(path)) {
1121
- const name = typeof folder === 'string' || files_1.FileStat.is(folder) ? undefined : folder.name;
1098
+ const name = typeof folder === 'string' || FileStat.is(folder) ? undefined : folder.name;
1122
1099
  roots.set(path, isValidFolderName(name) ? name : currentNames.get(normalizeFolderUri(path)));
1123
1100
  }
1124
1101
  }
@@ -1134,9 +1111,9 @@ var WorkspaceData;
1134
1111
  WorkspaceData.buildWorkspaceData = buildWorkspaceData;
1135
1112
  function transformToRelative(data, workspaceFile) {
1136
1113
  const folders = [];
1137
- const workspaceFileUri = new uri_1.default(workspaceFile ? workspaceFile.resource.toString() : '').withScheme('file');
1114
+ const workspaceFileUri = new URI(workspaceFile ? workspaceFile.resource.toString() : '').withScheme('file');
1138
1115
  for (const { path, name } of data.folders) {
1139
- const folderUri = new uri_1.default(path).withScheme('file');
1116
+ const folderUri = new URI(path).withScheme('file');
1140
1117
  const rel = workspaceFileUri.parent.relative(folderUri);
1141
1118
  folders.push({ path: rel ? rel.toString() : folderUri.toString(), name });
1142
1119
  }
@@ -1162,5 +1139,5 @@ var WorkspaceData;
1162
1139
  return data;
1163
1140
  }
1164
1141
  WorkspaceData.transformToAbsolute = transformToAbsolute;
1165
- })(WorkspaceData || (exports.WorkspaceData = WorkspaceData = {}));
1142
+ })(WorkspaceData || (WorkspaceData = {}));
1166
1143
  //# sourceMappingURL=workspace-service.js.map