@codingame/monaco-vscode-configuration-service-override 11.1.2 → 12.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +29 -2
- package/index.js +138 -1
- package/package.json +27 -8
- package/vscode/src/vs/editor/common/services/textResourceConfigurationService.d.ts +26 -0
- package/vscode/src/vs/editor/common/services/textResourceConfigurationService.js +13 -11
- package/vscode/src/vs/workbench/api/common/configurationExtensionPoint.d.ts +1 -0
- package/vscode/src/vs/workbench/api/common/configurationExtensionPoint.js +82 -79
- package/vscode/src/vs/workbench/contrib/workspaces/browser/workspaces.contribution.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/workspaces/browser/workspaces.contribution.js +31 -32
- package/vscode/src/vs/workbench/services/configuration/browser/configuration.d.ts +130 -0
- package/vscode/src/vs/workbench/services/configuration/browser/configuration.js +18 -16
- package/vscode/src/vs/workbench/services/configuration/browser/configurationService.d.ts +144 -0
- package/vscode/src/vs/workbench/services/configuration/browser/configurationService.js +182 -186
- package/vscode/src/vs/workbench/services/configuration/common/configurationCache.d.ts +16 -0
- package/vscode/src/vs/workbench/services/configuration/common/configurationCache.js +3 -1
- package/vscode/src/vs/workbench/services/configuration/common/configurationEditing.d.ts +86 -0
- package/vscode/src/vs/workbench/services/configuration/common/configurationEditing.js +219 -194
- package/vscode/src/vs/workbench/services/configuration/common/configurationModels.d.ts +43 -0
- package/vscode/src/vs/workbench/services/configuration/common/configurationModels.js +1 -0
- package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.d.ts +37 -0
- package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +30 -26
- package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.d.ts +13 -0
- package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +3 -1
- package/vscode/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.d.ts +16 -0
- package/vscode/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.js +8 -5
- package/vscode/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.d.ts +64 -0
- package/vscode/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.js +54 -53
- package/vscode/src/vs/workbench/services/workspaces/browser/workspacesService.d.ts +39 -0
- package/vscode/src/vs/workbench/services/workspaces/browser/workspacesService.js +15 -11
- package/configuration.js +0 -138
- package/tools.js +0 -44
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
3
4
|
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
4
5
|
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
@@ -6,22 +7,23 @@ import { equals } from 'vscode/vscode/vs/base/common/objects';
|
|
|
6
7
|
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
8
|
import { Barrier, Queue, Promises, Delayer } from 'vscode/vscode/vs/base/common/async';
|
|
8
9
|
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';
|
|
10
|
+
import { Workspace as Workspace$1, WorkbenchState, isWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceFolder, toWorkspaceFolder } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
10
11
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
11
12
|
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';
|
|
13
|
+
import { isConfigurationOverrides, isConfigurationUpdateOverrides, ConfigurationTarget, ConfigurationTargetToString } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
13
14
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
14
15
|
import { NullPolicyConfiguration, PolicyConfiguration } from 'vscode/vscode/vs/platform/configuration/common/configurations';
|
|
15
16
|
import { Configuration } from '../common/configurationModels.js';
|
|
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
|
+
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 '@codingame/monaco-vscode-37e80bf5-92f5-5e4c-8b6d-98e0bb89dbef-common/vscode/vs/workbench/services/configuration/common/configuration';
|
|
17
18
|
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';
|
|
19
|
-
import { isStoredWorkspaceFolder, toWorkspaceFolders, getStoredWorkspaceFolder } from 'vscode/vscode/vs/platform/workspaces/common/workspaces';
|
|
20
|
-
import { ConfigurationEditing } from '../common/configurationEditing.js';
|
|
19
|
+
import { Extensions, ConfigurationScope, keyFromOverrideIdentifiers, allSettings, applicationSettings, windowSettings, resourceSettings, machineSettings, machineOverridableSettings, OVERRIDE_PROPERTY_PATTERN, resourceLanguageSettingsSchemaId, configurationDefaultsSchemaId } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
20
|
+
import { isStoredWorkspaceFolder, toWorkspaceFolders, getStoredWorkspaceFolder } from '@codingame/monaco-vscode-56402b83-4a60-5b15-86f9-71fe99c32744-common/vscode/vs/platform/workspaces/common/workspaces';
|
|
21
|
+
import { EditableConfigurationTarget, ConfigurationEditing } from '../common/configurationEditing.js';
|
|
21
22
|
import { DefaultConfiguration, UserConfiguration, RemoteUserConfiguration, WorkspaceConfiguration, ApplicationConfiguration, FolderConfiguration } from './configuration.js';
|
|
22
23
|
import { mark } from 'vscode/vscode/vs/base/common/performance';
|
|
23
24
|
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';
|
|
25
|
+
import { Extensions as Extensions$2, registerWorkbenchContribution2, WorkbenchPhase } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
26
|
+
import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
25
27
|
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
26
28
|
import { toErrorMessage } from 'vscode/vscode/vs/base/common/errorMessage';
|
|
27
29
|
import { IWorkspaceTrustManagementService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust.service';
|
|
@@ -60,60 +62,60 @@ class WorkspaceService extends Disposable {
|
|
|
60
62
|
this.initialized = false;
|
|
61
63
|
this.applicationConfiguration = null;
|
|
62
64
|
this.remoteUserConfiguration = null;
|
|
63
|
-
this._onDidChangeConfiguration = this._register((
|
|
65
|
+
this._onDidChangeConfiguration = this._register(( new Emitter()));
|
|
64
66
|
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
65
|
-
this._onWillChangeWorkspaceFolders = this._register((
|
|
67
|
+
this._onWillChangeWorkspaceFolders = this._register(( new Emitter()));
|
|
66
68
|
this.onWillChangeWorkspaceFolders = this._onWillChangeWorkspaceFolders.event;
|
|
67
|
-
this._onDidChangeWorkspaceFolders = this._register((
|
|
69
|
+
this._onDidChangeWorkspaceFolders = this._register(( new Emitter()));
|
|
68
70
|
this.onDidChangeWorkspaceFolders = this._onDidChangeWorkspaceFolders.event;
|
|
69
|
-
this._onDidChangeWorkspaceName = this._register((
|
|
71
|
+
this._onDidChangeWorkspaceName = this._register(( new Emitter()));
|
|
70
72
|
this.onDidChangeWorkspaceName = this._onDidChangeWorkspaceName.event;
|
|
71
|
-
this._onDidChangeWorkbenchState = this._register((
|
|
73
|
+
this._onDidChangeWorkbenchState = this._register(( new Emitter()));
|
|
72
74
|
this.onDidChangeWorkbenchState = this._onDidChangeWorkbenchState.event;
|
|
73
75
|
this.isWorkspaceTrusted = true;
|
|
74
76
|
this._restrictedSettings = { default: [] };
|
|
75
|
-
this._onDidChangeRestrictedSettings = this._register((
|
|
77
|
+
this._onDidChangeRestrictedSettings = this._register(( new Emitter()));
|
|
76
78
|
this.onDidChangeRestrictedSettings = this._onDidChangeRestrictedSettings.event;
|
|
77
|
-
this.configurationRegistry = (
|
|
78
|
-
this.initRemoteUserConfigurationBarrier = (
|
|
79
|
-
this.completeWorkspaceBarrier = (
|
|
80
|
-
this.defaultConfiguration = this._register((
|
|
81
|
-
this.policyConfiguration = policyService instanceof NullPolicyService ? (
|
|
79
|
+
this.configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
80
|
+
this.initRemoteUserConfigurationBarrier = ( new Barrier());
|
|
81
|
+
this.completeWorkspaceBarrier = ( new Barrier());
|
|
82
|
+
this.defaultConfiguration = this._register(( new DefaultConfiguration(configurationCache, environmentService, logService)));
|
|
83
|
+
this.policyConfiguration = policyService instanceof NullPolicyService ? ( new NullPolicyConfiguration()) : this._register(( new PolicyConfiguration(this.defaultConfiguration, policyService, logService)));
|
|
82
84
|
this.configurationCache = configurationCache;
|
|
83
|
-
this._configuration = (
|
|
85
|
+
this._configuration = ( new Configuration(
|
|
84
86
|
this.defaultConfiguration.configurationModel,
|
|
85
87
|
this.policyConfiguration.configurationModel,
|
|
86
88
|
ConfigurationModel.createEmptyModel(logService),
|
|
87
89
|
ConfigurationModel.createEmptyModel(logService),
|
|
88
90
|
ConfigurationModel.createEmptyModel(logService),
|
|
89
91
|
ConfigurationModel.createEmptyModel(logService),
|
|
90
|
-
|
|
92
|
+
( new ResourceMap()),
|
|
91
93
|
ConfigurationModel.createEmptyModel(logService),
|
|
92
|
-
|
|
94
|
+
( new ResourceMap()),
|
|
93
95
|
this.workspace,
|
|
94
96
|
logService
|
|
95
|
-
))
|
|
96
|
-
this.applicationConfigurationDisposables = this._register((
|
|
97
|
+
));
|
|
98
|
+
this.applicationConfigurationDisposables = this._register(( new DisposableStore()));
|
|
97
99
|
this.createApplicationConfiguration();
|
|
98
|
-
this.localUserConfiguration = this._register((
|
|
100
|
+
this.localUserConfiguration = this._register(( new UserConfiguration(
|
|
99
101
|
userDataProfileService.currentProfile.settingsResource,
|
|
100
102
|
userDataProfileService.currentProfile.tasksResource,
|
|
101
103
|
{ scopes: getLocalUserConfigurationScopes(userDataProfileService.currentProfile, !!remoteAuthority) },
|
|
102
104
|
fileService,
|
|
103
105
|
uriIdentityService,
|
|
104
106
|
logService
|
|
105
|
-
)))
|
|
106
|
-
this.cachedFolderConfigs = (
|
|
107
|
+
)));
|
|
108
|
+
this.cachedFolderConfigs = ( new ResourceMap());
|
|
107
109
|
this._register(this.localUserConfiguration.onDidChangeConfiguration(userConfiguration => this.onLocalUserConfigurationChanged(userConfiguration)));
|
|
108
110
|
if (remoteAuthority) {
|
|
109
|
-
const remoteUserConfiguration = this.remoteUserConfiguration = this._register((
|
|
111
|
+
const remoteUserConfiguration = this.remoteUserConfiguration = this._register(( new RemoteUserConfiguration(
|
|
110
112
|
remoteAuthority,
|
|
111
113
|
configurationCache,
|
|
112
114
|
fileService,
|
|
113
115
|
uriIdentityService,
|
|
114
116
|
remoteAgentService,
|
|
115
117
|
logService
|
|
116
|
-
)))
|
|
118
|
+
)));
|
|
117
119
|
this._register(remoteUserConfiguration.onDidInitialize(remoteUserConfigurationModel => {
|
|
118
120
|
this._register(remoteUserConfiguration.onDidChangeConfiguration(remoteUserConfigurationModel => this.onRemoteUserConfigurationChanged(remoteUserConfigurationModel)));
|
|
119
121
|
this.onRemoteUserConfigurationChanged(remoteUserConfigurationModel);
|
|
@@ -123,7 +125,7 @@ class WorkspaceService extends Disposable {
|
|
|
123
125
|
else {
|
|
124
126
|
this.initRemoteUserConfigurationBarrier.open();
|
|
125
127
|
}
|
|
126
|
-
this.workspaceConfiguration = this._register((
|
|
128
|
+
this.workspaceConfiguration = this._register(( new WorkspaceConfiguration(configurationCache, fileService, uriIdentityService, logService)));
|
|
127
129
|
this._register(this.workspaceConfiguration.onDidUpdateConfiguration(fromCache => {
|
|
128
130
|
this.onWorkspaceConfigurationChanged(fromCache).then(() => {
|
|
129
131
|
this.workspace.initialized = this.workspaceConfiguration.initialized;
|
|
@@ -133,7 +135,7 @@ class WorkspaceService extends Disposable {
|
|
|
133
135
|
this._register(this.defaultConfiguration.onDidChangeConfiguration(({ properties, defaults }) => this.onDefaultConfigurationChanged(defaults, properties)));
|
|
134
136
|
this._register(this.policyConfiguration.onDidChangeConfiguration(configurationModel => this.onPolicyConfigurationChanged(configurationModel)));
|
|
135
137
|
this._register(userDataProfileService.onDidChangeCurrentProfile(e => this.onUserDataProfileChanged(e)));
|
|
136
|
-
this.workspaceEditingQueue = (
|
|
138
|
+
this.workspaceEditingQueue = ( new Queue());
|
|
137
139
|
}
|
|
138
140
|
createApplicationConfiguration() {
|
|
139
141
|
this.applicationConfigurationDisposables.clear();
|
|
@@ -141,12 +143,12 @@ class WorkspaceService extends Disposable {
|
|
|
141
143
|
this.applicationConfiguration = null;
|
|
142
144
|
}
|
|
143
145
|
else {
|
|
144
|
-
this.applicationConfiguration = this.applicationConfigurationDisposables.add(this._register((
|
|
146
|
+
this.applicationConfiguration = this.applicationConfigurationDisposables.add(this._register(( new ApplicationConfiguration(
|
|
145
147
|
this.userDataProfilesService,
|
|
146
148
|
this.fileService,
|
|
147
149
|
this.uriIdentityService,
|
|
148
150
|
this.logService
|
|
149
|
-
))))
|
|
151
|
+
))));
|
|
150
152
|
this.applicationConfigurationDisposables.add(this.applicationConfiguration.onDidChangeConfiguration(configurationModel => this.onApplicationConfigurationChanged(configurationModel)));
|
|
151
153
|
}
|
|
152
154
|
}
|
|
@@ -159,12 +161,12 @@ class WorkspaceService extends Disposable {
|
|
|
159
161
|
}
|
|
160
162
|
getWorkbenchState() {
|
|
161
163
|
if (this.workspace.configuration) {
|
|
162
|
-
return
|
|
164
|
+
return WorkbenchState.WORKSPACE;
|
|
163
165
|
}
|
|
164
166
|
if (this.workspace.folders.length === 1) {
|
|
165
|
-
return
|
|
167
|
+
return WorkbenchState.FOLDER;
|
|
166
168
|
}
|
|
167
|
-
return
|
|
169
|
+
return WorkbenchState.EMPTY;
|
|
168
170
|
}
|
|
169
171
|
getWorkspaceFolder(resource) {
|
|
170
172
|
return this.workspace.getFolder(resource);
|
|
@@ -183,7 +185,7 @@ class WorkspaceService extends Disposable {
|
|
|
183
185
|
}
|
|
184
186
|
isCurrentWorkspace(workspaceIdOrFolder) {
|
|
185
187
|
switch (this.getWorkbenchState()) {
|
|
186
|
-
case
|
|
188
|
+
case WorkbenchState.FOLDER: {
|
|
187
189
|
let folderUri = undefined;
|
|
188
190
|
if (URI.isUri(workspaceIdOrFolder)) {
|
|
189
191
|
folderUri = workspaceIdOrFolder;
|
|
@@ -193,13 +195,13 @@ class WorkspaceService extends Disposable {
|
|
|
193
195
|
}
|
|
194
196
|
return URI.isUri(folderUri) && this.uriIdentityService.extUri.isEqual(folderUri, this.workspace.folders[0].uri);
|
|
195
197
|
}
|
|
196
|
-
case
|
|
198
|
+
case WorkbenchState.WORKSPACE:
|
|
197
199
|
return isWorkspaceIdentifier(workspaceIdOrFolder) && this.workspace.id === workspaceIdOrFolder.id;
|
|
198
200
|
}
|
|
199
201
|
return false;
|
|
200
202
|
}
|
|
201
203
|
async doUpdateFolders(foldersToAdd, foldersToRemove, index) {
|
|
202
|
-
if (this.getWorkbenchState() !==
|
|
204
|
+
if (this.getWorkbenchState() !== WorkbenchState.WORKSPACE) {
|
|
203
205
|
return Promise.resolve(undefined);
|
|
204
206
|
}
|
|
205
207
|
if (foldersToAdd.length + foldersToRemove.length === 0) {
|
|
@@ -207,7 +209,7 @@ class WorkspaceService extends Disposable {
|
|
|
207
209
|
}
|
|
208
210
|
let foldersHaveChanged = false;
|
|
209
211
|
let currentWorkspaceFolders = this.getWorkspace().folders;
|
|
210
|
-
let newStoredFolders = (
|
|
212
|
+
let newStoredFolders = ( currentWorkspaceFolders.map(f => f.raw)).filter((folder, index) => {
|
|
211
213
|
if (!isStoredWorkspaceFolder(folder)) {
|
|
212
214
|
return true;
|
|
213
215
|
}
|
|
@@ -218,7 +220,7 @@ class WorkspaceService extends Disposable {
|
|
|
218
220
|
const workspaceConfigPath = this.getWorkspace().configuration;
|
|
219
221
|
const workspaceConfigFolder = this.uriIdentityService.extUri.dirname(workspaceConfigPath);
|
|
220
222
|
currentWorkspaceFolders = toWorkspaceFolders(newStoredFolders, workspaceConfigPath, this.uriIdentityService.extUri);
|
|
221
|
-
const currentWorkspaceFolderUris = (
|
|
223
|
+
const currentWorkspaceFolderUris = ( currentWorkspaceFolders.map(folder => folder.uri));
|
|
222
224
|
const storedFoldersToAdd = [];
|
|
223
225
|
for (const folderToAdd of foldersToAdd) {
|
|
224
226
|
const folderURI = folderToAdd.uri;
|
|
@@ -252,17 +254,15 @@ class WorkspaceService extends Disposable {
|
|
|
252
254
|
}
|
|
253
255
|
async setFolders(folders) {
|
|
254
256
|
if (!this.instantiationService) {
|
|
255
|
-
throw (
|
|
257
|
+
throw ( new Error(
|
|
256
258
|
'Cannot update workspace folders because workspace service is not yet ready to accept writes.'
|
|
257
|
-
))
|
|
259
|
+
));
|
|
258
260
|
}
|
|
259
261
|
await this.instantiationService.invokeFunction(accessor => this.workspaceConfiguration.setFolders(folders, accessor.get(IJSONEditingService)));
|
|
260
262
|
return this.onWorkspaceConfigurationChanged(false);
|
|
261
263
|
}
|
|
262
264
|
contains(resources, toCheck) {
|
|
263
|
-
return (
|
|
264
|
-
(resources.some(resource => this.uriIdentityService.extUri.isEqual(resource, toCheck)))
|
|
265
|
-
);
|
|
265
|
+
return ( resources.some(resource => this.uriIdentityService.extUri.isEqual(resource, toCheck)));
|
|
266
266
|
}
|
|
267
267
|
getConfigurationData() {
|
|
268
268
|
return this._configuration.toData();
|
|
@@ -283,19 +283,19 @@ class WorkspaceService extends Disposable {
|
|
|
283
283
|
}
|
|
284
284
|
if (!targets.length) {
|
|
285
285
|
if (overrides?.overrideIdentifiers && overrides.overrideIdentifiers.length > 1) {
|
|
286
|
-
throw (
|
|
286
|
+
throw ( new Error(
|
|
287
287
|
'Configuration Target is required while updating the value for multiple override identifiers'
|
|
288
|
-
))
|
|
288
|
+
));
|
|
289
289
|
}
|
|
290
290
|
const inspect = this.inspect(key, { resource: overrides?.resource, overrideIdentifier: overrides?.overrideIdentifiers ? overrides.overrideIdentifiers[0] : undefined });
|
|
291
291
|
targets.push(...this.deriveConfigurationTargets(key, value, inspect));
|
|
292
|
-
if (equals(value, inspect.defaultValue) && targets.length === 1 && (
|
|
292
|
+
if (equals(value, inspect.defaultValue) && targets.length === 1 && (targets[0] === ConfigurationTarget.USER || targets[0] === ConfigurationTarget.USER_LOCAL)) {
|
|
293
293
|
value = undefined;
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
await Promises.settled((
|
|
296
|
+
await Promises.settled(( targets.map(
|
|
297
297
|
target => this.writeConfigurationValue(key, value, target, overrides, options)
|
|
298
|
-
)))
|
|
298
|
+
)));
|
|
299
299
|
}
|
|
300
300
|
async reloadConfiguration(target) {
|
|
301
301
|
if (target === undefined) {
|
|
@@ -311,22 +311,22 @@ class WorkspaceService extends Disposable {
|
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
313
|
switch (target) {
|
|
314
|
-
case
|
|
314
|
+
case ConfigurationTarget.DEFAULT:
|
|
315
315
|
this.reloadDefaultConfiguration();
|
|
316
316
|
return;
|
|
317
|
-
case
|
|
317
|
+
case ConfigurationTarget.USER: {
|
|
318
318
|
const { local, remote } = await this.reloadUserConfiguration();
|
|
319
319
|
await this.loadConfiguration(this._configuration.applicationConfiguration, local, remote, true);
|
|
320
320
|
return;
|
|
321
321
|
}
|
|
322
|
-
case
|
|
322
|
+
case ConfigurationTarget.USER_LOCAL:
|
|
323
323
|
await this.reloadLocalUserConfiguration();
|
|
324
324
|
return;
|
|
325
|
-
case
|
|
325
|
+
case ConfigurationTarget.USER_REMOTE:
|
|
326
326
|
await this.reloadRemoteUserConfiguration();
|
|
327
327
|
return;
|
|
328
|
-
case
|
|
329
|
-
case
|
|
328
|
+
case ConfigurationTarget.WORKSPACE:
|
|
329
|
+
case ConfigurationTarget.WORKSPACE_FOLDER:
|
|
330
330
|
await this.reloadWorkspaceConfiguration();
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
@@ -338,9 +338,7 @@ class WorkspaceService extends Disposable {
|
|
|
338
338
|
return this._configuration.inspect(key, overrides);
|
|
339
339
|
}
|
|
340
340
|
keys() {
|
|
341
|
-
return (
|
|
342
|
-
(this._configuration.keys())
|
|
343
|
-
);
|
|
341
|
+
return ( this._configuration.keys());
|
|
344
342
|
}
|
|
345
343
|
async whenRemoteConfigurationLoaded() {
|
|
346
344
|
await this.initRemoteUserConfigurationBarrier.wait();
|
|
@@ -368,7 +366,7 @@ class WorkspaceService extends Disposable {
|
|
|
368
366
|
}
|
|
369
367
|
folderConfigurationModels.push(configurationModel);
|
|
370
368
|
}
|
|
371
|
-
if (this.getWorkbenchState() ===
|
|
369
|
+
if (this.getWorkbenchState() === WorkbenchState.FOLDER) {
|
|
372
370
|
if (folderConfigurationModels[0]) {
|
|
373
371
|
this._configuration.updateWorkspaceConfiguration(folderConfigurationModels[0]);
|
|
374
372
|
}
|
|
@@ -390,7 +388,7 @@ class WorkspaceService extends Disposable {
|
|
|
390
388
|
this.restrictedSettings.workspaceFolder?.forEach((value) => keys.push(...value));
|
|
391
389
|
keys = distinct(keys);
|
|
392
390
|
if (keys.length) {
|
|
393
|
-
this.triggerConfigurationChange({ keys, overrides: [] }, { data, workspace: this.workspace },
|
|
391
|
+
this.triggerConfigurationChange({ keys, overrides: [] }, { data, workspace: this.workspace }, ConfigurationTarget.WORKSPACE);
|
|
394
392
|
}
|
|
395
393
|
}
|
|
396
394
|
}
|
|
@@ -398,7 +396,7 @@ class WorkspaceService extends Disposable {
|
|
|
398
396
|
this.instantiationService = instantiationService;
|
|
399
397
|
}
|
|
400
398
|
isSettingAppliedForAllProfiles(key) {
|
|
401
|
-
if (this.configurationRegistry.getConfigurationProperties()[key]?.scope ===
|
|
399
|
+
if (this.configurationRegistry.getConfigurationProperties()[key]?.scope === ConfigurationScope.APPLICATION) {
|
|
402
400
|
return true;
|
|
403
401
|
}
|
|
404
402
|
const allProfilesSettings = this.getValue(APPLY_ALL_PROFILES_SETTING) ?? [];
|
|
@@ -418,35 +416,35 @@ class WorkspaceService extends Disposable {
|
|
|
418
416
|
const workspaceConfigPath = workspaceIdentifier.configPath;
|
|
419
417
|
const workspaceFolders = toWorkspaceFolders(this.workspaceConfiguration.getFolders(), workspaceConfigPath, this.uriIdentityService.extUri);
|
|
420
418
|
const workspaceId = workspaceIdentifier.id;
|
|
421
|
-
const workspace = (
|
|
419
|
+
const workspace = ( new Workspace(
|
|
422
420
|
workspaceId,
|
|
423
421
|
workspaceFolders,
|
|
424
422
|
this.workspaceConfiguration.isTransient(),
|
|
425
423
|
workspaceConfigPath,
|
|
426
424
|
uri => this.uriIdentityService.extUri.ignorePathCasing(uri)
|
|
427
|
-
))
|
|
425
|
+
));
|
|
428
426
|
workspace.initialized = this.workspaceConfiguration.initialized;
|
|
429
427
|
return workspace;
|
|
430
428
|
}
|
|
431
429
|
createSingleFolderWorkspace(singleFolderWorkspaceIdentifier) {
|
|
432
|
-
const workspace = (
|
|
430
|
+
const workspace = ( new Workspace(
|
|
433
431
|
singleFolderWorkspaceIdentifier.id,
|
|
434
432
|
[toWorkspaceFolder(singleFolderWorkspaceIdentifier.uri)],
|
|
435
433
|
false,
|
|
436
434
|
null,
|
|
437
435
|
uri => this.uriIdentityService.extUri.ignorePathCasing(uri)
|
|
438
|
-
))
|
|
436
|
+
));
|
|
439
437
|
workspace.initialized = true;
|
|
440
438
|
return workspace;
|
|
441
439
|
}
|
|
442
440
|
createEmptyWorkspace(emptyWorkspaceIdentifier) {
|
|
443
|
-
const workspace = (
|
|
441
|
+
const workspace = ( new Workspace(
|
|
444
442
|
emptyWorkspaceIdentifier.id,
|
|
445
443
|
[],
|
|
446
444
|
false,
|
|
447
445
|
null,
|
|
448
446
|
uri => this.uriIdentityService.extUri.ignorePathCasing(uri)
|
|
449
|
-
))
|
|
447
|
+
));
|
|
450
448
|
workspace.initialized = true;
|
|
451
449
|
return Promise.resolve(workspace);
|
|
452
450
|
}
|
|
@@ -492,13 +490,11 @@ class WorkspaceService extends Disposable {
|
|
|
492
490
|
}
|
|
493
491
|
compareFolders(currentFolders, newFolders) {
|
|
494
492
|
const result = { added: [], removed: [], changed: [] };
|
|
495
|
-
result.added = newFolders.filter(newFolder => !(
|
|
496
|
-
currentFolder => ( (newFolder.uri.toString())) === ( (currentFolder.uri.toString()))
|
|
497
|
-
))));
|
|
493
|
+
result.added = newFolders.filter(newFolder => !( currentFolders.some(currentFolder => ( newFolder.uri.toString()) === ( currentFolder.uri.toString()))));
|
|
498
494
|
for (let currentIndex = 0; currentIndex < currentFolders.length; currentIndex++) {
|
|
499
495
|
const currentFolder = currentFolders[currentIndex];
|
|
500
496
|
let newIndex = 0;
|
|
501
|
-
for (newIndex = 0; newIndex < newFolders.length && (
|
|
497
|
+
for (newIndex = 0; newIndex < newFolders.length && ( currentFolder.uri.toString()) !== ( newFolders[newIndex].uri.toString()); newIndex++) { }
|
|
502
498
|
if (newIndex < newFolders.length) {
|
|
503
499
|
if (currentIndex !== newIndex || currentFolder.name !== newFolders[newIndex].name) {
|
|
504
500
|
result.changed.push(currentFolder);
|
|
@@ -569,10 +565,10 @@ class WorkspaceService extends Disposable {
|
|
|
569
565
|
}
|
|
570
566
|
async reloadWorkspaceConfiguration() {
|
|
571
567
|
const workbenchState = this.getWorkbenchState();
|
|
572
|
-
if (workbenchState ===
|
|
568
|
+
if (workbenchState === WorkbenchState.FOLDER) {
|
|
573
569
|
return this.onWorkspaceFolderConfigurationChanged(this.workspace.folders[0]);
|
|
574
570
|
}
|
|
575
|
-
if (workbenchState ===
|
|
571
|
+
if (workbenchState === WorkbenchState.WORKSPACE) {
|
|
576
572
|
return this.workspaceConfiguration.reload().then(() => this.onWorkspaceConfigurationChanged(false));
|
|
577
573
|
}
|
|
578
574
|
}
|
|
@@ -580,14 +576,14 @@ class WorkspaceService extends Disposable {
|
|
|
580
576
|
return this.onWorkspaceFolderConfigurationChanged(folder);
|
|
581
577
|
}
|
|
582
578
|
async loadConfiguration(applicationConfigurationModel, userConfigurationModel, remoteUserConfigurationModel, trigger) {
|
|
583
|
-
this.cachedFolderConfigs = (
|
|
579
|
+
this.cachedFolderConfigs = ( new ResourceMap());
|
|
584
580
|
const folders = this.workspace.folders;
|
|
585
581
|
const folderConfigurations = await this.loadFolderConfigurations(folders);
|
|
586
582
|
const workspaceConfiguration = this.getWorkspaceConfigurationModel(folderConfigurations);
|
|
587
|
-
const folderConfigurationModels = (
|
|
583
|
+
const folderConfigurationModels = ( new ResourceMap());
|
|
588
584
|
folderConfigurations.forEach((folderConfiguration, index) => folderConfigurationModels.set(folders[index].uri, folderConfiguration));
|
|
589
585
|
const currentConfiguration = this._configuration;
|
|
590
|
-
this._configuration = (
|
|
586
|
+
this._configuration = ( new Configuration(
|
|
591
587
|
this.defaultConfiguration.configurationModel,
|
|
592
588
|
this.policyConfiguration.configurationModel,
|
|
593
589
|
applicationConfigurationModel,
|
|
@@ -596,22 +592,22 @@ class WorkspaceService extends Disposable {
|
|
|
596
592
|
workspaceConfiguration,
|
|
597
593
|
folderConfigurationModels,
|
|
598
594
|
ConfigurationModel.createEmptyModel(this.logService),
|
|
599
|
-
|
|
595
|
+
( new ResourceMap()),
|
|
600
596
|
this.workspace,
|
|
601
597
|
this.logService
|
|
602
|
-
))
|
|
598
|
+
));
|
|
603
599
|
this.initialized = true;
|
|
604
600
|
if (trigger) {
|
|
605
601
|
const change = this._configuration.compare(currentConfiguration);
|
|
606
|
-
this.triggerConfigurationChange(change, { data: currentConfiguration.toData(), workspace: this.workspace },
|
|
602
|
+
this.triggerConfigurationChange(change, { data: currentConfiguration.toData(), workspace: this.workspace }, ConfigurationTarget.WORKSPACE);
|
|
607
603
|
}
|
|
608
604
|
this.updateRestrictedSettings();
|
|
609
605
|
}
|
|
610
606
|
getWorkspaceConfigurationModel(folderConfigurations) {
|
|
611
607
|
switch (this.getWorkbenchState()) {
|
|
612
|
-
case
|
|
608
|
+
case WorkbenchState.FOLDER:
|
|
613
609
|
return folderConfigurations[0];
|
|
614
|
-
case
|
|
610
|
+
case WorkbenchState.WORKSPACE:
|
|
615
611
|
return this.workspaceConfiguration.getConfiguration();
|
|
616
612
|
default:
|
|
617
613
|
return ConfigurationModel.createEmptyModel(this.logService);
|
|
@@ -647,7 +643,7 @@ class WorkspaceService extends Disposable {
|
|
|
647
643
|
this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse());
|
|
648
644
|
this._configuration.updateRemoteUserConfiguration(this.remoteUserConfiguration.reparse());
|
|
649
645
|
}
|
|
650
|
-
if (this.getWorkbenchState() ===
|
|
646
|
+
if (this.getWorkbenchState() === WorkbenchState.FOLDER) {
|
|
651
647
|
const folderConfiguration = this.cachedFolderConfigs.get(this.workspace.folders[0].uri);
|
|
652
648
|
if (folderConfiguration) {
|
|
653
649
|
this._configuration.updateWorkspaceConfiguration(folderConfiguration.reparse());
|
|
@@ -663,14 +659,14 @@ class WorkspaceService extends Disposable {
|
|
|
663
659
|
}
|
|
664
660
|
}
|
|
665
661
|
}
|
|
666
|
-
this.triggerConfigurationChange(change, { data: previousData, workspace: this.workspace },
|
|
662
|
+
this.triggerConfigurationChange(change, { data: previousData, workspace: this.workspace }, ConfigurationTarget.DEFAULT);
|
|
667
663
|
this.updateRestrictedSettings();
|
|
668
664
|
}
|
|
669
665
|
}
|
|
670
666
|
onPolicyConfigurationChanged(policyConfiguration) {
|
|
671
667
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
672
668
|
const change = this._configuration.compareAndUpdatePolicyConfiguration(policyConfiguration);
|
|
673
|
-
this.triggerConfigurationChange(change, previous,
|
|
669
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.DEFAULT);
|
|
674
670
|
}
|
|
675
671
|
onApplicationConfigurationChanged(applicationConfiguration) {
|
|
676
672
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
@@ -680,7 +676,7 @@ class WorkspaceService extends Disposable {
|
|
|
680
676
|
const configurationProperties = this.configurationRegistry.getConfigurationProperties();
|
|
681
677
|
const changedKeys = [];
|
|
682
678
|
for (const changedKey of change.keys) {
|
|
683
|
-
if (configurationProperties[changedKey]?.scope ===
|
|
679
|
+
if (configurationProperties[changedKey]?.scope === ConfigurationScope.APPLICATION) {
|
|
684
680
|
changedKeys.push(changedKey);
|
|
685
681
|
if (changedKey === APPLY_ALL_PROFILES_SETTING) {
|
|
686
682
|
for (const previousAllProfileSetting of previousAllProfilesSettings) {
|
|
@@ -703,17 +699,17 @@ class WorkspaceService extends Disposable {
|
|
|
703
699
|
if (change.keys.includes(APPLY_ALL_PROFILES_SETTING)) {
|
|
704
700
|
this._configuration.updateLocalUserConfiguration(this.localUserConfiguration.reparse({ exclude: currentAllProfilesSettings }));
|
|
705
701
|
}
|
|
706
|
-
this.triggerConfigurationChange(change, previous,
|
|
702
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.USER);
|
|
707
703
|
}
|
|
708
704
|
onLocalUserConfigurationChanged(userConfiguration) {
|
|
709
705
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
710
706
|
const change = this._configuration.compareAndUpdateLocalUserConfiguration(userConfiguration);
|
|
711
|
-
this.triggerConfigurationChange(change, previous,
|
|
707
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.USER);
|
|
712
708
|
}
|
|
713
709
|
onRemoteUserConfigurationChanged(userConfiguration) {
|
|
714
710
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
715
711
|
const change = this._configuration.compareAndUpdateRemoteUserConfiguration(userConfiguration);
|
|
716
|
-
this.triggerConfigurationChange(change, previous,
|
|
712
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.USER);
|
|
717
713
|
}
|
|
718
714
|
async onWorkspaceConfigurationChanged(fromCache) {
|
|
719
715
|
if (this.workspace && this.workspace.configuration) {
|
|
@@ -733,7 +729,7 @@ class WorkspaceService extends Disposable {
|
|
|
733
729
|
updateRestrictedSettings() {
|
|
734
730
|
const changed = [];
|
|
735
731
|
const allProperties = this.configurationRegistry.getConfigurationProperties();
|
|
736
|
-
const defaultRestrictedSettings = (
|
|
732
|
+
const defaultRestrictedSettings = ( Object.keys(allProperties)).filter(key => allProperties[key].restricted).sort((a, b) => a.localeCompare(b));
|
|
737
733
|
const defaultDelta = delta(defaultRestrictedSettings, this._restrictedSettings.default, (a, b) => a.localeCompare(b));
|
|
738
734
|
changed.push(...defaultDelta.added, ...defaultDelta.removed);
|
|
739
735
|
const application = (this.applicationConfiguration?.getRestrictedSettings() || []).sort((a, b) => a.localeCompare(b));
|
|
@@ -745,7 +741,7 @@ class WorkspaceService extends Disposable {
|
|
|
745
741
|
const userRemote = (this.remoteUserConfiguration?.getRestrictedSettings() || []).sort((a, b) => a.localeCompare(b));
|
|
746
742
|
const userRemoteDelta = delta(userRemote, this._restrictedSettings.userRemote || [], (a, b) => a.localeCompare(b));
|
|
747
743
|
changed.push(...userRemoteDelta.added, ...userRemoteDelta.removed);
|
|
748
|
-
const workspaceFolderMap = (
|
|
744
|
+
const workspaceFolderMap = ( new ResourceMap());
|
|
749
745
|
for (const workspaceFolder of this.workspace.folders) {
|
|
750
746
|
const cachedFolderConfig = this.cachedFolderConfigs.get(workspaceFolder.uri);
|
|
751
747
|
const folderRestrictedSettings = (cachedFolderConfig?.getRestrictedSettings() || []).sort((a, b) => a.localeCompare(b));
|
|
@@ -756,7 +752,7 @@ class WorkspaceService extends Disposable {
|
|
|
756
752
|
const workspaceFolderDelta = delta(folderRestrictedSettings, previous, (a, b) => a.localeCompare(b));
|
|
757
753
|
changed.push(...workspaceFolderDelta.added, ...workspaceFolderDelta.removed);
|
|
758
754
|
}
|
|
759
|
-
const workspace = this.getWorkbenchState() ===
|
|
755
|
+
const workspace = this.getWorkbenchState() === WorkbenchState.WORKSPACE ? this.workspaceConfiguration.getRestrictedSettings().sort((a, b) => a.localeCompare(b))
|
|
760
756
|
: this.workspace.folders[0] ? (workspaceFolderMap.get(this.workspace.folders[0].uri) || []) : [];
|
|
761
757
|
const workspaceDelta = delta(workspace, this._restrictedSettings.workspace || [], (a, b) => a.localeCompare(b));
|
|
762
758
|
changed.push(...workspaceDelta.added, ...workspaceDelta.removed);
|
|
@@ -780,11 +776,11 @@ class WorkspaceService extends Disposable {
|
|
|
780
776
|
this.workspace.folders = workspaceFolders;
|
|
781
777
|
const change = await this.onFoldersChanged();
|
|
782
778
|
await this.handleWillChangeWorkspaceFolders(changes, fromCache);
|
|
783
|
-
this.triggerConfigurationChange(change, previous,
|
|
779
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.WORKSPACE_FOLDER);
|
|
784
780
|
this._onDidChangeWorkspaceFolders.fire(changes);
|
|
785
781
|
}
|
|
786
782
|
else {
|
|
787
|
-
this.triggerConfigurationChange(change, previous,
|
|
783
|
+
this.triggerConfigurationChange(change, previous, ConfigurationTarget.WORKSPACE);
|
|
788
784
|
}
|
|
789
785
|
this.updateRestrictedSettings();
|
|
790
786
|
}
|
|
@@ -806,26 +802,26 @@ class WorkspaceService extends Disposable {
|
|
|
806
802
|
const [folderConfiguration] = await this.loadFolderConfigurations([folder]);
|
|
807
803
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
808
804
|
const folderConfigurationChange = this._configuration.compareAndUpdateFolderConfiguration(folder.uri, folderConfiguration);
|
|
809
|
-
if (this.getWorkbenchState() ===
|
|
805
|
+
if (this.getWorkbenchState() === WorkbenchState.FOLDER) {
|
|
810
806
|
const workspaceConfigurationChange = this._configuration.compareAndUpdateWorkspaceConfiguration(folderConfiguration);
|
|
811
|
-
this.triggerConfigurationChange(mergeChanges(folderConfigurationChange, workspaceConfigurationChange), previous,
|
|
807
|
+
this.triggerConfigurationChange(mergeChanges(folderConfigurationChange, workspaceConfigurationChange), previous, ConfigurationTarget.WORKSPACE);
|
|
812
808
|
}
|
|
813
809
|
else {
|
|
814
|
-
this.triggerConfigurationChange(folderConfigurationChange, previous,
|
|
810
|
+
this.triggerConfigurationChange(folderConfigurationChange, previous, ConfigurationTarget.WORKSPACE_FOLDER);
|
|
815
811
|
}
|
|
816
812
|
this.updateRestrictedSettings();
|
|
817
813
|
}
|
|
818
814
|
async onFoldersChanged() {
|
|
819
815
|
const changes = [];
|
|
820
|
-
for (const key of (
|
|
821
|
-
if (!this.workspace.folders.filter(folder => (
|
|
816
|
+
for (const key of ( this.cachedFolderConfigs.keys())) {
|
|
817
|
+
if (!this.workspace.folders.filter(folder => ( folder.uri.toString()) === ( key.toString()))[0]) {
|
|
822
818
|
const folderConfiguration = this.cachedFolderConfigs.get(key);
|
|
823
819
|
folderConfiguration.dispose();
|
|
824
820
|
this.cachedFolderConfigs.delete(key);
|
|
825
821
|
changes.push(this._configuration.compareAndDeleteFolderConfiguration(key));
|
|
826
822
|
}
|
|
827
823
|
}
|
|
828
|
-
const toInitialize = this.workspace.folders.filter(folder => !(
|
|
824
|
+
const toInitialize = this.workspace.folders.filter(folder => !( this.cachedFolderConfigs.has(folder.uri)));
|
|
829
825
|
if (toInitialize.length) {
|
|
830
826
|
const folderConfigurations = await this.loadFolderConfigurations(toInitialize);
|
|
831
827
|
folderConfigurations.forEach((folderConfiguration, index) => {
|
|
@@ -835,10 +831,10 @@ class WorkspaceService extends Disposable {
|
|
|
835
831
|
return mergeChanges(...changes);
|
|
836
832
|
}
|
|
837
833
|
loadFolderConfigurations(folders) {
|
|
838
|
-
return Promise.all([...(
|
|
834
|
+
return Promise.all([...( folders.map(folder => {
|
|
839
835
|
let folderConfiguration = this.cachedFolderConfigs.get(folder.uri);
|
|
840
836
|
if (!folderConfiguration) {
|
|
841
|
-
folderConfiguration = (
|
|
837
|
+
folderConfiguration = ( new FolderConfiguration(
|
|
842
838
|
!this.initialized,
|
|
843
839
|
folder,
|
|
844
840
|
FOLDER_CONFIG_FOLDER_NAME,
|
|
@@ -848,12 +844,12 @@ class WorkspaceService extends Disposable {
|
|
|
848
844
|
this.uriIdentityService,
|
|
849
845
|
this.logService,
|
|
850
846
|
this.configurationCache
|
|
851
|
-
))
|
|
847
|
+
));
|
|
852
848
|
this._register(folderConfiguration.onDidChange(() => this.onWorkspaceFolderConfigurationChanged(folder)));
|
|
853
849
|
this.cachedFolderConfigs.set(folder.uri, this._register(folderConfiguration));
|
|
854
850
|
}
|
|
855
851
|
return folderConfiguration.loadConfiguration();
|
|
856
|
-
}))
|
|
852
|
+
}))]);
|
|
857
853
|
}
|
|
858
854
|
async validateWorkspaceFoldersAndReload(fromCache) {
|
|
859
855
|
const validWorkspaceFolders = await this.toValidWorkspaceFolders(this.workspace.folders);
|
|
@@ -872,7 +868,7 @@ class WorkspaceService extends Disposable {
|
|
|
872
868
|
}
|
|
873
869
|
}
|
|
874
870
|
catch (e) {
|
|
875
|
-
this.logService.warn(`Ignoring the error while validating workspace folder ${(
|
|
871
|
+
this.logService.warn(`Ignoring the error while validating workspace folder ${( workspaceFolder.uri.toString())} - ${toErrorMessage(e)}`);
|
|
876
872
|
}
|
|
877
873
|
validWorkspaceFolders.push(workspaceFolder);
|
|
878
874
|
}
|
|
@@ -880,25 +876,25 @@ class WorkspaceService extends Disposable {
|
|
|
880
876
|
}
|
|
881
877
|
async writeConfigurationValue(key, value, target, overrides, options) {
|
|
882
878
|
if (!this.instantiationService) {
|
|
883
|
-
throw (
|
|
879
|
+
throw ( new Error(
|
|
884
880
|
'Cannot write configuration because the configuration service is not yet ready to accept writes.'
|
|
885
|
-
))
|
|
881
|
+
));
|
|
886
882
|
}
|
|
887
|
-
if (target ===
|
|
888
|
-
throw (
|
|
883
|
+
if (target === ConfigurationTarget.DEFAULT) {
|
|
884
|
+
throw ( new Error('Invalid configuration target'));
|
|
889
885
|
}
|
|
890
|
-
if (target ===
|
|
886
|
+
if (target === ConfigurationTarget.MEMORY) {
|
|
891
887
|
const previous = { data: this._configuration.toData(), workspace: this.workspace };
|
|
892
888
|
this._configuration.updateValue(key, value, overrides);
|
|
893
|
-
this.triggerConfigurationChange({ keys: overrides?.overrideIdentifiers?.length ? [keyFromOverrideIdentifiers(overrides.overrideIdentifiers), key] : [key], overrides: overrides?.overrideIdentifiers?.length ? (
|
|
889
|
+
this.triggerConfigurationChange({ keys: overrides?.overrideIdentifiers?.length ? [keyFromOverrideIdentifiers(overrides.overrideIdentifiers), key] : [key], overrides: overrides?.overrideIdentifiers?.length ? ( overrides.overrideIdentifiers.map(overrideIdentifier => ([overrideIdentifier, [key]]))) : [] }, previous, target);
|
|
894
890
|
return;
|
|
895
891
|
}
|
|
896
892
|
const editableConfigurationTarget = this.toEditableConfigurationTarget(target, key);
|
|
897
893
|
if (!editableConfigurationTarget) {
|
|
898
|
-
throw (
|
|
894
|
+
throw ( new Error('Invalid configuration target'));
|
|
899
895
|
}
|
|
900
|
-
if (editableConfigurationTarget ===
|
|
901
|
-
throw (
|
|
896
|
+
if (editableConfigurationTarget === EditableConfigurationTarget.USER_REMOTE && !this.remoteUserConfiguration) {
|
|
897
|
+
throw ( new Error('Invalid configuration target'));
|
|
902
898
|
}
|
|
903
899
|
if (overrides?.overrideIdentifiers?.length && overrides.overrideIdentifiers.length > 1) {
|
|
904
900
|
const configurationModel = this.getConfigurationModelForEditableConfigurationTarget(editableConfigurationTarget, overrides.resource);
|
|
@@ -913,7 +909,7 @@ class WorkspaceService extends Disposable {
|
|
|
913
909
|
this.configurationEditing = this.configurationEditing ?? this.createConfigurationEditingService(this.instantiationService);
|
|
914
910
|
await (await this.configurationEditing).writeConfiguration(editableConfigurationTarget, { key, value }, { scopes: overrides, ...options });
|
|
915
911
|
switch (editableConfigurationTarget) {
|
|
916
|
-
case
|
|
912
|
+
case EditableConfigurationTarget.USER_LOCAL:
|
|
917
913
|
if (this.applicationConfiguration && this.isSettingAppliedForAllProfiles(key)) {
|
|
918
914
|
await this.reloadApplicationConfiguration();
|
|
919
915
|
}
|
|
@@ -921,11 +917,11 @@ class WorkspaceService extends Disposable {
|
|
|
921
917
|
await this.reloadLocalUserConfiguration();
|
|
922
918
|
}
|
|
923
919
|
return;
|
|
924
|
-
case
|
|
920
|
+
case EditableConfigurationTarget.USER_REMOTE:
|
|
925
921
|
return this.reloadRemoteUserConfiguration().then(() => undefined);
|
|
926
|
-
case
|
|
922
|
+
case EditableConfigurationTarget.WORKSPACE:
|
|
927
923
|
return this.reloadWorkspaceConfiguration();
|
|
928
|
-
case
|
|
924
|
+
case EditableConfigurationTarget.WORKSPACE_FOLDER: {
|
|
929
925
|
const workspaceFolder = overrides && overrides.resource ? this.workspace.getFolder(overrides.resource) : null;
|
|
930
926
|
if (workspaceFolder) {
|
|
931
927
|
return this.reloadWorkspaceFolderConfiguration(workspaceFolder);
|
|
@@ -939,18 +935,18 @@ class WorkspaceService extends Disposable {
|
|
|
939
935
|
}
|
|
940
936
|
getConfigurationModelForEditableConfigurationTarget(target, resource) {
|
|
941
937
|
switch (target) {
|
|
942
|
-
case
|
|
943
|
-
case
|
|
944
|
-
case
|
|
945
|
-
case
|
|
938
|
+
case EditableConfigurationTarget.USER_LOCAL: return this._configuration.localUserConfiguration;
|
|
939
|
+
case EditableConfigurationTarget.USER_REMOTE: return this._configuration.remoteUserConfiguration;
|
|
940
|
+
case EditableConfigurationTarget.WORKSPACE: return this._configuration.workspaceConfiguration;
|
|
941
|
+
case EditableConfigurationTarget.WORKSPACE_FOLDER: return resource ? this._configuration.folderConfigurations.get(resource) : undefined;
|
|
946
942
|
}
|
|
947
943
|
}
|
|
948
944
|
getConfigurationModel(target, resource) {
|
|
949
945
|
switch (target) {
|
|
950
|
-
case
|
|
951
|
-
case
|
|
952
|
-
case
|
|
953
|
-
case
|
|
946
|
+
case ConfigurationTarget.USER_LOCAL: return this._configuration.localUserConfiguration;
|
|
947
|
+
case ConfigurationTarget.USER_REMOTE: return this._configuration.remoteUserConfiguration;
|
|
948
|
+
case ConfigurationTarget.WORKSPACE: return this._configuration.workspaceConfiguration;
|
|
949
|
+
case ConfigurationTarget.WORKSPACE_FOLDER: return resource ? this._configuration.folderConfigurations.get(resource) : undefined;
|
|
954
950
|
default: return undefined;
|
|
955
951
|
}
|
|
956
952
|
}
|
|
@@ -960,62 +956,62 @@ class WorkspaceService extends Disposable {
|
|
|
960
956
|
}
|
|
961
957
|
const definedTargets = [];
|
|
962
958
|
if (inspect.workspaceFolderValue !== undefined) {
|
|
963
|
-
definedTargets.push(
|
|
959
|
+
definedTargets.push(ConfigurationTarget.WORKSPACE_FOLDER);
|
|
964
960
|
}
|
|
965
961
|
if (inspect.workspaceValue !== undefined) {
|
|
966
|
-
definedTargets.push(
|
|
962
|
+
definedTargets.push(ConfigurationTarget.WORKSPACE);
|
|
967
963
|
}
|
|
968
964
|
if (inspect.userRemoteValue !== undefined) {
|
|
969
|
-
definedTargets.push(
|
|
965
|
+
definedTargets.push(ConfigurationTarget.USER_REMOTE);
|
|
970
966
|
}
|
|
971
967
|
if (inspect.userLocalValue !== undefined) {
|
|
972
|
-
definedTargets.push(
|
|
968
|
+
definedTargets.push(ConfigurationTarget.USER_LOCAL);
|
|
973
969
|
}
|
|
974
970
|
if (inspect.applicationValue !== undefined) {
|
|
975
|
-
definedTargets.push(
|
|
971
|
+
definedTargets.push(ConfigurationTarget.APPLICATION);
|
|
976
972
|
}
|
|
977
973
|
if (value === undefined) {
|
|
978
974
|
return definedTargets;
|
|
979
975
|
}
|
|
980
|
-
return [definedTargets[0] ||
|
|
976
|
+
return [definedTargets[0] || ConfigurationTarget.USER];
|
|
981
977
|
}
|
|
982
978
|
triggerConfigurationChange(change, previous, target) {
|
|
983
979
|
if (change.keys.length) {
|
|
984
|
-
if (target !==
|
|
980
|
+
if (target !== ConfigurationTarget.DEFAULT) {
|
|
985
981
|
this.logService.debug(`Configuration keys changed in ${ConfigurationTargetToString(target)} target`, ...change.keys);
|
|
986
982
|
}
|
|
987
|
-
const configurationChangeEvent = (
|
|
983
|
+
const configurationChangeEvent = ( new ConfigurationChangeEvent(change, previous, this._configuration, this.workspace, this.logService));
|
|
988
984
|
configurationChangeEvent.source = target;
|
|
989
985
|
this._onDidChangeConfiguration.fire(configurationChangeEvent);
|
|
990
986
|
}
|
|
991
987
|
}
|
|
992
988
|
toEditableConfigurationTarget(target, key) {
|
|
993
|
-
if (target ===
|
|
994
|
-
return
|
|
989
|
+
if (target === ConfigurationTarget.APPLICATION) {
|
|
990
|
+
return EditableConfigurationTarget.USER_LOCAL;
|
|
995
991
|
}
|
|
996
|
-
if (target ===
|
|
992
|
+
if (target === ConfigurationTarget.USER) {
|
|
997
993
|
if (this.remoteUserConfiguration) {
|
|
998
994
|
const scope = this.configurationRegistry.getConfigurationProperties()[key]?.scope;
|
|
999
|
-
if (scope ===
|
|
1000
|
-
return
|
|
995
|
+
if (scope === ConfigurationScope.MACHINE || scope === ConfigurationScope.MACHINE_OVERRIDABLE) {
|
|
996
|
+
return EditableConfigurationTarget.USER_REMOTE;
|
|
1001
997
|
}
|
|
1002
998
|
if (this.inspect(key).userRemoteValue !== undefined) {
|
|
1003
|
-
return
|
|
999
|
+
return EditableConfigurationTarget.USER_REMOTE;
|
|
1004
1000
|
}
|
|
1005
1001
|
}
|
|
1006
|
-
return
|
|
1002
|
+
return EditableConfigurationTarget.USER_LOCAL;
|
|
1007
1003
|
}
|
|
1008
|
-
if (target ===
|
|
1009
|
-
return
|
|
1004
|
+
if (target === ConfigurationTarget.USER_LOCAL) {
|
|
1005
|
+
return EditableConfigurationTarget.USER_LOCAL;
|
|
1010
1006
|
}
|
|
1011
|
-
if (target ===
|
|
1012
|
-
return
|
|
1007
|
+
if (target === ConfigurationTarget.USER_REMOTE) {
|
|
1008
|
+
return EditableConfigurationTarget.USER_REMOTE;
|
|
1013
1009
|
}
|
|
1014
|
-
if (target ===
|
|
1015
|
-
return
|
|
1010
|
+
if (target === ConfigurationTarget.WORKSPACE) {
|
|
1011
|
+
return EditableConfigurationTarget.WORKSPACE;
|
|
1016
1012
|
}
|
|
1017
|
-
if (target ===
|
|
1018
|
-
return
|
|
1013
|
+
if (target === ConfigurationTarget.WORKSPACE_FOLDER) {
|
|
1014
|
+
return EditableConfigurationTarget.WORKSPACE_FOLDER;
|
|
1019
1015
|
}
|
|
1020
1016
|
return null;
|
|
1021
1017
|
}
|
|
@@ -1028,9 +1024,9 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1028
1024
|
this.workspaceTrustManagementService = workspaceTrustManagementService;
|
|
1029
1025
|
extensionService.whenInstalledExtensionsRegistered().then(() => {
|
|
1030
1026
|
this.registerConfigurationSchemas();
|
|
1031
|
-
const configurationRegistry = (
|
|
1032
|
-
const delayer = this._register((
|
|
1033
|
-
this._register(Event.any(configurationRegistry.onDidUpdateConfiguration, configurationRegistry.onDidSchemaChange, workspaceTrustManagementService.onDidChangeTrust)(() => delayer.trigger(() => this.registerConfigurationSchemas(), lifecycleService.phase ===
|
|
1027
|
+
const configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
1028
|
+
const delayer = this._register(( new Delayer(50)));
|
|
1029
|
+
this._register(Event.any(configurationRegistry.onDidUpdateConfiguration, configurationRegistry.onDidSchemaChange, workspaceTrustManagementService.onDidChangeTrust)(() => delayer.trigger(() => this.registerConfigurationSchemas(), lifecycleService.phase === LifecyclePhase.Eventually ? undefined : 2500 )));
|
|
1034
1030
|
});
|
|
1035
1031
|
}
|
|
1036
1032
|
registerConfigurationSchemas() {
|
|
@@ -1072,11 +1068,11 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1072
1068
|
allowComments: true
|
|
1073
1069
|
};
|
|
1074
1070
|
const defaultSettingsSchema = {
|
|
1075
|
-
properties: (
|
|
1071
|
+
properties: ( Object.keys(allSettings.properties)).reduce((result, key) => {
|
|
1076
1072
|
result[key] = Object.assign({ deprecationMessage: undefined }, allSettings.properties[key]);
|
|
1077
1073
|
return result;
|
|
1078
1074
|
}, {}),
|
|
1079
|
-
patternProperties: (
|
|
1075
|
+
patternProperties: ( Object.keys(allSettings.patternProperties)).reduce((result, key) => {
|
|
1080
1076
|
result[key] = Object.assign({ deprecationMessage: undefined }, allSettings.patternProperties[key]);
|
|
1081
1077
|
return result;
|
|
1082
1078
|
}, {}),
|
|
@@ -1084,7 +1080,7 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1084
1080
|
allowTrailingCommas: true,
|
|
1085
1081
|
allowComments: true
|
|
1086
1082
|
};
|
|
1087
|
-
const folderSettingsSchema =
|
|
1083
|
+
const folderSettingsSchema = WorkbenchState.WORKSPACE === this.workspaceContextService.getWorkbenchState() ?
|
|
1088
1084
|
{
|
|
1089
1085
|
properties: Object.assign({}, this.checkAndFilterPropertiesRequiringTrust(machineOverridableSettings.properties), this.checkAndFilterPropertiesRequiringTrust(resourceSettings.properties)),
|
|
1090
1086
|
patternProperties: allSettings.patternProperties,
|
|
@@ -1094,7 +1090,7 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1094
1090
|
} : workspaceSettingsSchema;
|
|
1095
1091
|
const configDefaultsSchema = {
|
|
1096
1092
|
type: 'object',
|
|
1097
|
-
description: ( localize(
|
|
1093
|
+
description: ( localize(11264, 'Contribute defaults for configurations')),
|
|
1098
1094
|
properties: Object.assign({}, this.filterDefaultOverridableProperties(machineOverridableSettings.properties), this.filterDefaultOverridableProperties(windowSettings.properties), this.filterDefaultOverridableProperties(resourceSettings.properties)),
|
|
1099
1095
|
patternProperties: {
|
|
1100
1096
|
[OVERRIDE_PROPERTY_PATTERN]: {
|
|
@@ -1116,7 +1112,7 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1116
1112
|
});
|
|
1117
1113
|
}
|
|
1118
1114
|
registerSchemas(schemas) {
|
|
1119
|
-
const jsonRegistry = (
|
|
1115
|
+
const jsonRegistry = ( Registry.as(Extensions$1.JSONContribution));
|
|
1120
1116
|
jsonRegistry.registerSchema(defaultSettingsSchemaId, schemas.defaultSettingsSchema);
|
|
1121
1117
|
jsonRegistry.registerSchema(userSettingsSchemaId, schemas.userSettingsSchema);
|
|
1122
1118
|
jsonRegistry.registerSchema(profileSettingsSchemaId, schemas.profileSettingsSchema);
|
|
@@ -1147,33 +1143,33 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
1147
1143
|
return result;
|
|
1148
1144
|
}
|
|
1149
1145
|
};
|
|
1150
|
-
RegisterConfigurationSchemasContribution = (
|
|
1151
|
-
(
|
|
1152
|
-
(
|
|
1153
|
-
(
|
|
1154
|
-
(
|
|
1155
|
-
(
|
|
1156
|
-
], RegisterConfigurationSchemasContribution))
|
|
1146
|
+
RegisterConfigurationSchemasContribution = ( __decorate([
|
|
1147
|
+
( __param(0, IWorkspaceContextService)),
|
|
1148
|
+
( __param(1, IWorkbenchEnvironmentService)),
|
|
1149
|
+
( __param(2, IWorkspaceTrustManagementService)),
|
|
1150
|
+
( __param(3, IExtensionService)),
|
|
1151
|
+
( __param(4, ILifecycleService))
|
|
1152
|
+
], RegisterConfigurationSchemasContribution));
|
|
1157
1153
|
let ResetConfigurationDefaultsOverridesCache = class ResetConfigurationDefaultsOverridesCache extends Disposable {
|
|
1158
1154
|
constructor(configurationService, extensionService) {
|
|
1159
1155
|
super();
|
|
1160
1156
|
if (configurationService.hasCachedConfigurationDefaultsOverrides()) {
|
|
1161
|
-
extensionService.whenInstalledExtensionsRegistered().then(() => configurationService.reloadConfiguration(
|
|
1157
|
+
extensionService.whenInstalledExtensionsRegistered().then(() => configurationService.reloadConfiguration(ConfigurationTarget.DEFAULT));
|
|
1162
1158
|
}
|
|
1163
1159
|
}
|
|
1164
1160
|
};
|
|
1165
|
-
ResetConfigurationDefaultsOverridesCache = (
|
|
1166
|
-
(
|
|
1167
|
-
(
|
|
1168
|
-
], ResetConfigurationDefaultsOverridesCache))
|
|
1161
|
+
ResetConfigurationDefaultsOverridesCache = ( __decorate([
|
|
1162
|
+
( __param(0, IConfigurationService)),
|
|
1163
|
+
( __param(1, IExtensionService))
|
|
1164
|
+
], ResetConfigurationDefaultsOverridesCache));
|
|
1169
1165
|
let UpdateExperimentalSettingsDefaults = class UpdateExperimentalSettingsDefaults extends Disposable {
|
|
1170
1166
|
static { this.ID = 'workbench.contrib.updateExperimentalSettingsDefaults'; }
|
|
1171
1167
|
constructor(workbenchAssignmentService) {
|
|
1172
1168
|
super();
|
|
1173
1169
|
this.workbenchAssignmentService = workbenchAssignmentService;
|
|
1174
|
-
this.processedExperimentalSettings = (
|
|
1175
|
-
this.configurationRegistry = (
|
|
1176
|
-
this.processExperimentalSettings((
|
|
1170
|
+
this.processedExperimentalSettings = ( new Set());
|
|
1171
|
+
this.configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
1172
|
+
this.processExperimentalSettings(( Object.keys(this.configurationRegistry.getConfigurationProperties())));
|
|
1177
1173
|
this._register(this.configurationRegistry.onDidUpdateConfiguration(({ properties }) => this.processExperimentalSettings(properties)));
|
|
1178
1174
|
}
|
|
1179
1175
|
async processExperimentalSettings(properties) {
|
|
@@ -1182,10 +1178,10 @@ let UpdateExperimentalSettingsDefaults = class UpdateExperimentalSettingsDefault
|
|
|
1182
1178
|
for (const property of properties) {
|
|
1183
1179
|
const schema = allProperties[property];
|
|
1184
1180
|
const tags = schema?.tags;
|
|
1185
|
-
if (!tags || (
|
|
1181
|
+
if (!tags || !( tags.some(tag => tag.toLowerCase() === 'onexp'))) {
|
|
1186
1182
|
continue;
|
|
1187
1183
|
}
|
|
1188
|
-
if ((
|
|
1184
|
+
if (( this.processedExperimentalSettings.has(property))) {
|
|
1189
1185
|
continue;
|
|
1190
1186
|
}
|
|
1191
1187
|
this.processedExperimentalSettings.add(property);
|
|
@@ -1197,27 +1193,27 @@ let UpdateExperimentalSettingsDefaults = class UpdateExperimentalSettingsDefault
|
|
|
1197
1193
|
}
|
|
1198
1194
|
catch (error) { }
|
|
1199
1195
|
}
|
|
1200
|
-
if ((
|
|
1196
|
+
if (( Object.keys(overrides)).length) {
|
|
1201
1197
|
this.configurationRegistry.registerDefaultConfigurations([{ overrides }]);
|
|
1202
1198
|
}
|
|
1203
1199
|
}
|
|
1204
1200
|
};
|
|
1205
|
-
UpdateExperimentalSettingsDefaults = (
|
|
1206
|
-
(
|
|
1207
|
-
], UpdateExperimentalSettingsDefaults))
|
|
1208
|
-
const workbenchContributionsRegistry = (
|
|
1209
|
-
workbenchContributionsRegistry.registerWorkbenchContribution(RegisterConfigurationSchemasContribution,
|
|
1210
|
-
workbenchContributionsRegistry.registerWorkbenchContribution(ResetConfigurationDefaultsOverridesCache,
|
|
1211
|
-
registerWorkbenchContribution2(UpdateExperimentalSettingsDefaults.ID, UpdateExperimentalSettingsDefaults,
|
|
1212
|
-
const configurationRegistry = (
|
|
1201
|
+
UpdateExperimentalSettingsDefaults = ( __decorate([
|
|
1202
|
+
( __param(0, IWorkbenchAssignmentService))
|
|
1203
|
+
], UpdateExperimentalSettingsDefaults));
|
|
1204
|
+
const workbenchContributionsRegistry = ( Registry.as(Extensions$2.Workbench));
|
|
1205
|
+
workbenchContributionsRegistry.registerWorkbenchContribution(RegisterConfigurationSchemasContribution, LifecyclePhase.Restored);
|
|
1206
|
+
workbenchContributionsRegistry.registerWorkbenchContribution(ResetConfigurationDefaultsOverridesCache, LifecyclePhase.Eventually);
|
|
1207
|
+
registerWorkbenchContribution2(UpdateExperimentalSettingsDefaults.ID, UpdateExperimentalSettingsDefaults, WorkbenchPhase.BlockRestore);
|
|
1208
|
+
const configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
1213
1209
|
configurationRegistry.registerConfiguration({
|
|
1214
1210
|
...workbenchConfigurationNodeBase,
|
|
1215
1211
|
properties: {
|
|
1216
1212
|
[APPLY_ALL_PROFILES_SETTING]: {
|
|
1217
1213
|
'type': 'array',
|
|
1218
|
-
description: ( localize(
|
|
1214
|
+
description: ( localize(11265, "Configure settings to be applied for all profiles.")),
|
|
1219
1215
|
'default': [],
|
|
1220
|
-
'scope':
|
|
1216
|
+
'scope': ConfigurationScope.APPLICATION,
|
|
1221
1217
|
additionalProperties: true,
|
|
1222
1218
|
uniqueItems: true,
|
|
1223
1219
|
}
|