@codingame/monaco-vscode-configuration-service-override 9.0.2 → 10.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.
- package/configuration.js +7 -4
- package/package.json +3 -3
- package/tools.js +4 -2
- package/vscode/src/vs/editor/common/services/textResourceConfigurationService.js +10 -11
- package/vscode/src/vs/workbench/api/common/configurationExtensionPoint.js +48 -48
- package/vscode/src/vs/workbench/contrib/workspaces/browser/workspaces.contribution.js +13 -15
- package/vscode/src/vs/workbench/services/configuration/browser/configuration.js +18 -16
- package/vscode/src/vs/workbench/services/configuration/browser/configurationService.js +85 -86
- package/vscode/src/vs/workbench/services/configuration/common/configurationCache.js +1 -2
- package/vscode/src/vs/workbench/services/configuration/common/configurationEditing.js +112 -138
- package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +12 -15
- package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +0 -1
- package/vscode/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.js +4 -6
- package/vscode/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.js +17 -19
- package/vscode/src/vs/workbench/services/workspaces/browser/workspacesService.js +8 -11
|
@@ -4,15 +4,13 @@ import { parse } from 'vscode/vscode/vs/base/common/json';
|
|
|
4
4
|
import { setProperty } from 'vscode/vscode/vs/base/common/jsonEdit';
|
|
5
5
|
import { Queue } from 'vscode/vscode/vs/base/common/async';
|
|
6
6
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
7
|
-
import { WorkbenchState } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
8
7
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
9
8
|
import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
10
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';
|
|
11
10
|
import { IWorkbenchConfigurationService } from 'vscode/vscode/vs/workbench/services/configuration/common/configuration.service';
|
|
12
|
-
import { FileOperationResult } from 'vscode/vscode/vs/platform/files/common/files';
|
|
13
11
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
14
12
|
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
15
|
-
import { Extensions, OVERRIDE_PROPERTY_REGEX,
|
|
13
|
+
import { Extensions, OVERRIDE_PROPERTY_REGEX, keyFromOverrideIdentifiers } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
16
14
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
17
15
|
import 'vscode/vscode/vs/platform/notification/common/notification';
|
|
18
16
|
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
|
|
@@ -26,36 +24,12 @@ import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProf
|
|
|
26
24
|
import { ErrorNoTelemetry } from 'vscode/vscode/vs/base/common/errors';
|
|
27
25
|
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
28
26
|
|
|
29
|
-
var ConfigurationEditingErrorCode;
|
|
30
|
-
( ((function(ConfigurationEditingErrorCode) {
|
|
31
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_UNKNOWN_KEY"] = 0] = "ERROR_UNKNOWN_KEY";
|
|
32
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION"] = 1] = "ERROR_INVALID_WORKSPACE_CONFIGURATION_APPLICATION";
|
|
33
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE"] = 2] = "ERROR_INVALID_WORKSPACE_CONFIGURATION_MACHINE";
|
|
34
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_FOLDER_CONFIGURATION"] = 3] = "ERROR_INVALID_FOLDER_CONFIGURATION";
|
|
35
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_USER_TARGET"] = 4] = "ERROR_INVALID_USER_TARGET";
|
|
36
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_WORKSPACE_TARGET"] = 5] = "ERROR_INVALID_WORKSPACE_TARGET";
|
|
37
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_FOLDER_TARGET"] = 6] = "ERROR_INVALID_FOLDER_TARGET";
|
|
38
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION"] = 7] = "ERROR_INVALID_RESOURCE_LANGUAGE_CONFIGURATION";
|
|
39
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_NO_WORKSPACE_OPENED"] = 8] = "ERROR_NO_WORKSPACE_OPENED";
|
|
40
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_CONFIGURATION_FILE_DIRTY"] = 9] = "ERROR_CONFIGURATION_FILE_DIRTY";
|
|
41
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_CONFIGURATION_FILE_MODIFIED_SINCE"] = 10] = "ERROR_CONFIGURATION_FILE_MODIFIED_SINCE";
|
|
42
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INVALID_CONFIGURATION"] = 11] = "ERROR_INVALID_CONFIGURATION";
|
|
43
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_POLICY_CONFIGURATION"] = 12] = "ERROR_POLICY_CONFIGURATION";
|
|
44
|
-
ConfigurationEditingErrorCode[ConfigurationEditingErrorCode["ERROR_INTERNAL"] = 13] = "ERROR_INTERNAL";
|
|
45
|
-
})(ConfigurationEditingErrorCode || (ConfigurationEditingErrorCode = {}))));
|
|
46
27
|
class ConfigurationEditingError extends ErrorNoTelemetry {
|
|
47
28
|
constructor(message, code) {
|
|
48
29
|
super(message);
|
|
49
30
|
this.code = code;
|
|
50
31
|
}
|
|
51
32
|
}
|
|
52
|
-
var EditableConfigurationTarget;
|
|
53
|
-
( ((function(EditableConfigurationTarget) {
|
|
54
|
-
EditableConfigurationTarget[EditableConfigurationTarget["USER_LOCAL"] = 1] = "USER_LOCAL";
|
|
55
|
-
EditableConfigurationTarget[EditableConfigurationTarget["USER_REMOTE"] = 2] = "USER_REMOTE";
|
|
56
|
-
EditableConfigurationTarget[EditableConfigurationTarget["WORKSPACE"] = 3] = "WORKSPACE";
|
|
57
|
-
EditableConfigurationTarget[EditableConfigurationTarget["WORKSPACE_FOLDER"] = 4] = "WORKSPACE_FOLDER";
|
|
58
|
-
})(EditableConfigurationTarget || (EditableConfigurationTarget = {}))));
|
|
59
33
|
let ConfigurationEditing = class ConfigurationEditing {
|
|
60
34
|
constructor(remoteSettingsResource, configurationService, contextService, userDataProfileService, userDataProfilesService, fileService, textModelResolverService, textFileService, notificationService, preferencesService, editorService, uriIdentityService) {
|
|
61
35
|
this.remoteSettingsResource = remoteSettingsResource;
|
|
@@ -100,7 +74,7 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
100
74
|
}
|
|
101
75
|
async updateConfiguration(operation, model, formattingOptions, options) {
|
|
102
76
|
if (this.hasParseErrors(model.getValue(), operation)) {
|
|
103
|
-
throw this.toConfigurationEditingError(
|
|
77
|
+
throw this.toConfigurationEditingError(11 , operation.target, operation);
|
|
104
78
|
}
|
|
105
79
|
if (this.textFileService.isDirty(model.uri) && options.handleDirtyFile) {
|
|
106
80
|
switch (options.handleDirtyFile) {
|
|
@@ -122,15 +96,15 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
122
96
|
await this.textFileService.save(model.uri, { ignoreErrorHandler: true });
|
|
123
97
|
}
|
|
124
98
|
catch (error) {
|
|
125
|
-
if (error.fileOperationResult ===
|
|
126
|
-
throw this.toConfigurationEditingError(
|
|
99
|
+
if (error.fileOperationResult === 3 ) {
|
|
100
|
+
throw this.toConfigurationEditingError(10 , operation.target, operation);
|
|
127
101
|
}
|
|
128
102
|
throw ( (new ConfigurationEditingError(localize(
|
|
129
|
-
|
|
103
|
+
8861,
|
|
130
104
|
"Error while writing to {0}. {1}",
|
|
131
105
|
this.stringifyTarget(operation.target),
|
|
132
106
|
error.message
|
|
133
|
-
),
|
|
107
|
+
), 13 )));
|
|
134
108
|
}
|
|
135
109
|
}
|
|
136
110
|
applyEditsToBuffer(edit, model) {
|
|
@@ -173,21 +147,21 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
173
147
|
}
|
|
174
148
|
async onError(error, operation, scopes) {
|
|
175
149
|
switch (error.code) {
|
|
176
|
-
case
|
|
150
|
+
case 11 :
|
|
177
151
|
this.onInvalidConfigurationError(error, operation);
|
|
178
152
|
break;
|
|
179
|
-
case
|
|
153
|
+
case 9 :
|
|
180
154
|
this.onConfigurationFileDirtyError(error, operation, scopes);
|
|
181
155
|
break;
|
|
182
|
-
case
|
|
156
|
+
case 10 :
|
|
183
157
|
return this.doWriteConfiguration(operation, { scopes, handleDirtyFile: 'revert' });
|
|
184
158
|
default:
|
|
185
159
|
this.notificationService.error(error.message);
|
|
186
160
|
}
|
|
187
161
|
}
|
|
188
162
|
onInvalidConfigurationError(error, operation) {
|
|
189
|
-
const openStandAloneConfigurationActionLabel = operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY ? ( localize(
|
|
190
|
-
: operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY ? ( localize(
|
|
163
|
+
const openStandAloneConfigurationActionLabel = operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY ? ( localize(8862, "Open Tasks Configuration"))
|
|
164
|
+
: operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY ? ( localize(8863, "Open Launch Configuration"))
|
|
191
165
|
: null;
|
|
192
166
|
if (openStandAloneConfigurationActionLabel) {
|
|
193
167
|
this.notificationService.prompt(Severity$1.Error, error.message, [{
|
|
@@ -197,18 +171,18 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
197
171
|
}
|
|
198
172
|
else {
|
|
199
173
|
this.notificationService.prompt(Severity$1.Error, error.message, [{
|
|
200
|
-
label: ( localize(
|
|
174
|
+
label: ( localize(8864, "Open Settings")),
|
|
201
175
|
run: () => this.openSettings(operation)
|
|
202
176
|
}]);
|
|
203
177
|
}
|
|
204
178
|
}
|
|
205
179
|
onConfigurationFileDirtyError(error, operation, scopes) {
|
|
206
|
-
const openStandAloneConfigurationActionLabel = operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY ? ( localize(
|
|
207
|
-
: operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY ? ( localize(
|
|
180
|
+
const openStandAloneConfigurationActionLabel = operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY ? ( localize(8862, "Open Tasks Configuration"))
|
|
181
|
+
: operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY ? ( localize(8863, "Open Launch Configuration"))
|
|
208
182
|
: null;
|
|
209
183
|
if (openStandAloneConfigurationActionLabel) {
|
|
210
184
|
this.notificationService.prompt(Severity$1.Error, error.message, [{
|
|
211
|
-
label: ( localize(
|
|
185
|
+
label: ( localize(8865, "Save and Retry")),
|
|
212
186
|
run: () => {
|
|
213
187
|
const key = operation.key ? `${operation.workspaceStandAloneConfigurationKey}.${operation.key}` : operation.workspaceStandAloneConfigurationKey;
|
|
214
188
|
this.writeConfiguration(operation.target, { key, value: operation.value }, { handleDirtyFile: 'save', scopes });
|
|
@@ -221,11 +195,11 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
221
195
|
}
|
|
222
196
|
else {
|
|
223
197
|
this.notificationService.prompt(Severity$1.Error, error.message, [{
|
|
224
|
-
label: ( localize(
|
|
198
|
+
label: ( localize(8865, "Save and Retry")),
|
|
225
199
|
run: () => this.writeConfiguration(operation.target, { key: operation.key, value: operation.value }, { handleDirtyFile: 'save', scopes })
|
|
226
200
|
},
|
|
227
201
|
{
|
|
228
|
-
label: ( localize(
|
|
202
|
+
label: ( localize(8864, "Open Settings")),
|
|
229
203
|
run: () => this.openSettings(operation)
|
|
230
204
|
}]);
|
|
231
205
|
}
|
|
@@ -233,16 +207,16 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
233
207
|
openSettings(operation) {
|
|
234
208
|
const options = { jsonEditor: true };
|
|
235
209
|
switch (operation.target) {
|
|
236
|
-
case
|
|
210
|
+
case 1 :
|
|
237
211
|
this.preferencesService.openUserSettings(options);
|
|
238
212
|
break;
|
|
239
|
-
case
|
|
213
|
+
case 2 :
|
|
240
214
|
this.preferencesService.openRemoteSettings(options);
|
|
241
215
|
break;
|
|
242
|
-
case
|
|
216
|
+
case 3 :
|
|
243
217
|
this.preferencesService.openWorkspaceSettings(options);
|
|
244
218
|
break;
|
|
245
|
-
case
|
|
219
|
+
case 4 :
|
|
246
220
|
if (operation.resource) {
|
|
247
221
|
const workspaceFolder = this.contextService.getWorkspaceFolder(operation.resource);
|
|
248
222
|
if (workspaceFolder) {
|
|
@@ -263,86 +237,86 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
263
237
|
}
|
|
264
238
|
toErrorMessage(error, target, operation) {
|
|
265
239
|
switch (error) {
|
|
266
|
-
case
|
|
267
|
-
|
|
240
|
+
case 12 : return ( localize(
|
|
241
|
+
8866,
|
|
268
242
|
"Unable to write {0} because it is configured in system policy.",
|
|
269
243
|
operation.key
|
|
270
244
|
));
|
|
271
|
-
case
|
|
272
|
-
|
|
245
|
+
case 0 : return ( localize(
|
|
246
|
+
8867,
|
|
273
247
|
"Unable to write to {0} because {1} is not a registered configuration.",
|
|
274
248
|
this.stringifyTarget(target),
|
|
275
249
|
operation.key
|
|
276
250
|
));
|
|
277
|
-
case
|
|
278
|
-
|
|
251
|
+
case 1 : return ( localize(
|
|
252
|
+
8868,
|
|
279
253
|
"Unable to write {0} to Workspace Settings. This setting can be written only into User settings.",
|
|
280
254
|
operation.key
|
|
281
255
|
));
|
|
282
|
-
case
|
|
283
|
-
|
|
256
|
+
case 2 : return ( localize(
|
|
257
|
+
8869,
|
|
284
258
|
"Unable to write {0} to Workspace Settings. This setting can be written only into User settings.",
|
|
285
259
|
operation.key
|
|
286
260
|
));
|
|
287
|
-
case
|
|
288
|
-
|
|
261
|
+
case 3 : return ( localize(
|
|
262
|
+
8870,
|
|
289
263
|
"Unable to write to Folder Settings because {0} does not support the folder resource scope.",
|
|
290
264
|
operation.key
|
|
291
265
|
));
|
|
292
|
-
case
|
|
293
|
-
|
|
266
|
+
case 4 : return ( localize(
|
|
267
|
+
8871,
|
|
294
268
|
"Unable to write to User Settings because {0} does not support for global scope.",
|
|
295
269
|
operation.key
|
|
296
270
|
));
|
|
297
|
-
case
|
|
298
|
-
|
|
271
|
+
case 5 : return ( localize(
|
|
272
|
+
8872,
|
|
299
273
|
"Unable to write to Workspace Settings because {0} does not support for workspace scope in a multi folder workspace.",
|
|
300
274
|
operation.key
|
|
301
275
|
));
|
|
302
|
-
case
|
|
303
|
-
|
|
276
|
+
case 6 : return ( localize(
|
|
277
|
+
8873,
|
|
304
278
|
"Unable to write to Folder Settings because no resource is provided."
|
|
305
279
|
));
|
|
306
|
-
case
|
|
307
|
-
|
|
280
|
+
case 7 : return ( localize(
|
|
281
|
+
8874,
|
|
308
282
|
"Unable to write to Language Settings because {0} is not a resource language setting.",
|
|
309
283
|
operation.key
|
|
310
284
|
));
|
|
311
|
-
case
|
|
312
|
-
|
|
285
|
+
case 8 : return ( localize(
|
|
286
|
+
8875,
|
|
313
287
|
"Unable to write to {0} because no workspace is opened. Please open a workspace first and try again.",
|
|
314
288
|
this.stringifyTarget(target)
|
|
315
289
|
));
|
|
316
|
-
case
|
|
290
|
+
case 11 : {
|
|
317
291
|
if (operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY) {
|
|
318
292
|
return ( localize(
|
|
319
|
-
|
|
293
|
+
8876,
|
|
320
294
|
"Unable to write into the tasks configuration file. Please open it to correct errors/warnings in it and try again."
|
|
321
295
|
));
|
|
322
296
|
}
|
|
323
297
|
if (operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY) {
|
|
324
298
|
return ( localize(
|
|
325
|
-
|
|
299
|
+
8877,
|
|
326
300
|
"Unable to write into the launch configuration file. Please open it to correct errors/warnings in it and try again."
|
|
327
301
|
));
|
|
328
302
|
}
|
|
329
303
|
switch (target) {
|
|
330
|
-
case
|
|
304
|
+
case 1 :
|
|
331
305
|
return ( localize(
|
|
332
|
-
|
|
306
|
+
8878,
|
|
333
307
|
"Unable to write into user settings. Please open the user settings to correct errors/warnings in it and try again."
|
|
334
308
|
));
|
|
335
|
-
case
|
|
309
|
+
case 2 :
|
|
336
310
|
return ( localize(
|
|
337
|
-
|
|
311
|
+
8879,
|
|
338
312
|
"Unable to write into remote user settings. Please open the remote user settings to correct errors/warnings in it and try again."
|
|
339
313
|
));
|
|
340
|
-
case
|
|
314
|
+
case 3 :
|
|
341
315
|
return ( localize(
|
|
342
|
-
|
|
316
|
+
8880,
|
|
343
317
|
"Unable to write into workspace settings. Please open the workspace settings to correct errors/warnings in the file and try again."
|
|
344
318
|
));
|
|
345
|
-
case
|
|
319
|
+
case 4 : {
|
|
346
320
|
let workspaceFolderName = '<<unknown>>';
|
|
347
321
|
if (operation.resource) {
|
|
348
322
|
const folder = this.contextService.getWorkspaceFolder(operation.resource);
|
|
@@ -351,7 +325,7 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
351
325
|
}
|
|
352
326
|
}
|
|
353
327
|
return ( localize(
|
|
354
|
-
|
|
328
|
+
8881,
|
|
355
329
|
"Unable to write into folder settings. Please open the '{0}' folder settings to correct errors/warnings in it and try again.",
|
|
356
330
|
workspaceFolderName
|
|
357
331
|
));
|
|
@@ -360,36 +334,36 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
360
334
|
return '';
|
|
361
335
|
}
|
|
362
336
|
}
|
|
363
|
-
case
|
|
337
|
+
case 9 : {
|
|
364
338
|
if (operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY) {
|
|
365
339
|
return ( localize(
|
|
366
|
-
|
|
340
|
+
8882,
|
|
367
341
|
"Unable to write into tasks configuration file because the file has unsaved changes. Please save it first and then try again."
|
|
368
342
|
));
|
|
369
343
|
}
|
|
370
344
|
if (operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY) {
|
|
371
345
|
return ( localize(
|
|
372
|
-
|
|
346
|
+
8883,
|
|
373
347
|
"Unable to write into launch configuration file because the file has unsaved changes. Please save it first and then try again."
|
|
374
348
|
));
|
|
375
349
|
}
|
|
376
350
|
switch (target) {
|
|
377
|
-
case
|
|
351
|
+
case 1 :
|
|
378
352
|
return ( localize(
|
|
379
|
-
|
|
353
|
+
8884,
|
|
380
354
|
"Unable to write into user settings because the file has unsaved changes. Please save the user settings file first and then try again."
|
|
381
355
|
));
|
|
382
|
-
case
|
|
356
|
+
case 2 :
|
|
383
357
|
return ( localize(
|
|
384
|
-
|
|
358
|
+
8885,
|
|
385
359
|
"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."
|
|
386
360
|
));
|
|
387
|
-
case
|
|
361
|
+
case 3 :
|
|
388
362
|
return ( localize(
|
|
389
|
-
|
|
363
|
+
8886,
|
|
390
364
|
"Unable to write into workspace settings because the file has unsaved changes. Please save the workspace settings file first and then try again."
|
|
391
365
|
));
|
|
392
|
-
case
|
|
366
|
+
case 4 : {
|
|
393
367
|
let workspaceFolderName = '<<unknown>>';
|
|
394
368
|
if (operation.resource) {
|
|
395
369
|
const folder = this.contextService.getWorkspaceFolder(operation.resource);
|
|
@@ -398,7 +372,7 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
398
372
|
}
|
|
399
373
|
}
|
|
400
374
|
return ( localize(
|
|
401
|
-
|
|
375
|
+
8887,
|
|
402
376
|
"Unable to write into folder settings because the file has unsaved changes. Please save the '{0}' folder settings file first and then try again.",
|
|
403
377
|
workspaceFolderName
|
|
404
378
|
));
|
|
@@ -407,43 +381,43 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
407
381
|
return '';
|
|
408
382
|
}
|
|
409
383
|
}
|
|
410
|
-
case
|
|
384
|
+
case 10 :
|
|
411
385
|
if (operation.workspaceStandAloneConfigurationKey === TASKS_CONFIGURATION_KEY) {
|
|
412
386
|
return ( localize(
|
|
413
|
-
|
|
387
|
+
8888,
|
|
414
388
|
"Unable to write into tasks configuration file because the content of the file is newer."
|
|
415
389
|
));
|
|
416
390
|
}
|
|
417
391
|
if (operation.workspaceStandAloneConfigurationKey === LAUNCH_CONFIGURATION_KEY) {
|
|
418
392
|
return ( localize(
|
|
419
|
-
|
|
393
|
+
8889,
|
|
420
394
|
"Unable to write into launch configuration file because the content of the file is newer."
|
|
421
395
|
));
|
|
422
396
|
}
|
|
423
397
|
switch (target) {
|
|
424
|
-
case
|
|
398
|
+
case 1 :
|
|
425
399
|
return ( localize(
|
|
426
|
-
|
|
400
|
+
8890,
|
|
427
401
|
"Unable to write into user settings because the content of the file is newer."
|
|
428
402
|
));
|
|
429
|
-
case
|
|
403
|
+
case 2 :
|
|
430
404
|
return ( localize(
|
|
431
|
-
|
|
405
|
+
8891,
|
|
432
406
|
"Unable to write into remote user settings because the content of the file is newer."
|
|
433
407
|
));
|
|
434
|
-
case
|
|
408
|
+
case 3 :
|
|
435
409
|
return ( localize(
|
|
436
|
-
|
|
410
|
+
8892,
|
|
437
411
|
"Unable to write into workspace settings because the content of the file is newer."
|
|
438
412
|
));
|
|
439
|
-
case
|
|
413
|
+
case 4 :
|
|
440
414
|
return ( localize(
|
|
441
|
-
|
|
415
|
+
8893,
|
|
442
416
|
"Unable to write into folder settings because the content of the file is newer."
|
|
443
417
|
));
|
|
444
418
|
}
|
|
445
|
-
case
|
|
446
|
-
|
|
419
|
+
case 13 : return ( localize(
|
|
420
|
+
8894,
|
|
447
421
|
"Unable to write to {0} because of an internal error.",
|
|
448
422
|
this.stringifyTarget(target)
|
|
449
423
|
));
|
|
@@ -451,14 +425,14 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
451
425
|
}
|
|
452
426
|
stringifyTarget(target) {
|
|
453
427
|
switch (target) {
|
|
454
|
-
case
|
|
455
|
-
return ( localize(
|
|
456
|
-
case
|
|
457
|
-
return ( localize(
|
|
458
|
-
case
|
|
459
|
-
return ( localize(
|
|
460
|
-
case
|
|
461
|
-
return ( localize(
|
|
428
|
+
case 1 :
|
|
429
|
+
return ( localize(8895, "User Settings"));
|
|
430
|
+
case 2 :
|
|
431
|
+
return ( localize(8896, "Remote User Settings"));
|
|
432
|
+
case 3 :
|
|
433
|
+
return ( localize(8897, "Workspace Settings"));
|
|
434
|
+
case 4 :
|
|
435
|
+
return ( localize(8898, "Folder Settings"));
|
|
462
436
|
default:
|
|
463
437
|
return '';
|
|
464
438
|
}
|
|
@@ -488,59 +462,59 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
488
462
|
}
|
|
489
463
|
async validate(target, operation, checkDirty, overrides) {
|
|
490
464
|
if (this.configurationService.inspect(operation.key).policyValue !== undefined) {
|
|
491
|
-
throw this.toConfigurationEditingError(
|
|
465
|
+
throw this.toConfigurationEditingError(12 , target, operation);
|
|
492
466
|
}
|
|
493
467
|
const configurationProperties = ( (Registry.as(Extensions.Configuration))).getConfigurationProperties();
|
|
494
468
|
const configurationScope = configurationProperties[operation.key]?.scope;
|
|
495
469
|
if (!operation.workspaceStandAloneConfigurationKey) {
|
|
496
470
|
const validKeys = ( (this.configurationService.keys())).default;
|
|
497
471
|
if (validKeys.indexOf(operation.key) < 0 && !OVERRIDE_PROPERTY_REGEX.test(operation.key) && operation.value !== undefined) {
|
|
498
|
-
throw this.toConfigurationEditingError(
|
|
472
|
+
throw this.toConfigurationEditingError(0 , target, operation);
|
|
499
473
|
}
|
|
500
474
|
}
|
|
501
475
|
if (operation.workspaceStandAloneConfigurationKey) {
|
|
502
|
-
if ((operation.workspaceStandAloneConfigurationKey !== TASKS_CONFIGURATION_KEY) && (target ===
|
|
503
|
-
throw this.toConfigurationEditingError(
|
|
476
|
+
if ((operation.workspaceStandAloneConfigurationKey !== TASKS_CONFIGURATION_KEY) && ((target === 1 || target === 2) )) {
|
|
477
|
+
throw this.toConfigurationEditingError(4 , target, operation);
|
|
504
478
|
}
|
|
505
479
|
}
|
|
506
|
-
if ((target ===
|
|
507
|
-
throw this.toConfigurationEditingError(
|
|
480
|
+
if (((target === 3 || target === 4) ) && this.contextService.getWorkbenchState() === 1 ) {
|
|
481
|
+
throw this.toConfigurationEditingError(8 , target, operation);
|
|
508
482
|
}
|
|
509
|
-
if (target ===
|
|
483
|
+
if (target === 3 ) {
|
|
510
484
|
if (!operation.workspaceStandAloneConfigurationKey && !OVERRIDE_PROPERTY_REGEX.test(operation.key)) {
|
|
511
|
-
if (configurationScope ===
|
|
512
|
-
throw this.toConfigurationEditingError(
|
|
485
|
+
if (configurationScope === 1 ) {
|
|
486
|
+
throw this.toConfigurationEditingError(1 , target, operation);
|
|
513
487
|
}
|
|
514
|
-
if (configurationScope ===
|
|
515
|
-
throw this.toConfigurationEditingError(
|
|
488
|
+
if (configurationScope === 2 ) {
|
|
489
|
+
throw this.toConfigurationEditingError(2 , target, operation);
|
|
516
490
|
}
|
|
517
491
|
}
|
|
518
492
|
}
|
|
519
|
-
if (target ===
|
|
493
|
+
if (target === 4 ) {
|
|
520
494
|
if (!operation.resource) {
|
|
521
|
-
throw this.toConfigurationEditingError(
|
|
495
|
+
throw this.toConfigurationEditingError(6 , target, operation);
|
|
522
496
|
}
|
|
523
497
|
if (!operation.workspaceStandAloneConfigurationKey && !OVERRIDE_PROPERTY_REGEX.test(operation.key)) {
|
|
524
498
|
if (configurationScope !== undefined && !FOLDER_SCOPES.includes(configurationScope)) {
|
|
525
|
-
throw this.toConfigurationEditingError(
|
|
499
|
+
throw this.toConfigurationEditingError(3 , target, operation);
|
|
526
500
|
}
|
|
527
501
|
}
|
|
528
502
|
}
|
|
529
503
|
if (overrides.overrideIdentifiers?.length) {
|
|
530
|
-
if (configurationScope !==
|
|
531
|
-
throw this.toConfigurationEditingError(
|
|
504
|
+
if (configurationScope !== 5 ) {
|
|
505
|
+
throw this.toConfigurationEditingError(7 , target, operation);
|
|
532
506
|
}
|
|
533
507
|
}
|
|
534
508
|
if (!operation.resource) {
|
|
535
|
-
throw this.toConfigurationEditingError(
|
|
509
|
+
throw this.toConfigurationEditingError(6 , target, operation);
|
|
536
510
|
}
|
|
537
511
|
if (checkDirty && this.textFileService.isDirty(operation.resource)) {
|
|
538
|
-
throw this.toConfigurationEditingError(
|
|
512
|
+
throw this.toConfigurationEditingError(9 , target, operation);
|
|
539
513
|
}
|
|
540
514
|
}
|
|
541
515
|
getConfigurationEditOperation(target, config, overrides) {
|
|
542
516
|
if (config.key) {
|
|
543
|
-
const standaloneConfigurationMap = target ===
|
|
517
|
+
const standaloneConfigurationMap = target === 1 ? USER_STANDALONE_CONFIGURATIONS : WORKSPACE_STANDALONE_CONFIGURATIONS;
|
|
544
518
|
const standaloneConfigurationKeys = ( (Object.keys(standaloneConfigurationMap)));
|
|
545
519
|
for (const key of standaloneConfigurationKeys) {
|
|
546
520
|
const resource = this.getConfigurationFileResource(target, key, standaloneConfigurationMap[key], overrides.resource, undefined);
|
|
@@ -559,7 +533,7 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
559
533
|
const configurationProperties = ( (Registry.as(Extensions.Configuration))).getConfigurationProperties();
|
|
560
534
|
const configurationScope = configurationProperties[key]?.scope;
|
|
561
535
|
let jsonPath = overrides.overrideIdentifiers?.length ? [keyFromOverrideIdentifiers(overrides.overrideIdentifiers), key] : [key];
|
|
562
|
-
if (target ===
|
|
536
|
+
if (target === 1 || target === 2 ) {
|
|
563
537
|
return { key, jsonPath, value: config.value, resource: this.getConfigurationFileResource(target, key, '', null, configurationScope) ?? undefined, target };
|
|
564
538
|
}
|
|
565
539
|
const resource = this.getConfigurationFileResource(target, key, FOLDER_SETTINGS_PATH, overrides.resource, configurationScope);
|
|
@@ -573,7 +547,7 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
573
547
|
return !!(workspace.configuration && resource && workspace.configuration.fsPath === resource.fsPath);
|
|
574
548
|
}
|
|
575
549
|
getConfigurationFileResource(target, key, relativePath, resource, scope) {
|
|
576
|
-
if (target ===
|
|
550
|
+
if (target === 1 ) {
|
|
577
551
|
if (key === TASKS_CONFIGURATION_KEY) {
|
|
578
552
|
return this.userDataProfileService.currentProfile.tasksResource;
|
|
579
553
|
}
|
|
@@ -584,21 +558,21 @@ let ConfigurationEditing = class ConfigurationEditing {
|
|
|
584
558
|
return this.userDataProfileService.currentProfile.settingsResource;
|
|
585
559
|
}
|
|
586
560
|
}
|
|
587
|
-
if (target ===
|
|
561
|
+
if (target === 2 ) {
|
|
588
562
|
return this.remoteSettingsResource;
|
|
589
563
|
}
|
|
590
564
|
const workbenchState = this.contextService.getWorkbenchState();
|
|
591
|
-
if (workbenchState !==
|
|
565
|
+
if (workbenchState !== 1 ) {
|
|
592
566
|
const workspace = this.contextService.getWorkspace();
|
|
593
|
-
if (target ===
|
|
594
|
-
if (workbenchState ===
|
|
567
|
+
if (target === 3 ) {
|
|
568
|
+
if (workbenchState === 3 ) {
|
|
595
569
|
return workspace.configuration ?? null;
|
|
596
570
|
}
|
|
597
|
-
if (workbenchState ===
|
|
571
|
+
if (workbenchState === 2 ) {
|
|
598
572
|
return workspace.folders[0].toResource(relativePath);
|
|
599
573
|
}
|
|
600
574
|
}
|
|
601
|
-
if (target ===
|
|
575
|
+
if (target === 4 ) {
|
|
602
576
|
if (resource) {
|
|
603
577
|
const folder = this.contextService.getWorkspaceFolder(resource);
|
|
604
578
|
if (folder) {
|
|
@@ -624,4 +598,4 @@ ConfigurationEditing = ( (__decorate([
|
|
|
624
598
|
( (__param(11, IUriIdentityService)))
|
|
625
599
|
], ConfigurationEditing)));
|
|
626
600
|
|
|
627
|
-
export { ConfigurationEditing, ConfigurationEditingError
|
|
601
|
+
export { ConfigurationEditing, ConfigurationEditingError };
|