@codingame/monaco-vscode-configuration-service-override 11.1.2 → 12.0.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 (31) hide show
  1. package/index.d.ts +29 -2
  2. package/index.js +138 -1
  3. package/package.json +27 -8
  4. package/vscode/src/vs/editor/common/services/textResourceConfigurationService.d.ts +26 -0
  5. package/vscode/src/vs/editor/common/services/textResourceConfigurationService.js +13 -11
  6. package/vscode/src/vs/workbench/api/common/configurationExtensionPoint.d.ts +1 -0
  7. package/vscode/src/vs/workbench/api/common/configurationExtensionPoint.js +82 -79
  8. package/vscode/src/vs/workbench/contrib/workspaces/browser/workspaces.contribution.d.ts +19 -0
  9. package/vscode/src/vs/workbench/contrib/workspaces/browser/workspaces.contribution.js +31 -32
  10. package/vscode/src/vs/workbench/services/configuration/browser/configuration.d.ts +130 -0
  11. package/vscode/src/vs/workbench/services/configuration/browser/configuration.js +18 -16
  12. package/vscode/src/vs/workbench/services/configuration/browser/configurationService.d.ts +144 -0
  13. package/vscode/src/vs/workbench/services/configuration/browser/configurationService.js +182 -186
  14. package/vscode/src/vs/workbench/services/configuration/common/configurationCache.d.ts +16 -0
  15. package/vscode/src/vs/workbench/services/configuration/common/configurationCache.js +3 -1
  16. package/vscode/src/vs/workbench/services/configuration/common/configurationEditing.d.ts +86 -0
  17. package/vscode/src/vs/workbench/services/configuration/common/configurationEditing.js +219 -194
  18. package/vscode/src/vs/workbench/services/configuration/common/configurationModels.d.ts +43 -0
  19. package/vscode/src/vs/workbench/services/configuration/common/configurationModels.js +1 -0
  20. package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.d.ts +37 -0
  21. package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +30 -26
  22. package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.d.ts +13 -0
  23. package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +3 -1
  24. package/vscode/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.d.ts +16 -0
  25. package/vscode/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.js +8 -5
  26. package/vscode/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.d.ts +64 -0
  27. package/vscode/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.js +54 -53
  28. package/vscode/src/vs/workbench/services/workspaces/browser/workspacesService.d.ts +39 -0
  29. package/vscode/src/vs/workbench/services/workspaces/browser/workspacesService.js +15 -11
  30. package/configuration.js +0 -138
  31. package/tools.js +0 -44
@@ -1,16 +1,19 @@
1
- import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
1
+
2
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
2
3
  import { localize } from 'vscode/vscode/vs/nls';
3
4
  import { parse } from 'vscode/vscode/vs/base/common/json';
4
- import { setProperty } from 'vscode/vscode/vs/base/common/jsonEdit';
5
+ import { setProperty } from '@codingame/monaco-vscode-56402b83-4a60-5b15-86f9-71fe99c32744-common/vscode/vs/base/common/jsonEdit';
5
6
  import { Queue } from 'vscode/vscode/vs/base/common/async';
6
7
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
8
+ import { WorkbenchState } from 'vscode/vscode/vs/platform/workspace/common/workspace';
7
9
  import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
8
10
  import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles.service';
9
- import { TASKS_CONFIGURATION_KEY, LAUNCH_CONFIGURATION_KEY, TASKS_DEFAULT, FOLDER_SCOPES, USER_STANDALONE_CONFIGURATIONS, WORKSPACE_STANDALONE_CONFIGURATIONS, FOLDER_SETTINGS_PATH } from 'vscode/vscode/vs/workbench/services/configuration/common/configuration';
10
- import { IWorkbenchConfigurationService } from 'vscode/vscode/vs/workbench/services/configuration/common/configuration.service';
11
+ import { TASKS_CONFIGURATION_KEY, LAUNCH_CONFIGURATION_KEY, TASKS_DEFAULT, FOLDER_SCOPES, USER_STANDALONE_CONFIGURATIONS, WORKSPACE_STANDALONE_CONFIGURATIONS, FOLDER_SETTINGS_PATH } from '@codingame/monaco-vscode-37e80bf5-92f5-5e4c-8b6d-98e0bb89dbef-common/vscode/vs/workbench/services/configuration/common/configuration';
12
+ import { IWorkbenchConfigurationService } from '@codingame/monaco-vscode-422642f2-7e3a-5c1c-9e1e-1d3ef1817346-common/vscode/vs/workbench/services/configuration/common/configuration.service';
13
+ import { FileOperationResult } from 'vscode/vscode/vs/platform/files/common/files';
11
14
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
12
15
  import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
13
- import { Extensions, OVERRIDE_PROPERTY_REGEX, keyFromOverrideIdentifiers } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
16
+ import { Extensions, OVERRIDE_PROPERTY_REGEX, ConfigurationScope, keyFromOverrideIdentifiers } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
14
17
  import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
15
18
  import 'vscode/vscode/vs/platform/notification/common/notification';
16
19
  import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
@@ -22,14 +25,38 @@ import { Selection } from 'vscode/vscode/vs/editor/common/core/selection';
22
25
  import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
23
26
  import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
24
27
  import { ErrorNoTelemetry } from 'vscode/vscode/vs/base/common/errors';
25
- import Severity$1 from 'vscode/vscode/vs/base/common/severity';
28
+ import Severity from 'vscode/vscode/vs/base/common/severity';
26
29
 
30
+ var ConfigurationEditingErrorCode;
31
+ (function (ConfigurationEditingErrorCode) {
32
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_UNKNOWN_KEY"] = 0] = "ERROR_UNKNOWN_KEY";
33
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION"] = 1] = "ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION";
34
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE"] = 2] = "ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE";
35
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_FOLDER_CONFIGURATION"] = 3] = "ERROR_INVALID_FOLDER_CONFIGURATION";
36
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_USER_TARGET"] = 4] = "ERROR_INVALID_USER_TARGET";
37
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_WORKSPACE_TARGET"] = 5] = "ERROR_INVALID_WORKSPACE_TARGET";
38
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_FOLDER_TARGET"] = 6] = "ERROR_INVALID_FOLDER_TARGET";
39
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION"] = 7] = "ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION";
40
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_NO_WORKSPACE_OPENED"] = 8] = "ERROR_NO_WORKSPACE_OPENED";
41
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_CONFIGURATION_FILE_DIRTY"] = 9] = "ERROR_CONFIGURATION_FILE_DIRTY";
42
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_CONFIGURATION_FILE_MODIFIED_SINCE"] = 10] = "ERROR_CONFIGURATION_FILE_MODIFIED_SINCE";
43
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_CONFIGURATION"] = 11] = "ERROR_INVALID_CONFIGURATION";
44
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_POLICY_CONFIGURATION"] = 12] = "ERROR_POLICY_CONFIGURATION";
45
+ ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INTERNAL"] = 13] = "ERROR_INTERNAL";
46
+ })(ConfigurationEditingErrorCode || (ConfigurationEditingErrorCode = {}));
27
47
  class ConfigurationEditingError extends ErrorNoTelemetry {
28
48
  constructor(message, code) {
29
49
  super(message);
30
50
  this.code = code;
31
51
  }
32
52
  }
53
+ var EditableConfigurationTarget;
54
+ (function (EditableConfigurationTarget) {
55
+ EditableConfigurationTarget[EditableConfigurationTarget["USER_LOCAL"] = 1] = "USER_LOCAL";
56
+ EditableConfigurationTarget[EditableConfigurationTarget["USER_REMOTE"] = 2] = "USER_REMOTE";
57
+ EditableConfigurationTarget[EditableConfigurationTarget["WORKSPACE"] = 3] = "WORKSPACE";
58
+ EditableConfigurationTarget[EditableConfigurationTarget["WORKSPACE_FOLDER"] = 4] = "WORKSPACE_FOLDER";
59
+ })(EditableConfigurationTarget || (EditableConfigurationTarget = {}));
33
60
  let ConfigurationEditing = class ConfigurationEditing {
34
61
  constructor(remoteSettingsResource, configurationService, contextService, userDataProfileService, userDataProfilesService, fileService, textModelResolverService, textFileService, notificationService, preferencesService, editorService, uriIdentityService) {
35
62
  this.remoteSettingsResource = remoteSettingsResource;
@@ -44,7 +71,7 @@ let ConfigurationEditing = class ConfigurationEditing {
44
71
  this.preferencesService = preferencesService;
45
72
  this.editorService = editorService;
46
73
  this.uriIdentityService = uriIdentityService;
47
- this.queue = ( (new Queue()));
74
+ this.queue = ( new Queue());
48
75
  }
49
76
  async writeConfiguration(target, value, options = {}) {
50
77
  const operation = this.getConfigurationEditOperation(target, value, options.scopes || {});
@@ -74,7 +101,7 @@ let ConfigurationEditing = class ConfigurationEditing {
74
101
  }
75
102
  async updateConfiguration(operation, model, formattingOptions, options) {
76
103
  if (this.hasParseErrors(model.getValue(), operation)) {
77
- throw this.toConfigurationEditingError(11 , operation.target, operation);
104
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_INVALID_CONFIGURATION, operation.target, operation);
78
105
  }
79
106
  if (this.textFileService.isDirty(model.uri) && options.handleDirtyFile) {
80
107
  switch (options.handleDirtyFile) {
@@ -96,35 +123,35 @@ let ConfigurationEditing = class ConfigurationEditing {
96
123
  await this.textFileService.save(model.uri, { ignoreErrorHandler: true });
97
124
  }
98
125
  catch (error) {
99
- if (error.fileOperationResult === 3 ) {
100
- throw this.toConfigurationEditingError(10 , operation.target, operation);
126
+ if (error.fileOperationResult === FileOperationResult.FILE_MODIFIED_SINCE) {
127
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_CONFIGURATION_FILE_MODIFIED_SINCE, operation.target, operation);
101
128
  }
102
- throw ( (new ConfigurationEditingError(localize(
103
- 8951,
129
+ throw ( new ConfigurationEditingError(( localize(
130
+ 11266,
104
131
  "Error while writing to {0}. {1}",
105
132
  this.stringifyTarget(operation.target),
106
133
  error.message
107
- ), 13 )));
134
+ )), ConfigurationEditingErrorCode.ERROR_INTERNAL));
108
135
  }
109
136
  }
110
137
  applyEditsToBuffer(edit, model) {
111
138
  const startPosition = model.getPositionAt(edit.offset);
112
139
  const endPosition = model.getPositionAt(edit.offset + edit.length);
113
- const range = ( (new Range(
140
+ const range = ( new Range(
114
141
  startPosition.lineNumber,
115
142
  startPosition.column,
116
143
  endPosition.lineNumber,
117
144
  endPosition.column
118
- )));
145
+ ));
119
146
  const currentText = model.getValueInRange(range);
120
147
  if (edit.content !== currentText) {
121
148
  const editOperation = currentText ? EditOperation.replace(range, edit.content) : EditOperation.insert(startPosition, edit.content);
122
- model.pushEditOperations([( (new Selection(
149
+ model.pushEditOperations([( new Selection(
123
150
  startPosition.lineNumber,
124
151
  startPosition.column,
125
152
  startPosition.lineNumber,
126
153
  startPosition.column
127
- )))], [editOperation], () => []);
154
+ ))], [editOperation], () => []);
128
155
  return true;
129
156
  }
130
157
  return false;
@@ -147,42 +174,42 @@ let ConfigurationEditing = class ConfigurationEditing {
147
174
  }
148
175
  async onError(error, operation, scopes) {
149
176
  switch (error.code) {
150
- case 11 :
177
+ case ConfigurationEditingErrorCode.ERROR_INVALID_CONFIGURATION:
151
178
  this.onInvalidConfigurationError(error, operation);
152
179
  break;
153
- case 9 :
180
+ case ConfigurationEditingErrorCode.ERROR_CONFIGURATION_FILE_DIRTY:
154
181
  this.onConfigurationFileDirtyError(error, operation, scopes);
155
182
  break;
156
- case 10 :
183
+ case ConfigurationEditingErrorCode.ERROR_CONFIGURATION_FILE_MODIFIED_SINCE:
157
184
  return this.doWriteConfiguration(operation, { scopes, handleDirtyFile: 'revert' });
158
185
  default:
159
186
  this.notificationService.error(error.message);
160
187
  }
161
188
  }
162
189
  onInvalidConfigurationError(error, operation) {
163
- const openStandAloneConfigurationActionLabel = operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY ? ( localize(8952, "Open Tasks Configuration"))
164
- : operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY ? ( localize(8953, "Open Launch Configuration"))
190
+ const openStandAloneConfigurationActionLabel = operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY ? ( localize(11267, "Open Tasks Configuration"))
191
+ : operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY ? ( localize(11268, "Open Launch Configuration"))
165
192
  : null;
166
193
  if (openStandAloneConfigurationActionLabel) {
167
- this.notificationService.prompt(Severity$1.Error, error.message, [{
194
+ this.notificationService.prompt(Severity.Error, error.message, [{
168
195
  label: openStandAloneConfigurationActionLabel,
169
196
  run: () => this.openFile(operation.resource)
170
197
  }]);
171
198
  }
172
199
  else {
173
- this.notificationService.prompt(Severity$1.Error, error.message, [{
174
- label: ( localize(8954, "Open Settings")),
200
+ this.notificationService.prompt(Severity.Error, error.message, [{
201
+ label: ( localize(11269, "Open Settings")),
175
202
  run: () => this.openSettings(operation)
176
203
  }]);
177
204
  }
178
205
  }
179
206
  onConfigurationFileDirtyError(error, operation, scopes) {
180
- const openStandAloneConfigurationActionLabel = operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY ? ( localize(8952, "Open Tasks Configuration"))
181
- : operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY ? ( localize(8953, "Open Launch Configuration"))
207
+ const openStandAloneConfigurationActionLabel = operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY ? ( localize(11267, "Open Tasks Configuration"))
208
+ : operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY ? ( localize(11268, "Open Launch Configuration"))
182
209
  : null;
183
210
  if (openStandAloneConfigurationActionLabel) {
184
- this.notificationService.prompt(Severity$1.Error, error.message, [{
185
- label: ( localize(8955, "Save and Retry")),
211
+ this.notificationService.prompt(Severity.Error, error.message, [{
212
+ label: ( localize(11270, "Save and Retry")),
186
213
  run: () => {
187
214
  const key = operation.key ? `${operation.workspaceStandAloneConfigurationKey}.${operation.key}` : operation.workspaceStandAloneConfigurationKey;
188
215
  this.writeConfiguration(operation.target, { key, value: operation.value }, { handleDirtyFile: 'save', scopes });
@@ -194,12 +221,12 @@ let ConfigurationEditing = class ConfigurationEditing {
194
221
  }]);
195
222
  }
196
223
  else {
197
- this.notificationService.prompt(Severity$1.Error, error.message, [{
198
- label: ( localize(8955, "Save and Retry")),
224
+ this.notificationService.prompt(Severity.Error, error.message, [{
225
+ label: ( localize(11270, "Save and Retry")),
199
226
  run: () => this.writeConfiguration(operation.target, { key: operation.key, value: operation.value }, { handleDirtyFile: 'save', scopes })
200
227
  },
201
228
  {
202
- label: ( localize(8954, "Open Settings")),
229
+ label: ( localize(11269, "Open Settings")),
203
230
  run: () => this.openSettings(operation)
204
231
  }]);
205
232
  }
@@ -207,16 +234,16 @@ let ConfigurationEditing = class ConfigurationEditing {
207
234
  openSettings(operation) {
208
235
  const options = { jsonEditor: true };
209
236
  switch (operation.target) {
210
- case 1 :
237
+ case EditableConfigurationTarget.USER_LOCAL:
211
238
  this.preferencesService.openUserSettings(options);
212
239
  break;
213
- case 2 :
240
+ case EditableConfigurationTarget.USER_REMOTE:
214
241
  this.preferencesService.openRemoteSettings(options);
215
242
  break;
216
- case 3 :
243
+ case EditableConfigurationTarget.WORKSPACE:
217
244
  this.preferencesService.openWorkspaceSettings(options);
218
245
  break;
219
- case 4 :
246
+ case EditableConfigurationTarget.WORKSPACE_FOLDER:
220
247
  if (operation.resource) {
221
248
  const workspaceFolder = this.contextService.getWorkspaceFolder(operation.resource);
222
249
  if (workspaceFolder) {
@@ -231,92 +258,90 @@ let ConfigurationEditing = class ConfigurationEditing {
231
258
  }
232
259
  toConfigurationEditingError(code, target, operation) {
233
260
  const message = this.toErrorMessage(code, target, operation);
234
- return (
235
- (new ConfigurationEditingError(message, code))
236
- );
261
+ return ( new ConfigurationEditingError(message, code));
237
262
  }
238
263
  toErrorMessage(error, target, operation) {
239
264
  switch (error) {
240
- case 12 : return ( localize(
241
- 8956,
265
+ case ConfigurationEditingErrorCode.ERROR_POLICY_CONFIGURATION: return localize(
266
+ 11271,
242
267
  "Unable to write {0} because it is configured in system policy.",
243
268
  operation.key
244
- ));
245
- case 0 : return ( localize(
246
- 8957,
269
+ );
270
+ case ConfigurationEditingErrorCode.ERROR_UNKNOWN_KEY: return localize(
271
+ 11272,
247
272
  "Unable to write to {0} because {1} is not a registered configuration.",
248
273
  this.stringifyTarget(target),
249
274
  operation.key
250
- ));
251
- case 1 : return ( localize(
252
- 8958,
275
+ );
276
+ case ConfigurationEditingErrorCode.ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION: return localize(
277
+ 11273,
253
278
  "Unable to write {0} to Workspace Settings. This setting can be written only into User settings.",
254
279
  operation.key
255
- ));
256
- case 2 : return ( localize(
257
- 8959,
280
+ );
281
+ case ConfigurationEditingErrorCode.ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE: return localize(
282
+ 11274,
258
283
  "Unable to write {0} to Workspace Settings. This setting can be written only into User settings.",
259
284
  operation.key
260
- ));
261
- case 3 : return ( localize(
262
- 8960,
285
+ );
286
+ case ConfigurationEditingErrorCode.ERROR_INVALID_FOLDER_CONFIGURATION: return localize(
287
+ 11275,
263
288
  "Unable to write to Folder Settings because {0} does not support the folder resource scope.",
264
289
  operation.key
265
- ));
266
- case 4 : return ( localize(
267
- 8961,
290
+ );
291
+ case ConfigurationEditingErrorCode.ERROR_INVALID_USER_TARGET: return localize(
292
+ 11276,
268
293
  "Unable to write to User Settings because {0} does not support for global scope.",
269
294
  operation.key
270
- ));
271
- case 5 : return ( localize(
272
- 8962,
295
+ );
296
+ case ConfigurationEditingErrorCode.ERROR_INVALID_WORKSPACE_TARGET: return localize(
297
+ 11277,
273
298
  "Unable to write to Workspace Settings because {0} does not support for workspace scope in a multi folder workspace.",
274
299
  operation.key
275
- ));
276
- case 6 : return ( localize(
277
- 8963,
300
+ );
301
+ case ConfigurationEditingErrorCode.ERROR_INVALID_FOLDER_TARGET: return localize(
302
+ 11278,
278
303
  "Unable to write to Folder Settings because no resource is provided."
279
- ));
280
- case 7 : return ( localize(
281
- 8964,
304
+ );
305
+ case ConfigurationEditingErrorCode.ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION: return localize(
306
+ 11279,
282
307
  "Unable to write to Language Settings because {0} is not a resource language setting.",
283
308
  operation.key
284
- ));
285
- case 8 : return ( localize(
286
- 8965,
309
+ );
310
+ case ConfigurationEditingErrorCode.ERROR_NO_WORKSPACE_OPENED: return localize(
311
+ 11280,
287
312
  "Unable to write to {0} because no workspace is opened. Please open a workspace first and try again.",
288
313
  this.stringifyTarget(target)
289
- ));
290
- case 11 : {
314
+ );
315
+ case ConfigurationEditingErrorCode.ERROR_INVALID_CONFIGURATION: {
291
316
  if (operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY) {
292
- return ( localize(
293
- 8966,
317
+ return localize(
318
+ 11281,
294
319
  "Unable to write into the tasks configuration file. Please open it to correct errors/warnings in it and try again."
295
- ));
320
+ );
296
321
  }
297
322
  if (operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY) {
298
- return ( localize(
299
- 8967,
323
+ return localize(
324
+ 11282,
300
325
  "Unable to write into the launch configuration file. Please open it to correct errors/warnings in it and try again."
301
- ));
326
+ );
302
327
  }
303
328
  switch (target) {
304
- case 1 :
305
- return ( localize(
306
- 8968,
329
+ case EditableConfigurationTarget.USER_LOCAL:
330
+ return localize(
331
+ 11283,
307
332
  "Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again."
308
- ));
309
- case 2 :
310
- return ( localize(
311
- 8969,
333
+ );
334
+ case EditableConfigurationTarget.USER_REMOTE:
335
+ return localize(
336
+ 11284,
312
337
  "Unable to write into remote user settings. Please open the remote user settings to correct errors/warnings in it and try again."
313
- ));
314
- case 3 :
315
- return ( localize(
316
- 8970,
338
+ );
339
+ case EditableConfigurationTarget.WORKSPACE:
340
+ return localize(
341
+ 11285,
317
342
  "Unable to write into workspace settings. Please open the workspace settings to correct errors/warnings in the file and try again."
318
- ));
319
- case 4 : {
343
+ );
344
+ case EditableConfigurationTarget.WORKSPACE_FOLDER: {
320
345
  let workspaceFolderName = '<<unknown>>';
321
346
  if (operation.resource) {
322
347
  const folder = this.contextService.getWorkspaceFolder(operation.resource);
@@ -324,46 +349,46 @@ let ConfigurationEditing = class ConfigurationEditing {
324
349
  workspaceFolderName = folder.name;
325
350
  }
326
351
  }
327
- return ( localize(
328
- 8971,
352
+ return localize(
353
+ 11286,
329
354
  "Unable to write into folder settings. Please open the '{0}' folder settings to correct errors/warnings in it and try again.",
330
355
  workspaceFolderName
331
- ));
356
+ );
332
357
  }
333
358
  default:
334
359
  return '';
335
360
  }
336
361
  }
337
- case 9 : {
362
+ case ConfigurationEditingErrorCode.ERROR_CONFIGURATION_FILE_DIRTY: {
338
363
  if (operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY) {
339
- return ( localize(
340
- 8972,
364
+ return localize(
365
+ 11287,
341
366
  "Unable to write into tasks configuration file because the file has unsaved changes. Please save it first and then try again."
342
- ));
367
+ );
343
368
  }
344
369
  if (operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY) {
345
- return ( localize(
346
- 8973,
370
+ return localize(
371
+ 11288,
347
372
  "Unable to write into launch configuration file because the file has unsaved changes. Please save it first and then try again."
348
- ));
373
+ );
349
374
  }
350
375
  switch (target) {
351
- case 1 :
352
- return ( localize(
353
- 8974,
376
+ case EditableConfigurationTarget.USER_LOCAL:
377
+ return localize(
378
+ 11289,
354
379
  "Unable to write into user settings because the file has unsaved changes. Please save the user settings file first and then try again."
355
- ));
356
- case 2 :
357
- return ( localize(
358
- 8975,
380
+ );
381
+ case EditableConfigurationTarget.USER_REMOTE:
382
+ return localize(
383
+ 11290,
359
384
  "Unable to write into remote user settings because the file has unsaved changes. Please save the remote user settings file first and then try again."
360
- ));
361
- case 3 :
362
- return ( localize(
363
- 8976,
385
+ );
386
+ case EditableConfigurationTarget.WORKSPACE:
387
+ return localize(
388
+ 11291,
364
389
  "Unable to write into workspace settings because the file has unsaved changes. Please save the workspace settings file first and then try again."
365
- ));
366
- case 4 : {
390
+ );
391
+ case EditableConfigurationTarget.WORKSPACE_FOLDER: {
367
392
  let workspaceFolderName = '<<unknown>>';
368
393
  if (operation.resource) {
369
394
  const folder = this.contextService.getWorkspaceFolder(operation.resource);
@@ -371,68 +396,68 @@ let ConfigurationEditing = class ConfigurationEditing {
371
396
  workspaceFolderName = folder.name;
372
397
  }
373
398
  }
374
- return ( localize(
375
- 8977,
399
+ return localize(
400
+ 11292,
376
401
  "Unable to write into folder settings because the file has unsaved changes. Please save the '{0}' folder settings file first and then try again.",
377
402
  workspaceFolderName
378
- ));
403
+ );
379
404
  }
380
405
  default:
381
406
  return '';
382
407
  }
383
408
  }
384
- case 10 :
409
+ case ConfigurationEditingErrorCode.ERROR_CONFIGURATION_FILE_MODIFIED_SINCE:
385
410
  if (operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY) {
386
- return ( localize(
387
- 8978,
411
+ return localize(
412
+ 11293,
388
413
  "Unable to write into tasks configuration file because the content of the file is newer."
389
- ));
414
+ );
390
415
  }
391
416
  if (operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY) {
392
- return ( localize(
393
- 8979,
417
+ return localize(
418
+ 11294,
394
419
  "Unable to write into launch configuration file because the content of the file is newer."
395
- ));
420
+ );
396
421
  }
397
422
  switch (target) {
398
- case 1 :
399
- return ( localize(
400
- 8980,
423
+ case EditableConfigurationTarget.USER_LOCAL:
424
+ return localize(
425
+ 11295,
401
426
  "Unable to write into user settings because the content of the file is newer."
402
- ));
403
- case 2 :
404
- return ( localize(
405
- 8981,
427
+ );
428
+ case EditableConfigurationTarget.USER_REMOTE:
429
+ return localize(
430
+ 11296,
406
431
  "Unable to write into remote user settings because the content of the file is newer."
407
- ));
408
- case 3 :
409
- return ( localize(
410
- 8982,
432
+ );
433
+ case EditableConfigurationTarget.WORKSPACE:
434
+ return localize(
435
+ 11297,
411
436
  "Unable to write into workspace settings because the content of the file is newer."
412
- ));
413
- case 4 :
414
- return ( localize(
415
- 8983,
437
+ );
438
+ case EditableConfigurationTarget.WORKSPACE_FOLDER:
439
+ return localize(
440
+ 11298,
416
441
  "Unable to write into folder settings because the content of the file is newer."
417
- ));
442
+ );
418
443
  }
419
- case 13 : return ( localize(
420
- 8984,
444
+ case ConfigurationEditingErrorCode.ERROR_INTERNAL: return localize(
445
+ 11299,
421
446
  "Unable to write to {0} because of an internal error.",
422
447
  this.stringifyTarget(target)
423
- ));
448
+ );
424
449
  }
425
450
  }
426
451
  stringifyTarget(target) {
427
452
  switch (target) {
428
- case 1 :
429
- return ( localize(8985, "User Settings"));
430
- case 2 :
431
- return ( localize(8986, "Remote User Settings"));
432
- case 3 :
433
- return ( localize(8987, "Workspace Settings"));
434
- case 4 :
435
- return ( localize(8988, "Folder Settings"));
453
+ case EditableConfigurationTarget.USER_LOCAL:
454
+ return localize(11300, "User Settings");
455
+ case EditableConfigurationTarget.USER_REMOTE:
456
+ return localize(11301, "Remote User Settings");
457
+ case EditableConfigurationTarget.WORKSPACE:
458
+ return localize(11302, "Workspace Settings");
459
+ case EditableConfigurationTarget.WORKSPACE_FOLDER:
460
+ return localize(11303, "Folder Settings");
436
461
  default:
437
462
  return '';
438
463
  }
@@ -462,60 +487,60 @@ let ConfigurationEditing = class ConfigurationEditing {
462
487
  }
463
488
  async validate(target, operation, checkDirty, overrides) {
464
489
  if (this.configurationService.inspect(operation.key).policyValue !== undefined) {
465
- throw this.toConfigurationEditingError(12 , target, operation);
490
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_POLICY_CONFIGURATION, target, operation);
466
491
  }
467
- const configurationProperties = ( (Registry.as(Extensions.Configuration))).getConfigurationProperties();
492
+ const configurationProperties = ( Registry.as(Extensions.Configuration)).getConfigurationProperties();
468
493
  const configurationScope = configurationProperties[operation.key]?.scope;
469
494
  if (!operation.workspaceStandAloneConfigurationKey) {
470
- const validKeys = ( (this.configurationService.keys())).default;
495
+ const validKeys = ( this.configurationService.keys()).default;
471
496
  if (validKeys.indexOf(operation.key) < 0 && !OVERRIDE_PROPERTY_REGEX.test(operation.key) && operation.value !== undefined) {
472
- throw this.toConfigurationEditingError(0 , target, operation);
497
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_UNKNOWN_KEY, target, operation);
473
498
  }
474
499
  }
475
500
  if (operation.workspaceStandAloneConfigurationKey) {
476
- if ((operation.workspaceStandAloneConfigurationKey !== TASKS_CONFIGURATION_KEY) && ((target === 1 || target === 2) )) {
477
- throw this.toConfigurationEditingError(4 , target, operation);
501
+ if ((operation.workspaceStandAloneConfigurationKey !== TASKS_CONFIGURATION_KEY) && (target === EditableConfigurationTarget.USER_LOCAL || target === EditableConfigurationTarget.USER_REMOTE)) {
502
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_INVALID_USER_TARGET, target, operation);
478
503
  }
479
504
  }
480
- if (((target === 3 || target === 4) ) && this.contextService.getWorkbenchState() === 1 ) {
481
- throw this.toConfigurationEditingError(8 , target, operation);
505
+ if ((target === EditableConfigurationTarget.WORKSPACE || target === EditableConfigurationTarget.WORKSPACE_FOLDER) && this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) {
506
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_NO_WORKSPACE_OPENED, target, operation);
482
507
  }
483
- if (target === 3 ) {
508
+ if (target === EditableConfigurationTarget.WORKSPACE) {
484
509
  if (!operation.workspaceStandAloneConfigurationKey && !OVERRIDE_PROPERTY_REGEX.test(operation.key)) {
485
- if (configurationScope === 1 ) {
486
- throw this.toConfigurationEditingError(1 , target, operation);
510
+ if (configurationScope === ConfigurationScope.APPLICATION) {
511
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION, target, operation);
487
512
  }
488
- if (configurationScope === 2 ) {
489
- throw this.toConfigurationEditingError(2 , target, operation);
513
+ if (configurationScope === ConfigurationScope.MACHINE) {
514
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE, target, operation);
490
515
  }
491
516
  }
492
517
  }
493
- if (target === 4 ) {
518
+ if (target === EditableConfigurationTarget.WORKSPACE_FOLDER) {
494
519
  if (!operation.resource) {
495
- throw this.toConfigurationEditingError(6 , target, operation);
520
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_INVALID_FOLDER_TARGET, target, operation);
496
521
  }
497
522
  if (!operation.workspaceStandAloneConfigurationKey && !OVERRIDE_PROPERTY_REGEX.test(operation.key)) {
498
523
  if (configurationScope !== undefined && !FOLDER_SCOPES.includes(configurationScope)) {
499
- throw this.toConfigurationEditingError(3 , target, operation);
524
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_INVALID_FOLDER_CONFIGURATION, target, operation);
500
525
  }
501
526
  }
502
527
  }
503
528
  if (overrides.overrideIdentifiers?.length) {
504
- if (configurationScope !== 5 ) {
505
- throw this.toConfigurationEditingError(7 , target, operation);
529
+ if (configurationScope !== ConfigurationScope.LANGUAGE_OVERRIDABLE) {
530
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION, target, operation);
506
531
  }
507
532
  }
508
533
  if (!operation.resource) {
509
- throw this.toConfigurationEditingError(6 , target, operation);
534
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_INVALID_FOLDER_TARGET, target, operation);
510
535
  }
511
536
  if (checkDirty && this.textFileService.isDirty(operation.resource)) {
512
- throw this.toConfigurationEditingError(9 , target, operation);
537
+ throw this.toConfigurationEditingError(ConfigurationEditingErrorCode.ERROR_CONFIGURATION_FILE_DIRTY, target, operation);
513
538
  }
514
539
  }
515
540
  getConfigurationEditOperation(target, config, overrides) {
516
541
  if (config.key) {
517
- const standaloneConfigurationMap = target === 1 ? USER_STANDALONE_CONFIGURATIONS : WORKSPACE_STANDALONE_CONFIGURATIONS;
518
- const standaloneConfigurationKeys = ( (Object.keys(standaloneConfigurationMap)));
542
+ const standaloneConfigurationMap = target === EditableConfigurationTarget.USER_LOCAL ? USER_STANDALONE_CONFIGURATIONS : WORKSPACE_STANDALONE_CONFIGURATIONS;
543
+ const standaloneConfigurationKeys = ( Object.keys(standaloneConfigurationMap));
519
544
  for (const key of standaloneConfigurationKeys) {
520
545
  const resource = this.getConfigurationFileResource(target, key, standaloneConfigurationMap[key], overrides.resource, undefined);
521
546
  if (config.key === key) {
@@ -530,10 +555,10 @@ let ConfigurationEditing = class ConfigurationEditing {
530
555
  }
531
556
  }
532
557
  const key = config.key;
533
- const configurationProperties = ( (Registry.as(Extensions.Configuration))).getConfigurationProperties();
558
+ const configurationProperties = ( Registry.as(Extensions.Configuration)).getConfigurationProperties();
534
559
  const configurationScope = configurationProperties[key]?.scope;
535
560
  let jsonPath = overrides.overrideIdentifiers?.length ? [keyFromOverrideIdentifiers(overrides.overrideIdentifiers), key] : [key];
536
- if (target === 1 || target === 2 ) {
561
+ if (target === EditableConfigurationTarget.USER_LOCAL || target === EditableConfigurationTarget.USER_REMOTE) {
537
562
  return { key, jsonPath, value: config.value, resource: this.getConfigurationFileResource(target, key, '', null, configurationScope) ?? undefined, target };
538
563
  }
539
564
  const resource = this.getConfigurationFileResource(target, key, FOLDER_SETTINGS_PATH, overrides.resource, configurationScope);
@@ -547,7 +572,7 @@ let ConfigurationEditing = class ConfigurationEditing {
547
572
  return !!(workspace.configuration && resource && workspace.configuration.fsPath === resource.fsPath);
548
573
  }
549
574
  getConfigurationFileResource(target, key, relativePath, resource, scope) {
550
- if (target === 1 ) {
575
+ if (target === EditableConfigurationTarget.USER_LOCAL) {
551
576
  if (key === TASKS_CONFIGURATION_KEY) {
552
577
  return this.userDataProfileService.currentProfile.tasksResource;
553
578
  }
@@ -558,21 +583,21 @@ let ConfigurationEditing = class ConfigurationEditing {
558
583
  return this.userDataProfileService.currentProfile.settingsResource;
559
584
  }
560
585
  }
561
- if (target === 2 ) {
586
+ if (target === EditableConfigurationTarget.USER_REMOTE) {
562
587
  return this.remoteSettingsResource;
563
588
  }
564
589
  const workbenchState = this.contextService.getWorkbenchState();
565
- if (workbenchState !== 1 ) {
590
+ if (workbenchState !== WorkbenchState.EMPTY) {
566
591
  const workspace = this.contextService.getWorkspace();
567
- if (target === 3 ) {
568
- if (workbenchState === 3 ) {
592
+ if (target === EditableConfigurationTarget.WORKSPACE) {
593
+ if (workbenchState === WorkbenchState.WORKSPACE) {
569
594
  return workspace.configuration ?? null;
570
595
  }
571
- if (workbenchState === 2 ) {
596
+ if (workbenchState === WorkbenchState.FOLDER) {
572
597
  return workspace.folders[0].toResource(relativePath);
573
598
  }
574
599
  }
575
- if (target === 4 ) {
600
+ if (target === EditableConfigurationTarget.WORKSPACE_FOLDER) {
576
601
  if (resource) {
577
602
  const folder = this.contextService.getWorkspaceFolder(resource);
578
603
  if (folder) {
@@ -584,18 +609,18 @@ let ConfigurationEditing = class ConfigurationEditing {
584
609
  return null;
585
610
  }
586
611
  };
587
- ConfigurationEditing = ( (__decorate([
588
- ( (__param(1, IWorkbenchConfigurationService))),
589
- ( (__param(2, IWorkspaceContextService))),
590
- ( (__param(3, IUserDataProfileService))),
591
- ( (__param(4, IUserDataProfilesService))),
592
- ( (__param(5, IFileService))),
593
- ( (__param(6, ITextModelService))),
594
- ( (__param(7, ITextFileService))),
595
- ( (__param(8, INotificationService))),
596
- ( (__param(9, IPreferencesService))),
597
- ( (__param(10, IEditorService))),
598
- ( (__param(11, IUriIdentityService)))
599
- ], ConfigurationEditing)));
612
+ ConfigurationEditing = ( __decorate([
613
+ ( __param(1, IWorkbenchConfigurationService)),
614
+ ( __param(2, IWorkspaceContextService)),
615
+ ( __param(3, IUserDataProfileService)),
616
+ ( __param(4, IUserDataProfilesService)),
617
+ ( __param(5, IFileService)),
618
+ ( __param(6, ITextModelService)),
619
+ ( __param(7, ITextFileService)),
620
+ ( __param(8, INotificationService)),
621
+ ( __param(9, IPreferencesService)),
622
+ ( __param(10, IEditorService)),
623
+ ( __param(11, IUriIdentityService))
624
+ ], ConfigurationEditing));
600
625
 
601
- export { ConfigurationEditing, ConfigurationEditingError };
626
+ export { ConfigurationEditing, ConfigurationEditingError, ConfigurationEditingErrorCode, EditableConfigurationTarget };