@codingame/monaco-vscode-configuration-service-override 5.3.0 → 6.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/package.json +3 -3
- package/vscode/src/vs/editor/common/services/textResourceConfigurationService.js +11 -10
- package/vscode/src/vs/workbench/api/common/configurationExtensionPoint.js +9 -9
- package/vscode/src/vs/workbench/contrib/workspaces/browser/workspaces.contribution.js +8 -6
- package/vscode/src/vs/workbench/services/configuration/browser/configuration.js +16 -15
- package/vscode/src/vs/workbench/services/configuration/browser/configurationService.js +87 -80
- package/vscode/src/vs/workbench/services/configuration/common/configurationCache.js +2 -1
- package/vscode/src/vs/workbench/services/configuration/common/configurationEditing.js +96 -70
- package/vscode/src/vs/workbench/services/label/common/labelService.js +16 -12
- package/vscode/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.js +6 -4
- package/vscode/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.js +13 -11
- package/vscode/src/vs/workbench/services/workspaces/browser/workspacesService.js +11 -8
|
@@ -6,22 +6,23 @@ import { equals } from 'vscode/vscode/vs/base/common/objects';
|
|
|
6
6
|
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
7
|
import { Barrier, Queue, Promises, Delayer } from 'vscode/vscode/vs/base/common/async';
|
|
8
8
|
import { Extensions as Extensions$1 } from 'vscode/vscode/vs/platform/jsonschemas/common/jsonContributionRegistry';
|
|
9
|
-
import { Workspace as Workspace$1, isWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceFolder, toWorkspaceFolder } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
9
|
+
import { Workspace as Workspace$1, WorkbenchState, isWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceFolder, toWorkspaceFolder } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
10
10
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
11
11
|
import { ConfigurationModel, mergeChanges, ConfigurationChangeEvent } from 'vscode/vscode/vs/platform/configuration/common/configurationModels';
|
|
12
|
-
import { isConfigurationOverrides, isConfigurationUpdateOverrides, ConfigurationTargetToString } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
12
|
+
import { isConfigurationOverrides, isConfigurationUpdateOverrides, ConfigurationTarget, ConfigurationTargetToString } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
13
13
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
14
14
|
import { NullPolicyConfiguration, PolicyConfiguration } from 'vscode/vscode/vs/platform/configuration/common/configurations';
|
|
15
15
|
import { Configuration } from '../common/configurationModels.js';
|
|
16
16
|
import { LOCAL_MACHINE_SCOPES, LOCAL_MACHINE_PROFILE_SCOPES, PROFILE_SCOPES, APPLY_ALL_PROFILES_SETTING, FOLDER_CONFIG_FOLDER_NAME, defaultSettingsSchemaId, userSettingsSchemaId, profileSettingsSchemaId, machineSettingsSchemaId, workspaceSettingsSchemaId, folderSettingsSchemaId } from 'vscode/vscode/vs/workbench/services/configuration/common/configuration';
|
|
17
17
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
18
|
-
import { Extensions, keyFromOverrideIdentifiers, allSettings, applicationSettings, windowSettings, resourceSettings, machineSettings, machineOverridableSettings, OVERRIDE_PROPERTY_PATTERN, resourceLanguageSettingsSchemaId, configurationDefaultsSchemaId } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
18
|
+
import { Extensions, ConfigurationScope, keyFromOverrideIdentifiers, allSettings, applicationSettings, windowSettings, resourceSettings, machineSettings, machineOverridableSettings, OVERRIDE_PROPERTY_PATTERN, resourceLanguageSettingsSchemaId, configurationDefaultsSchemaId } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
19
19
|
import { isStoredWorkspaceFolder, toWorkspaceFolders, getStoredWorkspaceFolder } from 'vscode/vscode/vs/platform/workspaces/common/workspaces';
|
|
20
|
-
import { ConfigurationEditing } from '../common/configurationEditing.js';
|
|
20
|
+
import { EditableConfigurationTarget, ConfigurationEditing } from '../common/configurationEditing.js';
|
|
21
21
|
import { DefaultConfiguration, UserConfiguration, RemoteUserConfiguration, WorkspaceConfiguration, ApplicationConfiguration, FolderConfiguration } from './configuration.js';
|
|
22
22
|
import { mark } from 'vscode/vscode/vs/base/common/performance';
|
|
23
23
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
24
|
-
import { Extensions as Extensions$2, registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
24
|
+
import { Extensions as Extensions$2, registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
25
|
+
import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
25
26
|
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
26
27
|
import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
|
|
27
28
|
import { IWorkspaceTrustManagementService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust.service';
|
|
@@ -160,12 +161,12 @@ class WorkspaceService extends Disposable {
|
|
|
160
161
|
}
|
|
161
162
|
getWorkbenchState() {
|
|
162
163
|
if (this.workspace.configuration) {
|
|
163
|
-
return
|
|
164
|
+
return WorkbenchState.WORKSPACE;
|
|
164
165
|
}
|
|
165
166
|
if (this.workspace.folders.length === 1) {
|
|
166
|
-
return
|
|
167
|
+
return WorkbenchState.FOLDER;
|
|
167
168
|
}
|
|
168
|
-
return
|
|
169
|
+
return WorkbenchState.EMPTY;
|
|
169
170
|
}
|
|
170
171
|
getWorkspaceFolder(resource) {
|
|
171
172
|
return this.workspace.getFolder(resource);
|
|
@@ -184,7 +185,7 @@ class WorkspaceService extends Disposable {
|
|
|
184
185
|
}
|
|
185
186
|
isCurrentWorkspace(workspaceIdOrFolder) {
|
|
186
187
|
switch (this.getWorkbenchState()) {
|
|
187
|
-
case
|
|
188
|
+
case WorkbenchState.FOLDER: {
|
|
188
189
|
let folderUri = undefined;
|
|
189
190
|
if (URI.isUri(workspaceIdOrFolder)) {
|
|
190
191
|
folderUri = workspaceIdOrFolder;
|
|
@@ -194,13 +195,13 @@ class WorkspaceService extends Disposable {
|
|
|
194
195
|
}
|
|
195
196
|
return URI.isUri(folderUri) && this.uriIdentityService.extUri.isEqual(folderUri, this.workspace.folders[0].uri);
|
|
196
197
|
}
|
|
197
|
-
case
|
|
198
|
+
case WorkbenchState.WORKSPACE:
|
|
198
199
|
return isWorkspaceIdentifier(workspaceIdOrFolder) && this.workspace.id === workspaceIdOrFolder.id;
|
|
199
200
|
}
|
|
200
201
|
return false;
|
|
201
202
|
}
|
|
202
203
|
async doUpdateFolders(foldersToAdd, foldersToRemove, index) {
|
|
203
|
-
if (this.getWorkbenchState() !==
|
|
204
|
+
if (this.getWorkbenchState() !== WorkbenchState.WORKSPACE) {
|
|
204
205
|
return Promise.resolve(undefined);
|
|
205
206
|
}
|
|
206
207
|
if (foldersToAdd.length + foldersToRemove.length === 0) {
|
|
@@ -290,7 +291,7 @@ class WorkspaceService extends Disposable {
|
|
|
290
291
|
}
|
|
291
292
|
const inspect = this.inspect(key, { resource: overrides?.resource, overrideIdentifier: overrides?.overrideIdentifiers ? overrides.overrideIdentifiers[0] : undefined });
|
|
292
293
|
targets.push(...this.deriveConfigurationTargets(key, value, inspect));
|
|
293
|
-
if (equals(value, inspect.defaultValue) && targets.length === 1 && (
|
|
294
|
+
if (equals(value, inspect.defaultValue) && targets.length === 1 && (targets[0] === ConfigurationTarget.USER || targets[0] === ConfigurationTarget.USER_LOCAL)) {
|
|
294
295
|
value = undefined;
|
|
295
296
|
}
|
|
296
297
|
}
|
|
@@ -312,22 +313,22 @@ class WorkspaceService extends Disposable {
|
|
|
312
313
|
return;
|
|
313
314
|
}
|
|
314
315
|
switch (target) {
|
|
315
|
-
case
|
|
316
|
+
case ConfigurationTarget.DEFAULT:
|
|
316
317
|
this.reloadDefaultConfiguration();
|
|
317
318
|
return;
|
|
318
|
-
case
|
|
319
|
+
case ConfigurationTarget.USER: {
|
|
319
320
|
const { local, remote } = await this.reloadUserConfiguration();
|
|
320
321
|
await this.loadConfiguration(this._configuration.applicationConfiguration, local, remote, true);
|
|
321
322
|
return;
|
|
322
323
|
}
|
|
323
|
-
case
|
|
324
|
+
case ConfigurationTarget.USER_LOCAL:
|
|
324
325
|
await this.reloadLocalUserConfiguration();
|
|
325
326
|
return;
|
|
326
|
-
case
|
|
327
|
+
case ConfigurationTarget.USER_REMOTE:
|
|
327
328
|
await this.reloadRemoteUserConfiguration();
|
|
328
329
|
return;
|
|
329
|
-
case
|
|
330
|
-
case
|
|
330
|
+
case ConfigurationTarget.WORKSPACE:
|
|
331
|
+
case ConfigurationTarget.WORKSPACE_FOLDER:
|
|
331
332
|
await this.reloadWorkspaceConfiguration();
|
|
332
333
|
return;
|
|
333
334
|
}
|
|
@@ -369,7 +370,7 @@ class WorkspaceService extends Disposable {
|
|
|
369
370
|
}
|
|
370
371
|
folderConfigurationModels.push(configurationModel);
|
|
371
372
|
}
|
|
372
|
-
if (this.getWorkbenchState() ===
|
|
373
|
+
if (this.getWorkbenchState() === WorkbenchState.FOLDER) {
|
|
373
374
|
if (folderConfigurationModels[0]) {
|
|
374
375
|
this._configuration.updateWorkspaceConfiguration(folderConfigurationModels[0]);
|
|
375
376
|
}
|
|
@@ -391,7 +392,7 @@ class WorkspaceService extends Disposable {
|
|
|
391
392
|
this.restrictedSettings.workspaceFolder?.forEach((value) => keys.push(...value));
|
|
392
393
|
keys = distinct(keys);
|
|
393
394
|
if (keys.length) {
|
|
394
|
-
this.triggerConfigurationChange({ keys, overrides: [] }, { data, workspace: this.workspace },
|
|
395
|
+
this.triggerConfigurationChange({ keys, overrides: [] }, { data, workspace: this.workspace }, ConfigurationTarget.WORKSPACE);
|
|
395
396
|
}
|
|
396
397
|
}
|
|
397
398
|
}
|
|
@@ -399,7 +400,7 @@ class WorkspaceService extends Disposable {
|
|
|
399
400
|
this.instantiationService = instantiationService;
|
|
400
401
|
}
|
|
401
402
|
isSettingAppliedForAllProfiles(key) {
|
|
402
|
-
if (this.configurationRegistry.getConfigurationProperties()[key]?.scope ===
|
|
403
|
+
if (this.configurationRegistry.getConfigurationProperties()[key]?.scope === ConfigurationScope.APPLICATION) {
|
|
403
404
|
return true;
|
|
404
405
|
}
|
|
405
406
|
const allProfilesSettings = this.getValue(APPLY_ALL_PROFILES_SETTING) ?? [];
|
|
@@ -570,10 +571,10 @@ class WorkspaceService extends Disposable {
|
|
|
570
571
|
}
|
|
571
572
|
async reloadWorkspaceConfiguration() {
|
|
572
573
|
const workbenchState = this.getWorkbenchState();
|
|
573
|
-
if (workbenchState ===
|
|
574
|
+
if (workbenchState === WorkbenchState.FOLDER) {
|
|
574
575
|
return this.onWorkspaceFolderConfigurationChanged(this.workspace.folders[0]);
|
|
575
576
|
}
|
|
576
|
-
if (workbenchState ===
|
|
577
|
+
if (workbenchState === WorkbenchState.WORKSPACE) {
|
|
577
578
|
return this.workspaceConfiguration.reload().then(() => this.onWorkspaceConfigurationChanged(false));
|
|
578
579
|
}
|
|
579
580
|
}
|
|
@@ -604,15 +605,15 @@ class WorkspaceService extends Disposable {
|
|
|
604
605
|
this.initialized = true;
|
|
605
606
|
if (trigger) {
|
|
606
607
|
const change = this._configuration.compare(currentConfiguration);
|
|
607
|
-
this.triggerConfigurationChange(change, { data: currentConfiguration.toData(), workspace: this.workspace },
|
|
608
|
+
this.triggerConfigurationChange(change, { data: currentConfiguration.toData(), workspace: this.workspace }, ConfigurationTarget.WORKSPACE);
|
|
608
609
|
}
|
|
609
610
|
this.updateRestrictedSettings();
|
|
610
611
|
}
|
|
611
612
|
getWorkspaceConfigurationModel(folderConfigurations) {
|
|
612
613
|
switch (this.getWorkbenchState()) {
|
|
613
|
-
case
|
|
614
|
+
case WorkbenchState.FOLDER:
|
|
614
615
|
return folderConfigurations[0];
|
|
615
|
-
case
|
|
616
|
+
case WorkbenchState.WORKSPACE:
|
|
616
617
|
return this.workspaceConfiguration.getConfiguration();
|
|
617
618
|
default:
|
|
618
619
|
return ConfigurationModel.createEmptyModel(this.logService);
|
|
@@ -648,7 +649,7 @@ class WorkspaceService extends Disposable {
|
|
|
648
649
|
this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse());
|
|
649
650
|
this._configuration.updateRemoteUserConfiguration(this.remoteUserConfiguration.reparse());
|
|
650
651
|
}
|
|
651
|
-
if (this.getWorkbenchState() ===
|
|
652
|
+
if (this.getWorkbenchState() === WorkbenchState.FOLDER) {
|
|
652
653
|
const folderConfiguration = this.cachedFolderConfigs.get(this.workspace.folders[0].uri);
|
|
653
654
|
if (folderConfiguration) {
|
|
654
655
|
this._configuration.updateWorkspaceConfiguration(folderConfiguration.reparse());
|
|
@@ -664,14 +665,14 @@ class WorkspaceService extends Disposable {
|
|
|
664
665
|
}
|
|
665
666
|
}
|
|
666
667
|
}
|
|
667
|
-
this.triggerConfigurationChange(change, { data: previousData, workspace: this.workspace },
|
|
668
|
+
this.triggerConfigurationChange(change, { data: previousData, workspace: this.workspace }, ConfigurationTarget.DEFAULT);
|
|
668
669
|
this.updateRestrictedSettings();
|
|
669
670
|
}
|
|
670
671
|
}
|
|
671
672
|
onPolicyConfigurationChanged(policyConfiguration) {
|
|
672
673
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
673
674
|
const change = this._configuration.compareAndUpdatePolicyConfiguration(policyConfiguration);
|
|
674
|
-
this.triggerConfigurationChange(change, previous,
|
|
675
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.DEFAULT);
|
|
675
676
|
}
|
|
676
677
|
onApplicationConfigurationChanged(applicationConfiguration) {
|
|
677
678
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
@@ -681,7 +682,7 @@ class WorkspaceService extends Disposable {
|
|
|
681
682
|
const configurationProperties = this.configurationRegistry.getConfigurationProperties();
|
|
682
683
|
const changedKeys = [];
|
|
683
684
|
for (const changedKey of change.keys) {
|
|
684
|
-
if (configurationProperties[changedKey]?.scope ===
|
|
685
|
+
if (configurationProperties[changedKey]?.scope === ConfigurationScope.APPLICATION) {
|
|
685
686
|
changedKeys.push(changedKey);
|
|
686
687
|
if (changedKey === APPLY_ALL_PROFILES_SETTING) {
|
|
687
688
|
for (const previousAllProfileSetting of previousAllProfilesSettings) {
|
|
@@ -704,17 +705,17 @@ class WorkspaceService extends Disposable {
|
|
|
704
705
|
if (change.keys.includes(APPLY_ALL_PROFILES_SETTING)) {
|
|
705
706
|
this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse({ exclude: currentAllProfilesSettings }));
|
|
706
707
|
}
|
|
707
|
-
this.triggerConfigurationChange(change, previous,
|
|
708
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.USER);
|
|
708
709
|
}
|
|
709
710
|
onLocalUserConfigurationChanged(userConfiguration) {
|
|
710
711
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
711
712
|
const change = this._configuration.compareAndUpdateLocalUserConfiguration(userConfiguration);
|
|
712
|
-
this.triggerConfigurationChange(change, previous,
|
|
713
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.USER);
|
|
713
714
|
}
|
|
714
715
|
onRemoteUserConfigurationChanged(userConfiguration) {
|
|
715
716
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
716
717
|
const change = this._configuration.compareAndUpdateRemoteUserConfiguration(userConfiguration);
|
|
717
|
-
this.triggerConfigurationChange(change, previous,
|
|
718
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.USER);
|
|
718
719
|
}
|
|
719
720
|
async onWorkspaceConfigurationChanged(fromCache) {
|
|
720
721
|
if (this.workspace && this.workspace.configuration) {
|
|
@@ -757,7 +758,7 @@ class WorkspaceService extends Disposable {
|
|
|
757
758
|
const workspaceFolderDelta = delta(folderRestrictedSettings, previous, (a, b) => a.localeCompare(b));
|
|
758
759
|
changed.push(...workspaceFolderDelta.added, ...workspaceFolderDelta.removed);
|
|
759
760
|
}
|
|
760
|
-
const workspace = this.getWorkbenchState() ===
|
|
761
|
+
const workspace = this.getWorkbenchState() === WorkbenchState.WORKSPACE ? this.workspaceConfiguration.getRestrictedSettings().sort((a, b) => a.localeCompare(b))
|
|
761
762
|
: this.workspace.folders[0] ? (workspaceFolderMap.get(this.workspace.folders[0].uri) || []) : [];
|
|
762
763
|
const workspaceDelta = delta(workspace, this._restrictedSettings.workspace || [], (a, b) => a.localeCompare(b));
|
|
763
764
|
changed.push(...workspaceDelta.added, ...workspaceDelta.removed);
|
|
@@ -781,11 +782,11 @@ class WorkspaceService extends Disposable {
|
|
|
781
782
|
this.workspace.folders = workspaceFolders;
|
|
782
783
|
const change = await this.onFoldersChanged();
|
|
783
784
|
await this.handleWillChangeWorkspaceFolders(changes, fromCache);
|
|
784
|
-
this.triggerConfigurationChange(change, previous,
|
|
785
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.WORKSPACE_FOLDER);
|
|
785
786
|
this._onDidChangeWorkspaceFolders.fire(changes);
|
|
786
787
|
}
|
|
787
788
|
else {
|
|
788
|
-
this.triggerConfigurationChange(change, previous,
|
|
789
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.WORKSPACE);
|
|
789
790
|
}
|
|
790
791
|
this.updateRestrictedSettings();
|
|
791
792
|
}
|
|
@@ -807,12 +808,12 @@ class WorkspaceService extends Disposable {
|
|
|
807
808
|
const [folderConfiguration] = await this.loadFolderConfigurations([folder]);
|
|
808
809
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
809
810
|
const folderConfigurationChange = this._configuration.compareAndUpdateFolderConfiguration(folder.uri, folderConfiguration);
|
|
810
|
-
if (this.getWorkbenchState() ===
|
|
811
|
+
if (this.getWorkbenchState() === WorkbenchState.FOLDER) {
|
|
811
812
|
const workspaceConfigurationChange = this._configuration.compareAndUpdateWorkspaceConfiguration(folderConfiguration);
|
|
812
|
-
this.triggerConfigurationChange(mergeChanges(folderConfigurationChange, workspaceConfigurationChange), previous,
|
|
813
|
+
this.triggerConfigurationChange(mergeChanges(folderConfigurationChange, workspaceConfigurationChange), previous, ConfigurationTarget.WORKSPACE);
|
|
813
814
|
}
|
|
814
815
|
else {
|
|
815
|
-
this.triggerConfigurationChange(folderConfigurationChange, previous,
|
|
816
|
+
this.triggerConfigurationChange(folderConfigurationChange, previous, ConfigurationTarget.WORKSPACE_FOLDER);
|
|
816
817
|
}
|
|
817
818
|
this.updateRestrictedSettings();
|
|
818
819
|
}
|
|
@@ -885,10 +886,10 @@ class WorkspaceService extends Disposable {
|
|
|
885
886
|
'Cannot write configuration because the configuration service is not yet ready to accept writes.'
|
|
886
887
|
)));
|
|
887
888
|
}
|
|
888
|
-
if (target ===
|
|
889
|
+
if (target === ConfigurationTarget.DEFAULT) {
|
|
889
890
|
throw ( (new Error('Invalid configuration target')));
|
|
890
891
|
}
|
|
891
|
-
if (target ===
|
|
892
|
+
if (target === ConfigurationTarget.MEMORY) {
|
|
892
893
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
893
894
|
this._configuration.updateValue(key, value, overrides);
|
|
894
895
|
this.triggerConfigurationChange({ keys: overrides?.overrideIdentifiers?.length ? [keyFromOverrideIdentifiers(overrides.overrideIdentifiers), key] : [key], overrides: overrides?.overrideIdentifiers?.length ? ( (overrides.overrideIdentifiers.map(overrideIdentifier => ([overrideIdentifier, [key]])))) : [] }, previous, target);
|
|
@@ -898,7 +899,7 @@ class WorkspaceService extends Disposable {
|
|
|
898
899
|
if (!editableConfigurationTarget) {
|
|
899
900
|
throw ( (new Error('Invalid configuration target')));
|
|
900
901
|
}
|
|
901
|
-
if (editableConfigurationTarget ===
|
|
902
|
+
if (editableConfigurationTarget === EditableConfigurationTarget.USER_REMOTE && !this.remoteUserConfiguration) {
|
|
902
903
|
throw ( (new Error('Invalid configuration target')));
|
|
903
904
|
}
|
|
904
905
|
if (overrides?.overrideIdentifiers?.length && overrides.overrideIdentifiers.length > 1) {
|
|
@@ -914,7 +915,7 @@ class WorkspaceService extends Disposable {
|
|
|
914
915
|
this.configurationEditing = this.configurationEditing ?? this.createConfigurationEditingService(this.instantiationService);
|
|
915
916
|
await (await this.configurationEditing).writeConfiguration(editableConfigurationTarget, { key, value }, { scopes: overrides, ...options });
|
|
916
917
|
switch (editableConfigurationTarget) {
|
|
917
|
-
case
|
|
918
|
+
case EditableConfigurationTarget.USER_LOCAL:
|
|
918
919
|
if (this.applicationConfiguration && this.isSettingAppliedForAllProfiles(key)) {
|
|
919
920
|
await this.reloadApplicationConfiguration();
|
|
920
921
|
}
|
|
@@ -922,11 +923,11 @@ class WorkspaceService extends Disposable {
|
|
|
922
923
|
await this.reloadLocalUserConfiguration();
|
|
923
924
|
}
|
|
924
925
|
return;
|
|
925
|
-
case
|
|
926
|
+
case EditableConfigurationTarget.USER_REMOTE:
|
|
926
927
|
return this.reloadRemoteUserConfiguration().then(() => undefined);
|
|
927
|
-
case
|
|
928
|
+
case EditableConfigurationTarget.WORKSPACE:
|
|
928
929
|
return this.reloadWorkspaceConfiguration();
|
|
929
|
-
case
|
|
930
|
+
case EditableConfigurationTarget.WORKSPACE_FOLDER: {
|
|
930
931
|
const workspaceFolder = overrides && overrides.resource ? this.workspace.getFolder(overrides.resource) : null;
|
|
931
932
|
if (workspaceFolder) {
|
|
932
933
|
return this.reloadWorkspaceFolderConfiguration(workspaceFolder);
|
|
@@ -940,18 +941,18 @@ class WorkspaceService extends Disposable {
|
|
|
940
941
|
}
|
|
941
942
|
getConfigurationModelForEditableConfigurationTarget(target, resource) {
|
|
942
943
|
switch (target) {
|
|
943
|
-
case
|
|
944
|
-
case
|
|
945
|
-
case
|
|
946
|
-
case
|
|
944
|
+
case EditableConfigurationTarget.USER_LOCAL: return this._configuration.localUserConfiguration;
|
|
945
|
+
case EditableConfigurationTarget.USER_REMOTE: return this._configuration.remoteUserConfiguration;
|
|
946
|
+
case EditableConfigurationTarget.WORKSPACE: return this._configuration.workspaceConfiguration;
|
|
947
|
+
case EditableConfigurationTarget.WORKSPACE_FOLDER: return resource ? this._configuration.folderConfigurations.get(resource) : undefined;
|
|
947
948
|
}
|
|
948
949
|
}
|
|
949
950
|
getConfigurationModel(target, resource) {
|
|
950
951
|
switch (target) {
|
|
951
|
-
case
|
|
952
|
-
case
|
|
953
|
-
case
|
|
954
|
-
case
|
|
952
|
+
case ConfigurationTarget.USER_LOCAL: return this._configuration.localUserConfiguration;
|
|
953
|
+
case ConfigurationTarget.USER_REMOTE: return this._configuration.remoteUserConfiguration;
|
|
954
|
+
case ConfigurationTarget.WORKSPACE: return this._configuration.workspaceConfiguration;
|
|
955
|
+
case ConfigurationTarget.WORKSPACE_FOLDER: return resource ? this._configuration.folderConfigurations.get(resource) : undefined;
|
|
955
956
|
default: return undefined;
|
|
956
957
|
}
|
|
957
958
|
}
|
|
@@ -961,25 +962,28 @@ class WorkspaceService extends Disposable {
|
|
|
961
962
|
}
|
|
962
963
|
const definedTargets = [];
|
|
963
964
|
if (inspect.workspaceFolderValue !== undefined) {
|
|
964
|
-
definedTargets.push(
|
|
965
|
+
definedTargets.push(ConfigurationTarget.WORKSPACE_FOLDER);
|
|
965
966
|
}
|
|
966
967
|
if (inspect.workspaceValue !== undefined) {
|
|
967
|
-
definedTargets.push(
|
|
968
|
+
definedTargets.push(ConfigurationTarget.WORKSPACE);
|
|
968
969
|
}
|
|
969
970
|
if (inspect.userRemoteValue !== undefined) {
|
|
970
|
-
definedTargets.push(
|
|
971
|
+
definedTargets.push(ConfigurationTarget.USER_REMOTE);
|
|
971
972
|
}
|
|
972
973
|
if (inspect.userLocalValue !== undefined) {
|
|
973
|
-
definedTargets.push(
|
|
974
|
+
definedTargets.push(ConfigurationTarget.USER_LOCAL);
|
|
975
|
+
}
|
|
976
|
+
if (inspect.applicationValue !== undefined) {
|
|
977
|
+
definedTargets.push(ConfigurationTarget.APPLICATION);
|
|
974
978
|
}
|
|
975
979
|
if (value === undefined) {
|
|
976
980
|
return definedTargets;
|
|
977
981
|
}
|
|
978
|
-
return [definedTargets[0] ||
|
|
982
|
+
return [definedTargets[0] || ConfigurationTarget.USER];
|
|
979
983
|
}
|
|
980
984
|
triggerConfigurationChange(change, previous, target) {
|
|
981
985
|
if (change.keys.length) {
|
|
982
|
-
if (target !==
|
|
986
|
+
if (target !== ConfigurationTarget.DEFAULT) {
|
|
983
987
|
this.logService.debug(`Configuration keys changed in ${ConfigurationTargetToString(target)} target`, ...change.keys);
|
|
984
988
|
}
|
|
985
989
|
const configurationChangeEvent = ( (new ConfigurationChangeEvent(change, previous, this._configuration, this.workspace, this.logService)));
|
|
@@ -988,29 +992,32 @@ class WorkspaceService extends Disposable {
|
|
|
988
992
|
}
|
|
989
993
|
}
|
|
990
994
|
toEditableConfigurationTarget(target, key) {
|
|
991
|
-
if (target ===
|
|
995
|
+
if (target === ConfigurationTarget.APPLICATION) {
|
|
996
|
+
return EditableConfigurationTarget.USER_LOCAL;
|
|
997
|
+
}
|
|
998
|
+
if (target === ConfigurationTarget.USER) {
|
|
992
999
|
if (this.remoteUserConfiguration) {
|
|
993
1000
|
const scope = this.configurationRegistry.getConfigurationProperties()[key]?.scope;
|
|
994
|
-
if (scope ===
|
|
995
|
-
return
|
|
1001
|
+
if (scope === ConfigurationScope.MACHINE || scope === ConfigurationScope.MACHINE_OVERRIDABLE) {
|
|
1002
|
+
return EditableConfigurationTarget.USER_REMOTE;
|
|
996
1003
|
}
|
|
997
1004
|
if (this.inspect(key).userRemoteValue !== undefined) {
|
|
998
|
-
return
|
|
1005
|
+
return EditableConfigurationTarget.USER_REMOTE;
|
|
999
1006
|
}
|
|
1000
1007
|
}
|
|
1001
|
-
return
|
|
1008
|
+
return EditableConfigurationTarget.USER_LOCAL;
|
|
1002
1009
|
}
|
|
1003
|
-
if (target ===
|
|
1004
|
-
return
|
|
1010
|
+
if (target === ConfigurationTarget.USER_LOCAL) {
|
|
1011
|
+
return EditableConfigurationTarget.USER_LOCAL;
|
|
1005
1012
|
}
|
|
1006
|
-
if (target ===
|
|
1007
|
-
return
|
|
1013
|
+
if (target === ConfigurationTarget.USER_REMOTE) {
|
|
1014
|
+
return EditableConfigurationTarget.USER_REMOTE;
|
|
1008
1015
|
}
|
|
1009
|
-
if (target ===
|
|
1010
|
-
return
|
|
1016
|
+
if (target === ConfigurationTarget.WORKSPACE) {
|
|
1017
|
+
return EditableConfigurationTarget.WORKSPACE;
|
|
1011
1018
|
}
|
|
1012
|
-
if (target ===
|
|
1013
|
-
return
|
|
1019
|
+
if (target === ConfigurationTarget.WORKSPACE_FOLDER) {
|
|
1020
|
+
return EditableConfigurationTarget.WORKSPACE_FOLDER;
|
|
1014
1021
|
}
|
|
1015
1022
|
return null;
|
|
1016
1023
|
}
|
|
@@ -1025,7 +1032,7 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1025
1032
|
this.registerConfigurationSchemas();
|
|
1026
1033
|
const configurationRegistry = ( (Registry.as(Extensions.Configuration)));
|
|
1027
1034
|
const delayer = this._register(( (new Delayer(50))));
|
|
1028
|
-
this._register(Event.any(configurationRegistry.onDidUpdateConfiguration, configurationRegistry.onDidSchemaChange, workspaceTrustManagementService.onDidChangeTrust)(() => delayer.trigger(() => this.registerConfigurationSchemas(), lifecycleService.phase ===
|
|
1035
|
+
this._register(Event.any(configurationRegistry.onDidUpdateConfiguration, configurationRegistry.onDidSchemaChange, workspaceTrustManagementService.onDidChangeTrust)(() => delayer.trigger(() => this.registerConfigurationSchemas(), lifecycleService.phase === LifecyclePhase.Eventually ? undefined : 2500 )));
|
|
1029
1036
|
});
|
|
1030
1037
|
}
|
|
1031
1038
|
registerConfigurationSchemas() {
|
|
@@ -1079,7 +1086,7 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1079
1086
|
allowTrailingCommas: true,
|
|
1080
1087
|
allowComments: true
|
|
1081
1088
|
};
|
|
1082
|
-
const folderSettingsSchema =
|
|
1089
|
+
const folderSettingsSchema = WorkbenchState.WORKSPACE === this.workspaceContextService.getWorkbenchState() ?
|
|
1083
1090
|
{
|
|
1084
1091
|
properties: Object.assign({}, this.checkAndFilterPropertiesRequiringTrust(machineOverridableSettings.properties), this.checkAndFilterPropertiesRequiringTrust(resourceSettings.properties)),
|
|
1085
1092
|
patternProperties: allSettings.patternProperties,
|
|
@@ -1144,7 +1151,7 @@ let ResetConfigurationDefaultsOverridesCache = class ResetConfigurationDefaultsO
|
|
|
1144
1151
|
constructor(configurationService, extensionService) {
|
|
1145
1152
|
super();
|
|
1146
1153
|
if (configurationService.hasCachedConfigurationDefaultsOverrides()) {
|
|
1147
|
-
extensionService.whenInstalledExtensionsRegistered().then(() => configurationService.reloadConfiguration(
|
|
1154
|
+
extensionService.whenInstalledExtensionsRegistered().then(() => configurationService.reloadConfiguration(ConfigurationTarget.DEFAULT));
|
|
1148
1155
|
}
|
|
1149
1156
|
}
|
|
1150
1157
|
};
|
|
@@ -1191,9 +1198,9 @@ UpdateExperimentalSettingsDefaults = ( (__decorate([
|
|
|
1191
1198
|
( (__param(0, IWorkbenchAssignmentService)))
|
|
1192
1199
|
], UpdateExperimentalSettingsDefaults)));
|
|
1193
1200
|
const workbenchContributionsRegistry = ( (Registry.as(Extensions$2.Workbench)));
|
|
1194
|
-
workbenchContributionsRegistry.registerWorkbenchContribution(RegisterConfigurationSchemasContribution,
|
|
1195
|
-
workbenchContributionsRegistry.registerWorkbenchContribution(ResetConfigurationDefaultsOverridesCache,
|
|
1196
|
-
registerWorkbenchContribution2(UpdateExperimentalSettingsDefaults.ID, UpdateExperimentalSettingsDefaults,
|
|
1201
|
+
workbenchContributionsRegistry.registerWorkbenchContribution(RegisterConfigurationSchemasContribution, LifecyclePhase.Restored);
|
|
1202
|
+
workbenchContributionsRegistry.registerWorkbenchContribution(ResetConfigurationDefaultsOverridesCache, LifecyclePhase.Eventually);
|
|
1203
|
+
registerWorkbenchContribution2(UpdateExperimentalSettingsDefaults.ID, UpdateExperimentalSettingsDefaults, WorkbenchPhase.BlockRestore);
|
|
1197
1204
|
const configurationRegistry = ( (Registry.as(Extensions.Configuration)));
|
|
1198
1205
|
configurationRegistry.registerConfiguration({
|
|
1199
1206
|
...workbenchConfigurationNodeBase,
|
|
@@ -1202,7 +1209,7 @@ configurationRegistry.registerConfiguration({
|
|
|
1202
1209
|
'type': 'array',
|
|
1203
1210
|
description: ( localizeWithPath(_moduleId, 2, "Configure settings to be applied for all profiles.")),
|
|
1204
1211
|
'default': [],
|
|
1205
|
-
'scope':
|
|
1212
|
+
'scope': ConfigurationScope.APPLICATION,
|
|
1206
1213
|
additionalProperties: true,
|
|
1207
1214
|
uniqueItems: true,
|
|
1208
1215
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FileOperationResult } from 'vscode/vscode/vs/platform/files/common/files';
|
|
1
2
|
import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
2
3
|
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
3
4
|
import { Queue } from 'vscode/vscode/vs/base/common/async';
|
|
@@ -60,7 +61,7 @@ class CachedConfiguration {
|
|
|
60
61
|
await this.queue.queue(() => this.fileService.del(this.cachedConfigurationFolderResource, { recursive: true, useTrash: false }));
|
|
61
62
|
}
|
|
62
63
|
catch (error) {
|
|
63
|
-
if (error.fileOperationResult !==
|
|
64
|
+
if (error.fileOperationResult !== FileOperationResult.FILE_NOT_FOUND) {
|
|
64
65
|
throw error;
|
|
65
66
|
}
|
|
66
67
|
}
|