@codingame/monaco-vscode-configuration-service-override 1.83.0-next.0 → 1.83.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-configuration-service-override",
|
|
3
|
-
"version": "1.83.
|
|
3
|
+
"version": "1.83.2",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
15
|
"private": false,
|
|
16
|
-
"description": "VSCode public API plugged on the monaco editor - configuration service-override
|
|
16
|
+
"description": "VSCode public API plugged on the monaco editor - configuration service-override",
|
|
17
17
|
"main": "index.js",
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@1.83.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.83.2",
|
|
22
22
|
"monaco-editor": "0.44.0"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -19,7 +19,7 @@ class DefaultConfiguration extends DefaultConfiguration$1 {
|
|
|
19
19
|
constructor(configurationCache, environmentService) {
|
|
20
20
|
super();
|
|
21
21
|
this.configurationCache = configurationCache;
|
|
22
|
-
this.configurationRegistry = (
|
|
22
|
+
this.configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
23
23
|
this.cachedConfigurationDefaultsOverrides = {};
|
|
24
24
|
this.cacheKey = { type: 'defaults', key: 'configurationDefaultsOverrides' };
|
|
25
25
|
this.updateCache = false;
|
|
@@ -78,7 +78,7 @@ class DefaultConfiguration extends DefaultConfiguration$1 {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
try {
|
|
81
|
-
if ((
|
|
81
|
+
if (( Object.keys(cachedConfigurationDefaultsOverrides)).length) {
|
|
82
82
|
window.localStorage.setItem(DefaultConfiguration.DEFAULT_OVERRIDES_CACHE_EXISTS_KEY, 'yes');
|
|
83
83
|
await this.configurationCache.write(this.cacheKey, JSON.stringify(cachedConfigurationDefaultsOverrides));
|
|
84
84
|
}
|
|
@@ -93,13 +93,13 @@ class DefaultConfiguration extends DefaultConfiguration$1 {
|
|
|
93
93
|
class ApplicationConfiguration extends UserSettings {
|
|
94
94
|
constructor(userDataProfilesService, fileService, uriIdentityService) {
|
|
95
95
|
super(userDataProfilesService.defaultProfile.settingsResource, { scopes: [1 ] }, uriIdentityService.extUri, fileService);
|
|
96
|
-
this._onDidChangeConfiguration = this._register((
|
|
96
|
+
this._onDidChangeConfiguration = this._register(( new Emitter()));
|
|
97
97
|
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
98
98
|
this._register(this.onDidChange(() => this.reloadConfigurationScheduler.schedule()));
|
|
99
|
-
this.reloadConfigurationScheduler = this._register((
|
|
99
|
+
this.reloadConfigurationScheduler = this._register(( new RunOnceScheduler(
|
|
100
100
|
() => this.loadConfiguration().then(configurationModel => this._onDidChangeConfiguration.fire(configurationModel)),
|
|
101
101
|
50
|
|
102
|
-
)))
|
|
102
|
+
)));
|
|
103
103
|
}
|
|
104
104
|
async initialize() {
|
|
105
105
|
return this.loadConfiguration();
|
|
@@ -123,21 +123,21 @@ class UserConfiguration extends Disposable {
|
|
|
123
123
|
this.fileService = fileService;
|
|
124
124
|
this.uriIdentityService = uriIdentityService;
|
|
125
125
|
this.logService = logService;
|
|
126
|
-
this._onDidChangeConfiguration = this._register((
|
|
126
|
+
this._onDidChangeConfiguration = this._register(( new Emitter()));
|
|
127
127
|
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
128
|
-
this.userConfiguration = this._register((
|
|
129
|
-
this.userConfigurationChangeDisposable = this._register((
|
|
130
|
-
this.userConfiguration.value = (
|
|
128
|
+
this.userConfiguration = this._register(( new MutableDisposable()));
|
|
129
|
+
this.userConfigurationChangeDisposable = this._register(( new MutableDisposable()));
|
|
130
|
+
this.userConfiguration.value = ( new UserSettings(
|
|
131
131
|
settingsResource,
|
|
132
132
|
this.configurationParseOptions,
|
|
133
133
|
uriIdentityService.extUri,
|
|
134
134
|
this.fileService
|
|
135
|
-
))
|
|
135
|
+
));
|
|
136
136
|
this.userConfigurationChangeDisposable.value = this.userConfiguration.value.onDidChange(() => this.reloadConfigurationScheduler.schedule());
|
|
137
|
-
this.reloadConfigurationScheduler = this._register((
|
|
137
|
+
this.reloadConfigurationScheduler = this._register(( new RunOnceScheduler(
|
|
138
138
|
() => this.userConfiguration.value.loadConfiguration().then(configurationModel => this._onDidChangeConfiguration.fire(configurationModel)),
|
|
139
139
|
50
|
|
140
|
-
)))
|
|
140
|
+
)));
|
|
141
141
|
}
|
|
142
142
|
async reset(settingsResource, tasksResource, configurationParseOptions) {
|
|
143
143
|
this.settingsResource = settingsResource;
|
|
@@ -145,15 +145,7 @@ class UserConfiguration extends Disposable {
|
|
|
145
145
|
this.configurationParseOptions = configurationParseOptions;
|
|
146
146
|
const folder = this.uriIdentityService.extUri.dirname(this.settingsResource);
|
|
147
147
|
const standAloneConfigurationResources = this.tasksResource ? [[TASKS_CONFIGURATION_KEY, this.tasksResource]] : [];
|
|
148
|
-
const fileServiceBasedConfiguration = (
|
|
149
|
-
(folder.toString()),
|
|
150
|
-
this.settingsResource,
|
|
151
|
-
standAloneConfigurationResources,
|
|
152
|
-
this.configurationParseOptions,
|
|
153
|
-
this.fileService,
|
|
154
|
-
this.uriIdentityService,
|
|
155
|
-
this.logService
|
|
156
|
-
)));
|
|
148
|
+
const fileServiceBasedConfiguration = ( new FileServiceBasedConfiguration(( folder.toString()), this.settingsResource, standAloneConfigurationResources, this.configurationParseOptions, this.fileService, this.uriIdentityService, this.logService));
|
|
157
149
|
const configurationModel = await fileServiceBasedConfiguration.loadConfiguration();
|
|
158
150
|
this.userConfiguration.value = fileServiceBasedConfiguration;
|
|
159
151
|
if (this.userConfigurationChangeDisposable.value) {
|
|
@@ -186,45 +178,43 @@ class FileServiceBasedConfiguration extends Disposable {
|
|
|
186
178
|
this.fileService = fileService;
|
|
187
179
|
this.uriIdentityService = uriIdentityService;
|
|
188
180
|
this.logService = logService;
|
|
189
|
-
this._onDidChange = this._register((
|
|
181
|
+
this._onDidChange = this._register(( new Emitter()));
|
|
190
182
|
this.onDidChange = this._onDidChange.event;
|
|
191
|
-
this.allResources = [this.settingsResource, ...(
|
|
192
|
-
this._register(combinedDisposable(...(
|
|
183
|
+
this.allResources = [this.settingsResource, ...( this.standAloneConfigurationResources.map(([, resource]) => resource))];
|
|
184
|
+
this._register(combinedDisposable(...( this.allResources.map(
|
|
193
185
|
resource => combinedDisposable(this.fileService.watch(uriIdentityService.extUri.dirname(resource)),
|
|
194
186
|
this.fileService.watch(resource))
|
|
195
|
-
))))
|
|
196
|
-
this._folderSettingsModelParser = (
|
|
187
|
+
))));
|
|
188
|
+
this._folderSettingsModelParser = ( new ConfigurationModelParser(name));
|
|
197
189
|
this._folderSettingsParseOptions = configurationParseOptions;
|
|
198
190
|
this._standAloneConfigurations = [];
|
|
199
|
-
this._cache = (
|
|
191
|
+
this._cache = ( new ConfigurationModel());
|
|
200
192
|
this._register(Event.debounce(Event.any(Event.filter(this.fileService.onDidFilesChange, e => this.handleFileChangesEvent(e)), Event.filter(this.fileService.onDidRunOperation, e => this.handleFileOperationEvent(e))), () => undefined, 100)(() => this._onDidChange.fire()));
|
|
201
193
|
}
|
|
202
194
|
async resolveContents() {
|
|
203
195
|
const resolveContents = async (resources) => {
|
|
204
|
-
return Promise.all((
|
|
196
|
+
return Promise.all(( resources.map(async (resource) => {
|
|
205
197
|
try {
|
|
206
198
|
const content = await this.fileService.readFile(resource, { atomic: true });
|
|
207
|
-
return (
|
|
208
|
-
(content.value.toString())
|
|
209
|
-
);
|
|
199
|
+
return ( content.value.toString());
|
|
210
200
|
}
|
|
211
201
|
catch (error) {
|
|
212
|
-
this.logService.trace(`Error while resolving configuration file '${(
|
|
202
|
+
this.logService.trace(`Error while resolving configuration file '${( resource.toString())}': ${errors.getErrorMessage(error)}`);
|
|
213
203
|
if (error.fileOperationResult !== 1
|
|
214
204
|
&& error.fileOperationResult !== 9 ) {
|
|
215
205
|
this.logService.error(error);
|
|
216
206
|
}
|
|
217
207
|
}
|
|
218
208
|
return '{}';
|
|
219
|
-
})))
|
|
209
|
+
})));
|
|
220
210
|
};
|
|
221
211
|
const [[settingsContent], standAloneConfigurationContents] = await Promise.all([
|
|
222
212
|
resolveContents([this.settingsResource]),
|
|
223
|
-
resolveContents((
|
|
213
|
+
resolveContents(( this.standAloneConfigurationResources.map(([, resource]) => resource))),
|
|
224
214
|
]);
|
|
225
|
-
return [settingsContent, (
|
|
215
|
+
return [settingsContent, ( standAloneConfigurationContents.map(
|
|
226
216
|
(content, index) => ([this.standAloneConfigurationResources[index][0], content])
|
|
227
|
-
))
|
|
217
|
+
))];
|
|
228
218
|
}
|
|
229
219
|
async loadConfiguration() {
|
|
230
220
|
const [settingsContent, standAloneConfigurationContents] = await this.resolveContents();
|
|
@@ -236,10 +226,7 @@ class FileServiceBasedConfiguration extends Disposable {
|
|
|
236
226
|
for (let index = 0; index < standAloneConfigurationContents.length; index++) {
|
|
237
227
|
const contents = standAloneConfigurationContents[index][1];
|
|
238
228
|
if (contents !== undefined) {
|
|
239
|
-
const standAloneConfigurationModelParser = (
|
|
240
|
-
(this.standAloneConfigurationResources[index][1].toString()),
|
|
241
|
-
this.standAloneConfigurationResources[index][0]
|
|
242
|
-
)));
|
|
229
|
+
const standAloneConfigurationModelParser = ( new StandaloneConfigurationModelParser(( this.standAloneConfigurationResources[index][1].toString()), this.standAloneConfigurationResources[index][0]));
|
|
243
230
|
standAloneConfigurationModelParser.parse(contents);
|
|
244
231
|
this._standAloneConfigurations.push(standAloneConfigurationModelParser.configurationModel);
|
|
245
232
|
}
|
|
@@ -263,26 +250,26 @@ class FileServiceBasedConfiguration extends Disposable {
|
|
|
263
250
|
this._cache = this._folderSettingsModelParser.configurationModel.merge(...this._standAloneConfigurations);
|
|
264
251
|
}
|
|
265
252
|
handleFileChangesEvent(event) {
|
|
266
|
-
if ((
|
|
253
|
+
if (( this.allResources.some(resource => event.contains(resource)))) {
|
|
267
254
|
return true;
|
|
268
255
|
}
|
|
269
|
-
if ((
|
|
256
|
+
if (( this.allResources.some(
|
|
270
257
|
resource => event.contains(this.uriIdentityService.extUri.dirname(resource), 2 )
|
|
271
|
-
)))
|
|
258
|
+
))) {
|
|
272
259
|
return true;
|
|
273
260
|
}
|
|
274
261
|
return false;
|
|
275
262
|
}
|
|
276
263
|
handleFileOperationEvent(event) {
|
|
277
264
|
if ((event.isOperation(0 ) || event.isOperation(3 ) || event.isOperation(1 ) || event.isOperation(4 ))
|
|
278
|
-
&& (
|
|
265
|
+
&& ( this.allResources.some(
|
|
279
266
|
resource => this.uriIdentityService.extUri.isEqual(event.resource, resource)
|
|
280
|
-
)))
|
|
267
|
+
))) {
|
|
281
268
|
return true;
|
|
282
269
|
}
|
|
283
|
-
if (event.isOperation(1 ) && (
|
|
270
|
+
if (event.isOperation(1 ) && ( this.allResources.some(
|
|
284
271
|
resource => this.uriIdentityService.extUri.isEqual(event.resource, this.uriIdentityService.extUri.dirname(resource))
|
|
285
|
-
)))
|
|
272
|
+
))) {
|
|
286
273
|
return true;
|
|
287
274
|
}
|
|
288
275
|
return false;
|
|
@@ -292,20 +279,20 @@ class RemoteUserConfiguration extends Disposable {
|
|
|
292
279
|
constructor(remoteAuthority, configurationCache, fileService, uriIdentityService, remoteAgentService) {
|
|
293
280
|
super();
|
|
294
281
|
this._userConfigurationInitializationPromise = null;
|
|
295
|
-
this._onDidChangeConfiguration = this._register((
|
|
282
|
+
this._onDidChangeConfiguration = this._register(( new Emitter()));
|
|
296
283
|
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
297
|
-
this._onDidInitialize = this._register((
|
|
284
|
+
this._onDidInitialize = this._register(( new Emitter()));
|
|
298
285
|
this.onDidInitialize = this._onDidInitialize.event;
|
|
299
286
|
this._fileService = fileService;
|
|
300
|
-
this._userConfiguration = this._cachedConfiguration = (
|
|
287
|
+
this._userConfiguration = this._cachedConfiguration = ( new CachedRemoteUserConfiguration(remoteAuthority, configurationCache, { scopes: REMOTE_MACHINE_SCOPES }));
|
|
301
288
|
remoteAgentService.getEnvironment().then(async (environment) => {
|
|
302
289
|
if (environment) {
|
|
303
|
-
const userConfiguration = this._register((
|
|
290
|
+
const userConfiguration = this._register(( new FileServiceBasedRemoteUserConfiguration(
|
|
304
291
|
environment.settingsPath,
|
|
305
292
|
{ scopes: REMOTE_MACHINE_SCOPES },
|
|
306
293
|
this._fileService,
|
|
307
294
|
uriIdentityService
|
|
308
|
-
)))
|
|
295
|
+
)));
|
|
309
296
|
this._register(userConfiguration.onDidChangeConfiguration(configurationModel => this.onDidUserConfigurationChange(configurationModel)));
|
|
310
297
|
this._userConfigurationInitializationPromise = userConfiguration.initialize();
|
|
311
298
|
const configurationModel = await this._userConfigurationInitializationPromise;
|
|
@@ -361,18 +348,18 @@ class FileServiceBasedRemoteUserConfiguration extends Disposable {
|
|
|
361
348
|
this.configurationResource = configurationResource;
|
|
362
349
|
this.fileService = fileService;
|
|
363
350
|
this.uriIdentityService = uriIdentityService;
|
|
364
|
-
this._onDidChangeConfiguration = this._register((
|
|
351
|
+
this._onDidChangeConfiguration = this._register(( new Emitter()));
|
|
365
352
|
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
366
|
-
this.fileWatcherDisposable = this._register((
|
|
367
|
-
this.directoryWatcherDisposable = this._register((
|
|
368
|
-
this.parser = (
|
|
353
|
+
this.fileWatcherDisposable = this._register(( new MutableDisposable()));
|
|
354
|
+
this.directoryWatcherDisposable = this._register(( new MutableDisposable()));
|
|
355
|
+
this.parser = ( new ConfigurationModelParser(( this.configurationResource.toString())));
|
|
369
356
|
this.parseOptions = configurationParseOptions;
|
|
370
357
|
this._register(fileService.onDidFilesChange(e => this.handleFileChangesEvent(e)));
|
|
371
358
|
this._register(fileService.onDidRunOperation(e => this.handleFileOperationEvent(e)));
|
|
372
|
-
this.reloadConfigurationScheduler = this._register((
|
|
359
|
+
this.reloadConfigurationScheduler = this._register(( new RunOnceScheduler(
|
|
373
360
|
() => this.reload().then(configurationModel => this._onDidChangeConfiguration.fire(configurationModel)),
|
|
374
361
|
50
|
|
375
|
-
)))
|
|
362
|
+
)));
|
|
376
363
|
this._register(toDisposable(() => {
|
|
377
364
|
this.stopWatchingResource();
|
|
378
365
|
this.stopWatchingDirectory();
|
|
@@ -398,9 +385,7 @@ class FileServiceBasedRemoteUserConfiguration extends Disposable {
|
|
|
398
385
|
}
|
|
399
386
|
async resolveContent() {
|
|
400
387
|
const content = await this.fileService.readFile(this.configurationResource, { atomic: true });
|
|
401
|
-
return (
|
|
402
|
-
(content.value.toString())
|
|
403
|
-
);
|
|
388
|
+
return ( content.value.toString());
|
|
404
389
|
}
|
|
405
390
|
async reload() {
|
|
406
391
|
try {
|
|
@@ -409,9 +394,7 @@ class FileServiceBasedRemoteUserConfiguration extends Disposable {
|
|
|
409
394
|
return this.parser.configurationModel;
|
|
410
395
|
}
|
|
411
396
|
catch (e) {
|
|
412
|
-
return (
|
|
413
|
-
(new ConfigurationModel())
|
|
414
|
-
);
|
|
397
|
+
return ( new ConfigurationModel());
|
|
415
398
|
}
|
|
416
399
|
}
|
|
417
400
|
reparse(configurationParseOptions) {
|
|
@@ -457,12 +440,12 @@ class CachedRemoteUserConfiguration extends Disposable {
|
|
|
457
440
|
constructor(remoteAuthority, configurationCache, configurationParseOptions) {
|
|
458
441
|
super();
|
|
459
442
|
this.configurationCache = configurationCache;
|
|
460
|
-
this._onDidChange = this._register((
|
|
443
|
+
this._onDidChange = this._register(( new Emitter()));
|
|
461
444
|
this.onDidChange = this._onDidChange.event;
|
|
462
445
|
this.key = { type: 'user', key: remoteAuthority };
|
|
463
|
-
this.parser = (
|
|
446
|
+
this.parser = ( new ConfigurationModelParser('CachedRemoteUserConfiguration'));
|
|
464
447
|
this.parseOptions = configurationParseOptions;
|
|
465
|
-
this.configurationModel = (
|
|
448
|
+
this.configurationModel = ( new ConfigurationModel());
|
|
466
449
|
}
|
|
467
450
|
getConfigurationModel() {
|
|
468
451
|
return this.configurationModel;
|
|
@@ -508,14 +491,14 @@ class WorkspaceConfiguration extends Disposable {
|
|
|
508
491
|
this.fileService = fileService;
|
|
509
492
|
this.uriIdentityService = uriIdentityService;
|
|
510
493
|
this.logService = logService;
|
|
511
|
-
this._workspaceConfigurationDisposables = this._register((
|
|
494
|
+
this._workspaceConfigurationDisposables = this._register(( new DisposableStore()));
|
|
512
495
|
this._workspaceIdentifier = null;
|
|
513
496
|
this._isWorkspaceTrusted = false;
|
|
514
|
-
this._onDidUpdateConfiguration = this._register((
|
|
497
|
+
this._onDidUpdateConfiguration = this._register(( new Emitter()));
|
|
515
498
|
this.onDidUpdateConfiguration = this._onDidUpdateConfiguration.event;
|
|
516
499
|
this._initialized = false;
|
|
517
500
|
this.fileService = fileService;
|
|
518
|
-
this._workspaceConfiguration = this._cachedConfiguration = (
|
|
501
|
+
this._workspaceConfiguration = this._cachedConfiguration = ( new CachedWorkspaceConfiguration(configurationCache));
|
|
519
502
|
}
|
|
520
503
|
async initialize(workspaceIdentifier, workspaceTrusted) {
|
|
521
504
|
this._workspaceIdentifier = workspaceIdentifier;
|
|
@@ -526,7 +509,7 @@ class WorkspaceConfiguration extends Disposable {
|
|
|
526
509
|
this.waitAndInitialize(this._workspaceIdentifier);
|
|
527
510
|
}
|
|
528
511
|
else {
|
|
529
|
-
this.doInitialize((
|
|
512
|
+
this.doInitialize(( new FileServiceBasedWorkspaceConfiguration(this.fileService, this.uriIdentityService, this.logService)));
|
|
530
513
|
}
|
|
531
514
|
}
|
|
532
515
|
await this.reload();
|
|
@@ -566,7 +549,7 @@ class WorkspaceConfiguration extends Disposable {
|
|
|
566
549
|
async waitAndInitialize(workspaceIdentifier) {
|
|
567
550
|
await whenProviderRegistered(workspaceIdentifier.configPath, this.fileService);
|
|
568
551
|
if (!(this._workspaceConfiguration instanceof FileServiceBasedWorkspaceConfiguration)) {
|
|
569
|
-
const fileServiceBasedWorkspaceConfiguration = this._register((
|
|
552
|
+
const fileServiceBasedWorkspaceConfiguration = this._register(( new FileServiceBasedWorkspaceConfiguration(this.fileService, this.uriIdentityService, this.logService)));
|
|
570
553
|
await fileServiceBasedWorkspaceConfiguration.load(workspaceIdentifier, { scopes: WORKSPACE_SCOPES, skipRestricted: this.isUntrusted() });
|
|
571
554
|
this.doInitialize(fileServiceBasedWorkspaceConfiguration);
|
|
572
555
|
this.onDidWorkspaceConfigurationChange(false, true);
|
|
@@ -601,12 +584,12 @@ class FileServiceBasedWorkspaceConfiguration extends Disposable {
|
|
|
601
584
|
this.fileService = fileService;
|
|
602
585
|
this.logService = logService;
|
|
603
586
|
this._workspaceIdentifier = null;
|
|
604
|
-
this._onDidChange = this._register((
|
|
587
|
+
this._onDidChange = this._register(( new Emitter()));
|
|
605
588
|
this.onDidChange = this._onDidChange.event;
|
|
606
|
-
this.workspaceConfigurationModelParser = (
|
|
607
|
-
this.workspaceSettings = (
|
|
589
|
+
this.workspaceConfigurationModelParser = ( new WorkspaceConfigurationModelParser(''));
|
|
590
|
+
this.workspaceSettings = ( new ConfigurationModel());
|
|
608
591
|
this._register(Event.any(Event.filter(this.fileService.onDidFilesChange, e => !!this._workspaceIdentifier && e.contains(this._workspaceIdentifier.configPath)), Event.filter(this.fileService.onDidRunOperation, e => !!this._workspaceIdentifier && (e.isOperation(0 ) || e.isOperation(3 ) || e.isOperation(1 ) || e.isOperation(4 )) && uriIdentityService.extUri.isEqual(e.resource, this._workspaceIdentifier.configPath)))(() => this.reloadConfigurationScheduler.schedule()));
|
|
609
|
-
this.reloadConfigurationScheduler = this._register((
|
|
592
|
+
this.reloadConfigurationScheduler = this._register(( new RunOnceScheduler(() => this._onDidChange.fire(), 50)));
|
|
610
593
|
this.workspaceConfigWatcher = this._register(this.watchWorkspaceConfigurationFile());
|
|
611
594
|
}
|
|
612
595
|
get workspaceIdentifier() {
|
|
@@ -614,14 +597,12 @@ class FileServiceBasedWorkspaceConfiguration extends Disposable {
|
|
|
614
597
|
}
|
|
615
598
|
async resolveContent(workspaceIdentifier) {
|
|
616
599
|
const content = await this.fileService.readFile(workspaceIdentifier.configPath, { atomic: true });
|
|
617
|
-
return (
|
|
618
|
-
(content.value.toString())
|
|
619
|
-
);
|
|
600
|
+
return ( content.value.toString());
|
|
620
601
|
}
|
|
621
602
|
async load(workspaceIdentifier, configurationParseOptions) {
|
|
622
603
|
if (!this._workspaceIdentifier || this._workspaceIdentifier.id !== workspaceIdentifier.id) {
|
|
623
604
|
this._workspaceIdentifier = workspaceIdentifier;
|
|
624
|
-
this.workspaceConfigurationModelParser = (
|
|
605
|
+
this.workspaceConfigurationModelParser = ( new WorkspaceConfigurationModelParser(this._workspaceIdentifier.id));
|
|
625
606
|
dispose(this.workspaceConfigWatcher);
|
|
626
607
|
this.workspaceConfigWatcher = this._register(this.watchWorkspaceConfigurationFile());
|
|
627
608
|
}
|
|
@@ -669,8 +650,8 @@ class CachedWorkspaceConfiguration {
|
|
|
669
650
|
constructor(configurationCache) {
|
|
670
651
|
this.configurationCache = configurationCache;
|
|
671
652
|
this.onDidChange = Event.None;
|
|
672
|
-
this.workspaceConfigurationModelParser = (
|
|
673
|
-
this.workspaceSettings = (
|
|
653
|
+
this.workspaceConfigurationModelParser = ( new WorkspaceConfigurationModelParser(''));
|
|
654
|
+
this.workspaceSettings = ( new ConfigurationModel());
|
|
674
655
|
}
|
|
675
656
|
async load(workspaceIdentifier, configurationParseOptions) {
|
|
676
657
|
try {
|
|
@@ -678,7 +659,7 @@ class CachedWorkspaceConfiguration {
|
|
|
678
659
|
const contents = await this.configurationCache.read(key);
|
|
679
660
|
const parsed = JSON.parse(contents);
|
|
680
661
|
if (parsed.content) {
|
|
681
|
-
this.workspaceConfigurationModelParser = (
|
|
662
|
+
this.workspaceConfigurationModelParser = ( new WorkspaceConfigurationModelParser(key.key));
|
|
682
663
|
this.workspaceConfigurationModelParser.parse(parsed.content, configurationParseOptions);
|
|
683
664
|
this.consolidate();
|
|
684
665
|
}
|
|
@@ -736,23 +717,23 @@ class CachedFolderConfiguration {
|
|
|
736
717
|
constructor(folder, configFolderRelativePath, configurationParseOptions, configurationCache) {
|
|
737
718
|
this.configurationCache = configurationCache;
|
|
738
719
|
this.onDidChange = Event.None;
|
|
739
|
-
this.key = { type: 'folder', key: (
|
|
740
|
-
this._folderSettingsModelParser = (
|
|
720
|
+
this.key = { type: 'folder', key: ( hash(( joinPath(folder, configFolderRelativePath).toString())).toString(16)) };
|
|
721
|
+
this._folderSettingsModelParser = ( new ConfigurationModelParser('CachedFolderConfiguration'));
|
|
741
722
|
this._folderSettingsParseOptions = configurationParseOptions;
|
|
742
723
|
this._standAloneConfigurations = [];
|
|
743
|
-
this.configurationModel = (
|
|
724
|
+
this.configurationModel = ( new ConfigurationModel());
|
|
744
725
|
}
|
|
745
726
|
async loadConfiguration() {
|
|
746
727
|
try {
|
|
747
728
|
const contents = await this.configurationCache.read(this.key);
|
|
748
|
-
const { content: configurationContents } = JSON.parse((
|
|
729
|
+
const { content: configurationContents } = JSON.parse(( contents.toString()));
|
|
749
730
|
if (configurationContents) {
|
|
750
|
-
for (const key of (
|
|
731
|
+
for (const key of ( Object.keys(configurationContents))) {
|
|
751
732
|
if (key === FOLDER_SETTINGS_NAME) {
|
|
752
733
|
this._folderSettingsModelParser.parse(configurationContents[key], this._folderSettingsParseOptions);
|
|
753
734
|
}
|
|
754
735
|
else {
|
|
755
|
-
const standAloneConfigurationModelParser = (
|
|
736
|
+
const standAloneConfigurationModelParser = ( new StandaloneConfigurationModelParser(key, key));
|
|
756
737
|
standAloneConfigurationModelParser.parse(configurationContents[key]);
|
|
757
738
|
this._standAloneConfigurations.push(standAloneConfigurationModelParser.configurationModel);
|
|
758
739
|
}
|
|
@@ -774,7 +755,7 @@ class CachedFolderConfiguration {
|
|
|
774
755
|
content[key] = contents;
|
|
775
756
|
}
|
|
776
757
|
});
|
|
777
|
-
if ((
|
|
758
|
+
if (( Object.keys(content)).length) {
|
|
778
759
|
await this.configurationCache.write(this.key, JSON.stringify({ content }));
|
|
779
760
|
}
|
|
780
761
|
else {
|
|
@@ -804,16 +785,16 @@ class FolderConfiguration extends Disposable {
|
|
|
804
785
|
this.workbenchState = workbenchState;
|
|
805
786
|
this.workspaceTrusted = workspaceTrusted;
|
|
806
787
|
this.configurationCache = configurationCache;
|
|
807
|
-
this._onDidChange = this._register((
|
|
788
|
+
this._onDidChange = this._register(( new Emitter()));
|
|
808
789
|
this.onDidChange = this._onDidChange.event;
|
|
809
790
|
this.scopes = 3 === this.workbenchState ? FOLDER_SCOPES : WORKSPACE_SCOPES;
|
|
810
791
|
this.configurationFolder = uriIdentityService.extUri.joinPath(workspaceFolder.uri, configFolderRelativePath);
|
|
811
|
-
this.cachedFolderConfiguration = (
|
|
792
|
+
this.cachedFolderConfiguration = ( new CachedFolderConfiguration(
|
|
812
793
|
workspaceFolder.uri,
|
|
813
794
|
configFolderRelativePath,
|
|
814
795
|
{ scopes: this.scopes, skipRestricted: this.isUntrusted() },
|
|
815
796
|
configurationCache
|
|
816
|
-
))
|
|
797
|
+
));
|
|
817
798
|
if (useCache && this.configurationCache.needsCaching(workspaceFolder.uri)) {
|
|
818
799
|
this.folderConfiguration = this.cachedFolderConfiguration;
|
|
819
800
|
whenProviderRegistered(workspaceFolder.uri, fileService)
|
|
@@ -852,20 +833,10 @@ class FolderConfiguration extends Disposable {
|
|
|
852
833
|
}
|
|
853
834
|
createFileServiceBasedConfiguration(fileService, uriIdentityService, logService) {
|
|
854
835
|
const settingsResource = uriIdentityService.extUri.joinPath(this.configurationFolder, `${FOLDER_SETTINGS_NAME}.json`);
|
|
855
|
-
const standAloneConfigurationResources = (
|
|
836
|
+
const standAloneConfigurationResources = ( [TASKS_CONFIGURATION_KEY, LAUNCH_CONFIGURATION_KEY].map(
|
|
856
837
|
name => ([name, uriIdentityService.extUri.joinPath(this.configurationFolder, `${name}.json`)])
|
|
857
|
-
))
|
|
858
|
-
return (
|
|
859
|
-
(new FileServiceBasedConfiguration(
|
|
860
|
-
(this.configurationFolder.toString()),
|
|
861
|
-
settingsResource,
|
|
862
|
-
standAloneConfigurationResources,
|
|
863
|
-
{ scopes: this.scopes, skipRestricted: this.isUntrusted() },
|
|
864
|
-
fileService,
|
|
865
|
-
uriIdentityService,
|
|
866
|
-
logService
|
|
867
|
-
))
|
|
868
|
-
);
|
|
838
|
+
));
|
|
839
|
+
return ( new FileServiceBasedConfiguration(( this.configurationFolder.toString()), settingsResource, standAloneConfigurationResources, { scopes: this.scopes, skipRestricted: this.isUntrusted() }, fileService, uriIdentityService, logService));
|
|
869
840
|
}
|
|
870
841
|
async updateCache() {
|
|
871
842
|
if (this.configurationCache.needsCaching(this.configurationFolder) && this.folderConfiguration instanceof FileServiceBasedConfiguration) {
|
|
@@ -56,58 +56,58 @@ class WorkspaceService extends Disposable {
|
|
|
56
56
|
this.initialized = false;
|
|
57
57
|
this.applicationConfiguration = null;
|
|
58
58
|
this.remoteUserConfiguration = null;
|
|
59
|
-
this._onDidChangeConfiguration = this._register((
|
|
59
|
+
this._onDidChangeConfiguration = this._register(( new Emitter()));
|
|
60
60
|
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
61
|
-
this._onWillChangeWorkspaceFolders = this._register((
|
|
61
|
+
this._onWillChangeWorkspaceFolders = this._register(( new Emitter()));
|
|
62
62
|
this.onWillChangeWorkspaceFolders = this._onWillChangeWorkspaceFolders.event;
|
|
63
|
-
this._onDidChangeWorkspaceFolders = this._register((
|
|
63
|
+
this._onDidChangeWorkspaceFolders = this._register(( new Emitter()));
|
|
64
64
|
this.onDidChangeWorkspaceFolders = this._onDidChangeWorkspaceFolders.event;
|
|
65
|
-
this._onDidChangeWorkspaceName = this._register((
|
|
65
|
+
this._onDidChangeWorkspaceName = this._register(( new Emitter()));
|
|
66
66
|
this.onDidChangeWorkspaceName = this._onDidChangeWorkspaceName.event;
|
|
67
|
-
this._onDidChangeWorkbenchState = this._register((
|
|
67
|
+
this._onDidChangeWorkbenchState = this._register(( new Emitter()));
|
|
68
68
|
this.onDidChangeWorkbenchState = this._onDidChangeWorkbenchState.event;
|
|
69
69
|
this.isWorkspaceTrusted = true;
|
|
70
70
|
this._restrictedSettings = { default: [] };
|
|
71
|
-
this._onDidChangeRestrictedSettings = this._register((
|
|
71
|
+
this._onDidChangeRestrictedSettings = this._register(( new Emitter()));
|
|
72
72
|
this.onDidChangeRestrictedSettings = this._onDidChangeRestrictedSettings.event;
|
|
73
|
-
this.configurationRegistry = (
|
|
74
|
-
this.initRemoteUserConfigurationBarrier = (
|
|
75
|
-
this.completeWorkspaceBarrier = (
|
|
76
|
-
this.defaultConfiguration = this._register((
|
|
77
|
-
this.policyConfiguration = policyService instanceof NullPolicyService ? (
|
|
73
|
+
this.configurationRegistry = ( Registry.as(Extensions$1.Configuration));
|
|
74
|
+
this.initRemoteUserConfigurationBarrier = ( new Barrier());
|
|
75
|
+
this.completeWorkspaceBarrier = ( new Barrier());
|
|
76
|
+
this.defaultConfiguration = this._register(( new DefaultConfiguration(configurationCache, environmentService)));
|
|
77
|
+
this.policyConfiguration = policyService instanceof NullPolicyService ? ( new NullPolicyConfiguration()) : this._register(( new PolicyConfiguration(this.defaultConfiguration, policyService, logService)));
|
|
78
78
|
this.configurationCache = configurationCache;
|
|
79
|
-
this._configuration = (
|
|
79
|
+
this._configuration = ( new Configuration(
|
|
80
80
|
this.defaultConfiguration.configurationModel,
|
|
81
81
|
this.policyConfiguration.configurationModel,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
82
|
+
( new ConfigurationModel()),
|
|
83
|
+
( new ConfigurationModel()),
|
|
84
|
+
( new ConfigurationModel()),
|
|
85
|
+
( new ConfigurationModel()),
|
|
86
|
+
( new ResourceMap()),
|
|
87
|
+
( new ConfigurationModel()),
|
|
88
|
+
( new ResourceMap()),
|
|
89
89
|
this.workspace
|
|
90
|
-
))
|
|
91
|
-
this.applicationConfigurationDisposables = this._register((
|
|
90
|
+
));
|
|
91
|
+
this.applicationConfigurationDisposables = this._register(( new DisposableStore()));
|
|
92
92
|
this.createApplicationConfiguration();
|
|
93
|
-
this.localUserConfiguration = this._register((
|
|
93
|
+
this.localUserConfiguration = this._register(( new UserConfiguration(
|
|
94
94
|
userDataProfileService.currentProfile.settingsResource,
|
|
95
95
|
userDataProfileService.currentProfile.tasksResource,
|
|
96
96
|
{ scopes: getLocalUserConfigurationScopes(userDataProfileService.currentProfile, !!remoteAuthority) },
|
|
97
97
|
fileService,
|
|
98
98
|
uriIdentityService,
|
|
99
99
|
logService
|
|
100
|
-
)))
|
|
101
|
-
this.cachedFolderConfigs = (
|
|
100
|
+
)));
|
|
101
|
+
this.cachedFolderConfigs = ( new ResourceMap());
|
|
102
102
|
this._register(this.localUserConfiguration.onDidChangeConfiguration(userConfiguration => this.onLocalUserConfigurationChanged(userConfiguration)));
|
|
103
103
|
if (remoteAuthority) {
|
|
104
|
-
const remoteUserConfiguration = this.remoteUserConfiguration = this._register((
|
|
104
|
+
const remoteUserConfiguration = this.remoteUserConfiguration = this._register(( new RemoteUserConfiguration(
|
|
105
105
|
remoteAuthority,
|
|
106
106
|
configurationCache,
|
|
107
107
|
fileService,
|
|
108
108
|
uriIdentityService,
|
|
109
109
|
remoteAgentService
|
|
110
|
-
)))
|
|
110
|
+
)));
|
|
111
111
|
this._register(remoteUserConfiguration.onDidInitialize(remoteUserConfigurationModel => {
|
|
112
112
|
this._register(remoteUserConfiguration.onDidChangeConfiguration(remoteUserConfigurationModel => this.onRemoteUserConfigurationChanged(remoteUserConfigurationModel)));
|
|
113
113
|
this.onRemoteUserConfigurationChanged(remoteUserConfigurationModel);
|
|
@@ -117,7 +117,7 @@ class WorkspaceService extends Disposable {
|
|
|
117
117
|
else {
|
|
118
118
|
this.initRemoteUserConfigurationBarrier.open();
|
|
119
119
|
}
|
|
120
|
-
this.workspaceConfiguration = this._register((
|
|
120
|
+
this.workspaceConfiguration = this._register(( new WorkspaceConfiguration(configurationCache, fileService, uriIdentityService, logService)));
|
|
121
121
|
this._register(this.workspaceConfiguration.onDidUpdateConfiguration(fromCache => {
|
|
122
122
|
this.onWorkspaceConfigurationChanged(fromCache).then(() => {
|
|
123
123
|
this.workspace.initialized = this.workspaceConfiguration.initialized;
|
|
@@ -127,7 +127,7 @@ class WorkspaceService extends Disposable {
|
|
|
127
127
|
this._register(this.defaultConfiguration.onDidChangeConfiguration(({ properties, defaults }) => this.onDefaultConfigurationChanged(defaults, properties)));
|
|
128
128
|
this._register(this.policyConfiguration.onDidChangeConfiguration(configurationModel => this.onPolicyConfigurationChanged(configurationModel)));
|
|
129
129
|
this._register(userDataProfileService.onDidChangeCurrentProfile(e => this.onUserDataProfileChanged(e)));
|
|
130
|
-
this.workspaceEditingQueue = (
|
|
130
|
+
this.workspaceEditingQueue = ( new Queue());
|
|
131
131
|
}
|
|
132
132
|
createApplicationConfiguration() {
|
|
133
133
|
this.applicationConfigurationDisposables.clear();
|
|
@@ -135,7 +135,7 @@ class WorkspaceService extends Disposable {
|
|
|
135
135
|
this.applicationConfiguration = null;
|
|
136
136
|
}
|
|
137
137
|
else {
|
|
138
|
-
this.applicationConfiguration = this.applicationConfigurationDisposables.add(this._register((
|
|
138
|
+
this.applicationConfiguration = this.applicationConfigurationDisposables.add(this._register(( new ApplicationConfiguration(this.userDataProfilesService, this.fileService, this.uriIdentityService))));
|
|
139
139
|
this.applicationConfigurationDisposables.add(this.applicationConfiguration.onDidChangeConfiguration(configurationModel => this.onApplicationConfigurationChanged(configurationModel)));
|
|
140
140
|
}
|
|
141
141
|
}
|
|
@@ -196,7 +196,7 @@ class WorkspaceService extends Disposable {
|
|
|
196
196
|
}
|
|
197
197
|
let foldersHaveChanged = false;
|
|
198
198
|
let currentWorkspaceFolders = this.getWorkspace().folders;
|
|
199
|
-
let newStoredFolders = (
|
|
199
|
+
let newStoredFolders = ( currentWorkspaceFolders.map(f => f.raw)).filter((folder, index) => {
|
|
200
200
|
if (!isStoredWorkspaceFolder(folder)) {
|
|
201
201
|
return true;
|
|
202
202
|
}
|
|
@@ -207,7 +207,7 @@ class WorkspaceService extends Disposable {
|
|
|
207
207
|
const workspaceConfigPath = this.getWorkspace().configuration;
|
|
208
208
|
const workspaceConfigFolder = this.uriIdentityService.extUri.dirname(workspaceConfigPath);
|
|
209
209
|
currentWorkspaceFolders = toWorkspaceFolders(newStoredFolders, workspaceConfigPath, this.uriIdentityService.extUri);
|
|
210
|
-
const currentWorkspaceFolderUris = (
|
|
210
|
+
const currentWorkspaceFolderUris = ( currentWorkspaceFolders.map(folder => folder.uri));
|
|
211
211
|
const storedFoldersToAdd = [];
|
|
212
212
|
for (const folderToAdd of foldersToAdd) {
|
|
213
213
|
const folderURI = folderToAdd.uri;
|
|
@@ -247,9 +247,7 @@ class WorkspaceService extends Disposable {
|
|
|
247
247
|
return this.onWorkspaceConfigurationChanged(false);
|
|
248
248
|
}
|
|
249
249
|
contains(resources, toCheck) {
|
|
250
|
-
return (
|
|
251
|
-
(resources.some(resource => this.uriIdentityService.extUri.isEqual(resource, toCheck)))
|
|
252
|
-
);
|
|
250
|
+
return ( resources.some(resource => this.uriIdentityService.extUri.isEqual(resource, toCheck)));
|
|
253
251
|
}
|
|
254
252
|
getConfigurationData() {
|
|
255
253
|
return this._configuration.toData();
|
|
@@ -278,9 +276,9 @@ class WorkspaceService extends Disposable {
|
|
|
278
276
|
value = undefined;
|
|
279
277
|
}
|
|
280
278
|
}
|
|
281
|
-
await Promises.settled((
|
|
279
|
+
await Promises.settled(( targets.map(
|
|
282
280
|
target => this.writeConfigurationValue(key, value, target, overrides, options)
|
|
283
|
-
)))
|
|
281
|
+
)));
|
|
284
282
|
}
|
|
285
283
|
async reloadConfiguration(target) {
|
|
286
284
|
if (target === undefined) {
|
|
@@ -323,9 +321,7 @@ class WorkspaceService extends Disposable {
|
|
|
323
321
|
return this._configuration.inspect(key, overrides);
|
|
324
322
|
}
|
|
325
323
|
keys() {
|
|
326
|
-
return (
|
|
327
|
-
(this._configuration.keys())
|
|
328
|
-
);
|
|
324
|
+
return ( this._configuration.keys());
|
|
329
325
|
}
|
|
330
326
|
async whenRemoteConfigurationLoaded() {
|
|
331
327
|
await this.initRemoteUserConfigurationBarrier.wait();
|
|
@@ -403,35 +399,35 @@ class WorkspaceService extends Disposable {
|
|
|
403
399
|
const workspaceConfigPath = workspaceIdentifier.configPath;
|
|
404
400
|
const workspaceFolders = toWorkspaceFolders(this.workspaceConfiguration.getFolders(), workspaceConfigPath, this.uriIdentityService.extUri);
|
|
405
401
|
const workspaceId = workspaceIdentifier.id;
|
|
406
|
-
const workspace = (
|
|
402
|
+
const workspace = ( new Workspace(
|
|
407
403
|
workspaceId,
|
|
408
404
|
workspaceFolders,
|
|
409
405
|
this.workspaceConfiguration.isTransient(),
|
|
410
406
|
workspaceConfigPath,
|
|
411
407
|
uri => this.uriIdentityService.extUri.ignorePathCasing(uri)
|
|
412
|
-
))
|
|
408
|
+
));
|
|
413
409
|
workspace.initialized = this.workspaceConfiguration.initialized;
|
|
414
410
|
return workspace;
|
|
415
411
|
}
|
|
416
412
|
createSingleFolderWorkspace(singleFolderWorkspaceIdentifier) {
|
|
417
|
-
const workspace = (
|
|
413
|
+
const workspace = ( new Workspace(
|
|
418
414
|
singleFolderWorkspaceIdentifier.id,
|
|
419
415
|
[toWorkspaceFolder(singleFolderWorkspaceIdentifier.uri)],
|
|
420
416
|
false,
|
|
421
417
|
null,
|
|
422
418
|
uri => this.uriIdentityService.extUri.ignorePathCasing(uri)
|
|
423
|
-
))
|
|
419
|
+
));
|
|
424
420
|
workspace.initialized = true;
|
|
425
421
|
return workspace;
|
|
426
422
|
}
|
|
427
423
|
createEmptyWorkspace(emptyWorkspaceIdentifier) {
|
|
428
|
-
const workspace = (
|
|
424
|
+
const workspace = ( new Workspace(
|
|
429
425
|
emptyWorkspaceIdentifier.id,
|
|
430
426
|
[],
|
|
431
427
|
false,
|
|
432
428
|
null,
|
|
433
429
|
uri => this.uriIdentityService.extUri.ignorePathCasing(uri)
|
|
434
|
-
))
|
|
430
|
+
));
|
|
435
431
|
workspace.initialized = true;
|
|
436
432
|
return Promise.resolve(workspace);
|
|
437
433
|
}
|
|
@@ -477,13 +473,11 @@ class WorkspaceService extends Disposable {
|
|
|
477
473
|
}
|
|
478
474
|
compareFolders(currentFolders, newFolders) {
|
|
479
475
|
const result = { added: [], removed: [], changed: [] };
|
|
480
|
-
result.added = newFolders.filter(newFolder => !(
|
|
481
|
-
currentFolder => ( (newFolder.uri.toString())) === ( (currentFolder.uri.toString()))
|
|
482
|
-
))));
|
|
476
|
+
result.added = newFolders.filter(newFolder => !( currentFolders.some(currentFolder => ( newFolder.uri.toString()) === ( currentFolder.uri.toString()))));
|
|
483
477
|
for (let currentIndex = 0; currentIndex < currentFolders.length; currentIndex++) {
|
|
484
478
|
const currentFolder = currentFolders[currentIndex];
|
|
485
479
|
let newIndex = 0;
|
|
486
|
-
for (newIndex = 0; newIndex < newFolders.length && (
|
|
480
|
+
for (newIndex = 0; newIndex < newFolders.length && ( currentFolder.uri.toString()) !== ( newFolders[newIndex].uri.toString()); newIndex++) { }
|
|
487
481
|
if (newIndex < newFolders.length) {
|
|
488
482
|
if (currentIndex !== newIndex || currentFolder.name !== newFolders[newIndex].name) {
|
|
489
483
|
result.changed.push(currentFolder);
|
|
@@ -498,10 +492,10 @@ class WorkspaceService extends Disposable {
|
|
|
498
492
|
async initializeConfiguration(trigger) {
|
|
499
493
|
await this.defaultConfiguration.initialize();
|
|
500
494
|
const initPolicyConfigurationPromise = this.policyConfiguration.initialize();
|
|
501
|
-
const initApplicationConfigurationPromise = this.applicationConfiguration ? this.applicationConfiguration.initialize() : Promise.resolve((
|
|
495
|
+
const initApplicationConfigurationPromise = this.applicationConfiguration ? this.applicationConfiguration.initialize() : Promise.resolve(( new ConfigurationModel()));
|
|
502
496
|
const initUserConfiguration = async () => {
|
|
503
497
|
mark('code/willInitUserConfiguration');
|
|
504
|
-
const result = await Promise.all([this.localUserConfiguration.initialize(), this.remoteUserConfiguration ? this.remoteUserConfiguration.initialize() : Promise.resolve((
|
|
498
|
+
const result = await Promise.all([this.localUserConfiguration.initialize(), this.remoteUserConfiguration ? this.remoteUserConfiguration.initialize() : Promise.resolve(( new ConfigurationModel()))]);
|
|
505
499
|
if (this.applicationConfiguration) {
|
|
506
500
|
const applicationConfigurationModel = await initApplicationConfigurationPromise;
|
|
507
501
|
result[0] = this.localUserConfiguration.reparse({ exclude: applicationConfigurationModel.getValue(APPLY_ALL_PROFILES_SETTING) });
|
|
@@ -523,9 +517,7 @@ class WorkspaceService extends Disposable {
|
|
|
523
517
|
}
|
|
524
518
|
async reloadApplicationConfiguration(donotTrigger) {
|
|
525
519
|
if (!this.applicationConfiguration) {
|
|
526
|
-
return (
|
|
527
|
-
(new ConfigurationModel())
|
|
528
|
-
);
|
|
520
|
+
return ( new ConfigurationModel());
|
|
529
521
|
}
|
|
530
522
|
const model = await this.applicationConfiguration.loadConfiguration();
|
|
531
523
|
if (!donotTrigger) {
|
|
@@ -552,9 +544,7 @@ class WorkspaceService extends Disposable {
|
|
|
552
544
|
}
|
|
553
545
|
return model;
|
|
554
546
|
}
|
|
555
|
-
return (
|
|
556
|
-
(new ConfigurationModel())
|
|
557
|
-
);
|
|
547
|
+
return ( new ConfigurationModel());
|
|
558
548
|
}
|
|
559
549
|
async reloadWorkspaceConfiguration() {
|
|
560
550
|
const workbenchState = this.getWorkbenchState();
|
|
@@ -569,14 +559,14 @@ class WorkspaceService extends Disposable {
|
|
|
569
559
|
return this.onWorkspaceFolderConfigurationChanged(folder);
|
|
570
560
|
}
|
|
571
561
|
async loadConfiguration(applicationConfigurationModel, userConfigurationModel, remoteUserConfigurationModel, trigger) {
|
|
572
|
-
this.cachedFolderConfigs = (
|
|
562
|
+
this.cachedFolderConfigs = ( new ResourceMap());
|
|
573
563
|
const folders = this.workspace.folders;
|
|
574
564
|
const folderConfigurations = await this.loadFolderConfigurations(folders);
|
|
575
565
|
const workspaceConfiguration = this.getWorkspaceConfigurationModel(folderConfigurations);
|
|
576
|
-
const folderConfigurationModels = (
|
|
566
|
+
const folderConfigurationModels = ( new ResourceMap());
|
|
577
567
|
folderConfigurations.forEach((folderConfiguration, index) => folderConfigurationModels.set(folders[index].uri, folderConfiguration));
|
|
578
568
|
const currentConfiguration = this._configuration;
|
|
579
|
-
this._configuration = (
|
|
569
|
+
this._configuration = ( new Configuration(
|
|
580
570
|
this.defaultConfiguration.configurationModel,
|
|
581
571
|
this.policyConfiguration.configurationModel,
|
|
582
572
|
applicationConfigurationModel,
|
|
@@ -584,10 +574,10 @@ class WorkspaceService extends Disposable {
|
|
|
584
574
|
remoteUserConfigurationModel,
|
|
585
575
|
workspaceConfiguration,
|
|
586
576
|
folderConfigurationModels,
|
|
587
|
-
|
|
588
|
-
|
|
577
|
+
( new ConfigurationModel()),
|
|
578
|
+
( new ResourceMap()),
|
|
589
579
|
this.workspace
|
|
590
|
-
))
|
|
580
|
+
));
|
|
591
581
|
this.initialized = true;
|
|
592
582
|
if (trigger) {
|
|
593
583
|
const change = this._configuration.compare(currentConfiguration);
|
|
@@ -602,9 +592,7 @@ class WorkspaceService extends Disposable {
|
|
|
602
592
|
case 3 :
|
|
603
593
|
return this.workspaceConfiguration.getConfiguration();
|
|
604
594
|
default:
|
|
605
|
-
return (
|
|
606
|
-
(new ConfigurationModel())
|
|
607
|
-
);
|
|
595
|
+
return ( new ConfigurationModel());
|
|
608
596
|
}
|
|
609
597
|
}
|
|
610
598
|
onUserDataProfileChanged(e) {
|
|
@@ -723,7 +711,7 @@ class WorkspaceService extends Disposable {
|
|
|
723
711
|
updateRestrictedSettings() {
|
|
724
712
|
const changed = [];
|
|
725
713
|
const allProperties = this.configurationRegistry.getConfigurationProperties();
|
|
726
|
-
const defaultRestrictedSettings = (
|
|
714
|
+
const defaultRestrictedSettings = ( Object.keys(allProperties)).filter(key => allProperties[key].restricted).sort((a, b) => a.localeCompare(b));
|
|
727
715
|
const defaultDelta = delta(defaultRestrictedSettings, this._restrictedSettings.default, (a, b) => a.localeCompare(b));
|
|
728
716
|
changed.push(...defaultDelta.added, ...defaultDelta.removed);
|
|
729
717
|
const application = (this.applicationConfiguration?.getRestrictedSettings() || []).sort((a, b) => a.localeCompare(b));
|
|
@@ -735,7 +723,7 @@ class WorkspaceService extends Disposable {
|
|
|
735
723
|
const userRemote = (this.remoteUserConfiguration?.getRestrictedSettings() || []).sort((a, b) => a.localeCompare(b));
|
|
736
724
|
const userRemoteDelta = delta(userRemote, this._restrictedSettings.userRemote || [], (a, b) => a.localeCompare(b));
|
|
737
725
|
changed.push(...userRemoteDelta.added, ...userRemoteDelta.removed);
|
|
738
|
-
const workspaceFolderMap = (
|
|
726
|
+
const workspaceFolderMap = ( new ResourceMap());
|
|
739
727
|
for (const workspaceFolder of this.workspace.folders) {
|
|
740
728
|
const cachedFolderConfig = this.cachedFolderConfigs.get(workspaceFolder.uri);
|
|
741
729
|
const folderRestrictedSettings = (cachedFolderConfig?.getRestrictedSettings() || []).sort((a, b) => a.localeCompare(b));
|
|
@@ -807,15 +795,15 @@ class WorkspaceService extends Disposable {
|
|
|
807
795
|
}
|
|
808
796
|
async onFoldersChanged() {
|
|
809
797
|
const changes = [];
|
|
810
|
-
for (const key of (
|
|
811
|
-
if (!this.workspace.folders.filter(folder => (
|
|
798
|
+
for (const key of ( this.cachedFolderConfigs.keys())) {
|
|
799
|
+
if (!this.workspace.folders.filter(folder => ( folder.uri.toString()) === ( key.toString()))[0]) {
|
|
812
800
|
const folderConfiguration = this.cachedFolderConfigs.get(key);
|
|
813
801
|
folderConfiguration.dispose();
|
|
814
802
|
this.cachedFolderConfigs.delete(key);
|
|
815
803
|
changes.push(this._configuration.compareAndDeleteFolderConfiguration(key));
|
|
816
804
|
}
|
|
817
805
|
}
|
|
818
|
-
const toInitialize = this.workspace.folders.filter(folder => !(
|
|
806
|
+
const toInitialize = this.workspace.folders.filter(folder => !( this.cachedFolderConfigs.has(folder.uri)));
|
|
819
807
|
if (toInitialize.length) {
|
|
820
808
|
const folderConfigurations = await this.loadFolderConfigurations(toInitialize);
|
|
821
809
|
folderConfigurations.forEach((folderConfiguration, index) => {
|
|
@@ -825,10 +813,10 @@ class WorkspaceService extends Disposable {
|
|
|
825
813
|
return mergeChanges(...changes);
|
|
826
814
|
}
|
|
827
815
|
loadFolderConfigurations(folders) {
|
|
828
|
-
return Promise.all([...(
|
|
816
|
+
return Promise.all([...( folders.map(folder => {
|
|
829
817
|
let folderConfiguration = this.cachedFolderConfigs.get(folder.uri);
|
|
830
818
|
if (!folderConfiguration) {
|
|
831
|
-
folderConfiguration = (
|
|
819
|
+
folderConfiguration = ( new FolderConfiguration(
|
|
832
820
|
!this.initialized,
|
|
833
821
|
folder,
|
|
834
822
|
FOLDER_CONFIG_FOLDER_NAME,
|
|
@@ -838,12 +826,12 @@ class WorkspaceService extends Disposable {
|
|
|
838
826
|
this.uriIdentityService,
|
|
839
827
|
this.logService,
|
|
840
828
|
this.configurationCache
|
|
841
|
-
))
|
|
829
|
+
));
|
|
842
830
|
this._register(folderConfiguration.onDidChange(() => this.onWorkspaceFolderConfigurationChanged(folder)));
|
|
843
831
|
this.cachedFolderConfigs.set(folder.uri, this._register(folderConfiguration));
|
|
844
832
|
}
|
|
845
833
|
return folderConfiguration.loadConfiguration();
|
|
846
|
-
}))
|
|
834
|
+
}))]);
|
|
847
835
|
}
|
|
848
836
|
async validateWorkspaceFoldersAndReload(fromCache) {
|
|
849
837
|
const validWorkspaceFolders = await this.toValidWorkspaceFolders(this.workspace.folders);
|
|
@@ -862,7 +850,7 @@ class WorkspaceService extends Disposable {
|
|
|
862
850
|
}
|
|
863
851
|
}
|
|
864
852
|
catch (e) {
|
|
865
|
-
this.logService.warn(`Ignoring the error while validating workspace folder ${(
|
|
853
|
+
this.logService.warn(`Ignoring the error while validating workspace folder ${( workspaceFolder.uri.toString())} - ${toErrorMessage(e)}`);
|
|
866
854
|
}
|
|
867
855
|
validWorkspaceFolders.push(workspaceFolder);
|
|
868
856
|
}
|
|
@@ -878,7 +866,7 @@ class WorkspaceService extends Disposable {
|
|
|
878
866
|
if (target === 8 ) {
|
|
879
867
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
880
868
|
this._configuration.updateValue(key, value, overrides);
|
|
881
|
-
this.triggerConfigurationChange({ keys: overrides?.overrideIdentifiers?.length ? [keyFromOverrideIdentifiers(overrides.overrideIdentifiers), key] : [key], overrides: overrides?.overrideIdentifiers?.length ? (
|
|
869
|
+
this.triggerConfigurationChange({ keys: overrides?.overrideIdentifiers?.length ? [keyFromOverrideIdentifiers(overrides.overrideIdentifiers), key] : [key], overrides: overrides?.overrideIdentifiers?.length ? ( overrides.overrideIdentifiers.map(overrideIdentifier => ([overrideIdentifier, [key]]))) : [] }, previous, target);
|
|
882
870
|
return;
|
|
883
871
|
}
|
|
884
872
|
const editableConfigurationTarget = this.toEditableConfigurationTarget(target, key);
|
|
@@ -938,7 +926,7 @@ class WorkspaceService extends Disposable {
|
|
|
938
926
|
if (target !== 7 ) {
|
|
939
927
|
this.logService.debug(`Configuration keys changed in ${ConfigurationTargetToString(target)} target`, ...change.keys);
|
|
940
928
|
}
|
|
941
|
-
const configurationChangeEvent = (
|
|
929
|
+
const configurationChangeEvent = ( new ConfigurationChangeEvent(change, previous, this._configuration, this.workspace));
|
|
942
930
|
configurationChangeEvent.source = target;
|
|
943
931
|
configurationChangeEvent.sourceConfig = this.getTargetConfiguration(target);
|
|
944
932
|
this._onDidChangeConfiguration.fire(configurationChangeEvent);
|
|
@@ -991,8 +979,8 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
991
979
|
this.workspaceTrustManagementService = workspaceTrustManagementService;
|
|
992
980
|
extensionService.whenInstalledExtensionsRegistered().then(() => {
|
|
993
981
|
this.registerConfigurationSchemas();
|
|
994
|
-
const configurationRegistry = (
|
|
995
|
-
const delayer = this._register((
|
|
982
|
+
const configurationRegistry = ( Registry.as(Extensions$1.Configuration));
|
|
983
|
+
const delayer = this._register(( new Delayer(50)));
|
|
996
984
|
this._register(Event.any(configurationRegistry.onDidUpdateConfiguration, configurationRegistry.onDidSchemaChange, workspaceTrustManagementService.onDidChangeTrust)(() => delayer.trigger(() => this.registerConfigurationSchemas(), lifecycleService.phase === 4 ? undefined : 2500 )));
|
|
997
985
|
});
|
|
998
986
|
}
|
|
@@ -1035,11 +1023,11 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1035
1023
|
allowComments: true
|
|
1036
1024
|
};
|
|
1037
1025
|
const defaultSettingsSchema = {
|
|
1038
|
-
properties: (
|
|
1026
|
+
properties: ( Object.keys(allSettings.properties)).reduce((result, key) => {
|
|
1039
1027
|
result[key] = Object.assign({ deprecationMessage: undefined }, allSettings.properties[key]);
|
|
1040
1028
|
return result;
|
|
1041
1029
|
}, {}),
|
|
1042
|
-
patternProperties: (
|
|
1030
|
+
patternProperties: ( Object.keys(allSettings.patternProperties)).reduce((result, key) => {
|
|
1043
1031
|
result[key] = Object.assign({ deprecationMessage: undefined }, allSettings.patternProperties[key]);
|
|
1044
1032
|
return result;
|
|
1045
1033
|
}, {}),
|
|
@@ -1057,10 +1045,10 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1057
1045
|
} : workspaceSettingsSchema;
|
|
1058
1046
|
const configDefaultsSchema = {
|
|
1059
1047
|
type: 'object',
|
|
1060
|
-
description: (
|
|
1048
|
+
description: ( localize(
|
|
1061
1049
|
'configurationDefaults.description',
|
|
1062
1050
|
'Contribute defaults for configurations'
|
|
1063
|
-
))
|
|
1051
|
+
)),
|
|
1064
1052
|
properties: Object.assign({}, machineOverridableSettings.properties, windowSettings.properties, resourceSettings.properties),
|
|
1065
1053
|
patternProperties: {
|
|
1066
1054
|
[OVERRIDE_PROPERTY_PATTERN]: {
|
|
@@ -1082,7 +1070,7 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1082
1070
|
});
|
|
1083
1071
|
}
|
|
1084
1072
|
registerSchemas(schemas) {
|
|
1085
|
-
const jsonRegistry = (
|
|
1073
|
+
const jsonRegistry = ( Registry.as(Extensions$2.JSONContribution));
|
|
1086
1074
|
jsonRegistry.registerSchema(defaultSettingsSchemaId, schemas.defaultSettingsSchema);
|
|
1087
1075
|
jsonRegistry.registerSchema(userSettingsSchemaId, schemas.userSettingsSchema);
|
|
1088
1076
|
jsonRegistry.registerSchema(profileSettingsSchemaId, schemas.profileSettingsSchema);
|
|
@@ -1104,20 +1092,20 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1104
1092
|
return result;
|
|
1105
1093
|
}
|
|
1106
1094
|
};
|
|
1107
|
-
RegisterConfigurationSchemasContribution = (
|
|
1108
|
-
(
|
|
1109
|
-
(
|
|
1110
|
-
(
|
|
1111
|
-
(
|
|
1112
|
-
(
|
|
1113
|
-
], RegisterConfigurationSchemasContribution))
|
|
1095
|
+
RegisterConfigurationSchemasContribution = ( __decorate([
|
|
1096
|
+
( __param(0, IWorkspaceContextService)),
|
|
1097
|
+
( __param(1, IWorkbenchEnvironmentService)),
|
|
1098
|
+
( __param(2, IWorkspaceTrustManagementService)),
|
|
1099
|
+
( __param(3, IExtensionService)),
|
|
1100
|
+
( __param(4, ILifecycleService))
|
|
1101
|
+
], RegisterConfigurationSchemasContribution));
|
|
1114
1102
|
let UpdateExperimentalSettingsDefaults = class UpdateExperimentalSettingsDefaults extends Disposable {
|
|
1115
1103
|
constructor(workbenchAssignmentService) {
|
|
1116
1104
|
super();
|
|
1117
1105
|
this.workbenchAssignmentService = workbenchAssignmentService;
|
|
1118
|
-
this.processedExperimentalSettings = (
|
|
1119
|
-
this.configurationRegistry = (
|
|
1120
|
-
this.processExperimentalSettings((
|
|
1106
|
+
this.processedExperimentalSettings = ( new Set());
|
|
1107
|
+
this.configurationRegistry = ( Registry.as(Extensions$1.Configuration));
|
|
1108
|
+
this.processExperimentalSettings(( Object.keys(this.configurationRegistry.getConfigurationProperties())));
|
|
1121
1109
|
this._register(this.configurationRegistry.onDidUpdateConfiguration(({ properties }) => this.processExperimentalSettings(properties)));
|
|
1122
1110
|
}
|
|
1123
1111
|
async processExperimentalSettings(properties) {
|
|
@@ -1128,7 +1116,7 @@ let UpdateExperimentalSettingsDefaults = class UpdateExperimentalSettingsDefault
|
|
|
1128
1116
|
if (!schema?.tags?.includes('experimental')) {
|
|
1129
1117
|
continue;
|
|
1130
1118
|
}
|
|
1131
|
-
if ((
|
|
1119
|
+
if (( this.processedExperimentalSettings.has(property))) {
|
|
1132
1120
|
continue;
|
|
1133
1121
|
}
|
|
1134
1122
|
this.processedExperimentalSettings.add(property);
|
|
@@ -1140,27 +1128,27 @@ let UpdateExperimentalSettingsDefaults = class UpdateExperimentalSettingsDefault
|
|
|
1140
1128
|
}
|
|
1141
1129
|
catch (error) { }
|
|
1142
1130
|
}
|
|
1143
|
-
if ((
|
|
1144
|
-
this.configurationRegistry.registerDefaultConfigurations([{ overrides, source: (
|
|
1131
|
+
if (( Object.keys(overrides)).length) {
|
|
1132
|
+
this.configurationRegistry.registerDefaultConfigurations([{ overrides, source: ( localize('experimental', "Experiments")) }]);
|
|
1145
1133
|
}
|
|
1146
1134
|
}
|
|
1147
1135
|
};
|
|
1148
|
-
UpdateExperimentalSettingsDefaults = (
|
|
1149
|
-
(
|
|
1150
|
-
], UpdateExperimentalSettingsDefaults))
|
|
1151
|
-
const workbenchContributionsRegistry = (
|
|
1136
|
+
UpdateExperimentalSettingsDefaults = ( __decorate([
|
|
1137
|
+
( __param(0, IWorkbenchAssignmentService))
|
|
1138
|
+
], UpdateExperimentalSettingsDefaults));
|
|
1139
|
+
const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
|
|
1152
1140
|
workbenchContributionsRegistry.registerWorkbenchContribution(RegisterConfigurationSchemasContribution, 3 );
|
|
1153
1141
|
workbenchContributionsRegistry.registerWorkbenchContribution(UpdateExperimentalSettingsDefaults, 3 );
|
|
1154
|
-
const configurationRegistry = (
|
|
1142
|
+
const configurationRegistry = ( Registry.as(Extensions$1.Configuration));
|
|
1155
1143
|
configurationRegistry.registerConfiguration({
|
|
1156
1144
|
...workbenchConfigurationNodeBase,
|
|
1157
1145
|
properties: {
|
|
1158
1146
|
[APPLY_ALL_PROFILES_SETTING]: {
|
|
1159
1147
|
'type': 'array',
|
|
1160
|
-
description: (
|
|
1148
|
+
description: ( localize(
|
|
1161
1149
|
'setting description',
|
|
1162
1150
|
"Configure settings to be applied for all profiles."
|
|
1163
|
-
))
|
|
1151
|
+
)),
|
|
1164
1152
|
'default': [],
|
|
1165
1153
|
'scope': 1 ,
|
|
1166
1154
|
additionalProperties: true,
|