@codingame/monaco-vscode-api 1.69.8 → 1.69.9
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/dist/api.js +6 -6
- package/dist/configuration.js +74 -384
- package/dist/contextkey.js +1 -13
- package/dist/dialogs.js +11 -11
- package/dist/extHost.js +1402 -2068
- package/dist/files.js +106 -100
- package/dist/keybindings.js +308 -358
- package/dist/languageConfiguration.js +4 -4
- package/dist/languageService.js +2 -2
- package/dist/languages.js +3 -3
- package/dist/layout.js +310 -292
- package/dist/missing-services.js +867 -5546
- package/dist/modelEditor.js +67 -67
- package/dist/monaco.js +13 -13
- package/dist/notifications.js +336 -266
- package/dist/polyfill.js +395 -394
- package/dist/services.js +1 -1
- package/dist/services2.js +27 -659
- package/dist/snippets.js +112 -104
- package/dist/textmate.js +88 -80
- package/dist/theme.js +408 -396
- package/dist/tokenClassification.js +3 -3
- package/dist/tokenClassificationRegistry.js +83 -77
- package/dist/workbenchThemeService.js +1 -1
- package/dist/workspaceContext.js +1 -1
- package/package.json +1 -1
package/dist/configuration.js
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as __decorate, a as __param } from './contextkey.js';
|
|
2
2
|
import { E as Emitter, U as UserSettings } from './polyfill.js';
|
|
3
|
-
import { e as
|
|
3
|
+
import { e as IUserDataProfilesService, f as IPolicyService, N as NullPolicyService } from './missing-services.js';
|
|
4
4
|
import { b as isEmptyObject } from './types.js';
|
|
5
5
|
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
6
|
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
7
|
-
import { Extensions,
|
|
8
|
-
import {
|
|
9
|
-
import { addToValueTree, toValuesTree
|
|
7
|
+
import { Extensions, machineOverridableSettings, windowSettings, resourceSettings, allSettings, OVERRIDE_PROPERTY_PATTERN, resourceLanguageSettingsSchemaId, OVERRIDE_PROPERTY_REGEX, overrideIdentifiersFromKey, applicationSettings, machineSettings } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
8
|
+
import { Configuration, ConfigurationModel, ConfigurationChangeEvent } from 'monaco-editor/esm/vs/platform/configuration/common/configurationModels.js';
|
|
9
|
+
import { IConfigurationService, addToValueTree, toValuesTree } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
10
10
|
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
11
11
|
import { coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
12
12
|
import { equals } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
13
13
|
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
14
14
|
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
15
|
-
import { isArray
|
|
15
|
+
import { isArray } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
16
16
|
import { extUriBiasedIgnorePathCase } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
17
17
|
import { RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
18
|
-
import { bf as Position, bg as
|
|
19
|
-
export {
|
|
18
|
+
import { bf as Position$2, bg as configurationDefaultsSchemaId } from './extHost.js';
|
|
19
|
+
export { bh as ConfigurationScope } from './extHost.js';
|
|
20
20
|
import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
|
|
21
21
|
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
22
|
-
import {
|
|
23
|
-
import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
24
|
-
import { language } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
25
|
-
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
22
|
+
import { i as IFileService, j as IWorkbenchEnvironmentService } from './services2.js';
|
|
26
23
|
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
27
24
|
import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
28
25
|
import { IWorkspaceTrustManagementService } from 'monaco-editor/esm/vs/platform/workspace/common/workspaceTrust.js';
|
|
@@ -50,18 +47,18 @@ function isConfigurationUpdateOverrides(thing) {
|
|
|
50
47
|
class DefaultConfiguration extends Disposable {
|
|
51
48
|
constructor() {
|
|
52
49
|
super(...arguments);
|
|
53
|
-
this._onDidChangeConfiguration = this._register(( new Emitter()));
|
|
50
|
+
this._onDidChangeConfiguration = this._register(( (new Emitter())));
|
|
54
51
|
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
55
52
|
}
|
|
56
53
|
get configurationModel() {
|
|
57
54
|
if (!this._configurationModel) {
|
|
58
|
-
this._configurationModel = ( new DefaultConfigurationModel(this.getConfigurationDefaultOverrides()));
|
|
55
|
+
this._configurationModel = ( (new DefaultConfigurationModel(this.getConfigurationDefaultOverrides())));
|
|
59
56
|
}
|
|
60
57
|
return this._configurationModel;
|
|
61
58
|
}
|
|
62
59
|
async initialize() {
|
|
63
60
|
this._configurationModel = undefined;
|
|
64
|
-
this._register(( Registry.as(Extensions.Configuration)).onDidUpdateConfiguration(({ properties, defaultsOverrides }) => this.onDidUpdateConfiguration(properties, defaultsOverrides)));
|
|
61
|
+
this._register(( (Registry.as(Extensions.Configuration))).onDidUpdateConfiguration(({ properties, defaultsOverrides }) => this.onDidUpdateConfiguration(properties, defaultsOverrides)));
|
|
65
62
|
return this.configurationModel;
|
|
66
63
|
}
|
|
67
64
|
reload() {
|
|
@@ -78,8 +75,8 @@ class DefaultConfiguration extends Disposable {
|
|
|
78
75
|
}
|
|
79
76
|
class DefaultConfigurationModel extends ConfigurationModel {
|
|
80
77
|
constructor(configurationDefaultsOverrides = {}) {
|
|
81
|
-
const properties = ( Registry.as(Extensions.Configuration)).getConfigurationProperties();
|
|
82
|
-
const keys = ( Object.keys(properties));
|
|
78
|
+
const properties = ( (Registry.as(Extensions.Configuration))).getConfigurationProperties();
|
|
79
|
+
const keys = ( (Object.keys(properties)));
|
|
83
80
|
const contents = Object.create(null);
|
|
84
81
|
const overrides = [];
|
|
85
82
|
for (const key in properties) {
|
|
@@ -87,11 +84,11 @@ class DefaultConfigurationModel extends ConfigurationModel {
|
|
|
87
84
|
const value = defaultOverrideValue !== undefined ? defaultOverrideValue : properties[key].default;
|
|
88
85
|
addToValueTree(contents, key, value, message => console.error(`Conflict in default settings: ${message}`));
|
|
89
86
|
}
|
|
90
|
-
for (const key of ( Object.keys(contents))) {
|
|
87
|
+
for (const key of ( (Object.keys(contents)))) {
|
|
91
88
|
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
92
89
|
overrides.push({
|
|
93
90
|
identifiers: overrideIdentifiersFromKey(key),
|
|
94
|
-
keys: ( Object.keys(contents[key])),
|
|
91
|
+
keys: ( (Object.keys(contents[key]))),
|
|
95
92
|
contents: toValuesTree(contents[key], message => console.error(`Conflict in default settings file: ${message}`)),
|
|
96
93
|
});
|
|
97
94
|
}
|
|
@@ -102,7 +99,7 @@ class DefaultConfigurationModel extends ConfigurationModel {
|
|
|
102
99
|
class NullPolicyConfiguration {
|
|
103
100
|
constructor() {
|
|
104
101
|
this.onDidChangeConfiguration = Event.None;
|
|
105
|
-
this.configurationModel = ( new ConfigurationModel());
|
|
102
|
+
this.configurationModel = ( (new ConfigurationModel()));
|
|
106
103
|
}
|
|
107
104
|
async initialize() { return this.configurationModel; }
|
|
108
105
|
}
|
|
@@ -112,9 +109,9 @@ let PolicyConfiguration = class PolicyConfiguration extends Disposable {
|
|
|
112
109
|
this.defaultConfiguration = defaultConfiguration;
|
|
113
110
|
this.policyService = policyService;
|
|
114
111
|
this.logService = logService;
|
|
115
|
-
this._onDidChangeConfiguration = this._register(( new Emitter()));
|
|
112
|
+
this._onDidChangeConfiguration = this._register(( (new Emitter())));
|
|
116
113
|
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
117
|
-
this._configurationModel = ( new ConfigurationModel());
|
|
114
|
+
this._configurationModel = ( (new ConfigurationModel()));
|
|
118
115
|
}
|
|
119
116
|
get configurationModel() { return this._configurationModel; }
|
|
120
117
|
async initialize() {
|
|
@@ -126,7 +123,7 @@ let PolicyConfiguration = class PolicyConfiguration extends Disposable {
|
|
|
126
123
|
async registerPolicyDefinitions(properties) {
|
|
127
124
|
const policyDefinitions = {};
|
|
128
125
|
const keys = [];
|
|
129
|
-
const configurationProperties = ( Registry.as(Extensions.Configuration)).getConfigurationProperties();
|
|
126
|
+
const configurationProperties = ( (Registry.as(Extensions.Configuration))).getConfigurationProperties();
|
|
130
127
|
for (const key of properties) {
|
|
131
128
|
const config = configurationProperties[key];
|
|
132
129
|
if (!config) {
|
|
@@ -148,12 +145,12 @@ let PolicyConfiguration = class PolicyConfiguration extends Disposable {
|
|
|
148
145
|
return keys;
|
|
149
146
|
}
|
|
150
147
|
onDidChangePolicies(policyNames) {
|
|
151
|
-
const policyConfigurations = ( Registry.as(Extensions.Configuration)).getPolicyConfigurations();
|
|
148
|
+
const policyConfigurations = ( (Registry.as(Extensions.Configuration))).getPolicyConfigurations();
|
|
152
149
|
const keys = coalesce(policyNames.map(policyName => policyConfigurations.get(policyName)));
|
|
153
150
|
this.update(keys, true);
|
|
154
151
|
}
|
|
155
152
|
update(keys, trigger) {
|
|
156
|
-
const configurationProperties = ( Registry.as(Extensions.Configuration)).getConfigurationProperties();
|
|
153
|
+
const configurationProperties = ( (Registry.as(Extensions.Configuration))).getConfigurationProperties();
|
|
157
154
|
const changed = [];
|
|
158
155
|
const wasEmpty = this._configurationModel.isEmpty();
|
|
159
156
|
for (const key of keys) {
|
|
@@ -172,7 +169,7 @@ let PolicyConfiguration = class PolicyConfiguration extends Disposable {
|
|
|
172
169
|
}
|
|
173
170
|
if (changed.length) {
|
|
174
171
|
const old = this._configurationModel;
|
|
175
|
-
this._configurationModel = ( new ConfigurationModel());
|
|
172
|
+
this._configurationModel = ( (new ConfigurationModel()));
|
|
176
173
|
for (const key of old.keys) {
|
|
177
174
|
this._configurationModel.setValue(key, old.getValue(key));
|
|
178
175
|
}
|
|
@@ -190,33 +187,38 @@ let PolicyConfiguration = class PolicyConfiguration extends Disposable {
|
|
|
190
187
|
}
|
|
191
188
|
}
|
|
192
189
|
};
|
|
193
|
-
PolicyConfiguration = ( __decorate([
|
|
194
|
-
( __param(1, IPolicyService)),
|
|
195
|
-
( __param(2, ILogService))
|
|
196
|
-
], PolicyConfiguration));
|
|
190
|
+
PolicyConfiguration = ( (__decorate([
|
|
191
|
+
( (__param(1, IPolicyService))),
|
|
192
|
+
( (__param(2, ILogService)))
|
|
193
|
+
], PolicyConfiguration)));
|
|
197
194
|
class ConfigurationService extends Disposable {
|
|
198
195
|
constructor(settingsResource, fileService, policyService, logService) {
|
|
199
196
|
super();
|
|
200
197
|
this.settingsResource = settingsResource;
|
|
201
|
-
this._onDidChangeConfiguration = this._register(( new Emitter()));
|
|
198
|
+
this._onDidChangeConfiguration = this._register(( (new Emitter())));
|
|
202
199
|
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
203
|
-
this.defaultConfiguration = this._register(( new DefaultConfiguration()));
|
|
204
|
-
this.policyConfiguration = policyService instanceof NullPolicyService ? ( new NullPolicyConfiguration()) : this._register(( new PolicyConfiguration(this.defaultConfiguration, policyService, logService)));
|
|
205
|
-
this.userConfiguration = this._register(( new UserSettings(this.settingsResource, undefined, extUriBiasedIgnorePathCase, fileService)));
|
|
206
|
-
this.configuration = ( new Configuration(
|
|
200
|
+
this.defaultConfiguration = this._register(( (new DefaultConfiguration())));
|
|
201
|
+
this.policyConfiguration = policyService instanceof NullPolicyService ? ( (new NullPolicyConfiguration())) : this._register(( (new PolicyConfiguration(this.defaultConfiguration, policyService, logService))));
|
|
202
|
+
this.userConfiguration = this._register(( (new UserSettings(this.settingsResource, undefined, extUriBiasedIgnorePathCase, fileService))));
|
|
203
|
+
this.configuration = ( (new Configuration(
|
|
207
204
|
this.defaultConfiguration.configurationModel,
|
|
208
205
|
this.policyConfiguration.configurationModel,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
));
|
|
212
|
-
this.reloadConfigurationScheduler = this._register(( new RunOnceScheduler(() => this.reloadConfiguration(), 50)));
|
|
206
|
+
(new ConfigurationModel()),
|
|
207
|
+
(new ConfigurationModel())
|
|
208
|
+
)));
|
|
209
|
+
this.reloadConfigurationScheduler = this._register(( (new RunOnceScheduler(() => this.reloadConfiguration(), 50))));
|
|
213
210
|
this._register(this.defaultConfiguration.onDidChangeConfiguration(({ defaults, properties }) => this.onDidDefaultConfigurationChange(defaults, properties)));
|
|
214
211
|
this._register(this.policyConfiguration.onDidChangeConfiguration(model => this.onDidPolicyConfigurationChange(model)));
|
|
215
212
|
this._register(this.userConfiguration.onDidChange(() => this.reloadConfigurationScheduler.schedule()));
|
|
216
213
|
}
|
|
217
214
|
async initialize() {
|
|
218
215
|
const [defaultModel, policyModel, userModel] = await Promise.all([this.defaultConfiguration.initialize(), this.policyConfiguration.initialize(), this.userConfiguration.loadConfiguration()]);
|
|
219
|
-
this.configuration = ( new Configuration(
|
|
216
|
+
this.configuration = ( (new Configuration(
|
|
217
|
+
defaultModel,
|
|
218
|
+
policyModel,
|
|
219
|
+
(new ConfigurationModel()),
|
|
220
|
+
userModel
|
|
221
|
+
)));
|
|
220
222
|
}
|
|
221
223
|
getConfigurationData() {
|
|
222
224
|
return this.configuration.toData();
|
|
@@ -227,13 +229,15 @@ class ConfigurationService extends Disposable {
|
|
|
227
229
|
return this.configuration.getValue(section, overrides, undefined);
|
|
228
230
|
}
|
|
229
231
|
updateValue(key, value, arg3, arg4) {
|
|
230
|
-
return Promise.reject(( new Error('not supported')));
|
|
232
|
+
return Promise.reject(( (new Error('not supported'))));
|
|
231
233
|
}
|
|
232
234
|
inspect(key) {
|
|
233
235
|
return this.configuration.inspect(key, {}, undefined);
|
|
234
236
|
}
|
|
235
237
|
keys() {
|
|
236
|
-
return (
|
|
238
|
+
return (
|
|
239
|
+
(this.configuration.keys(undefined))
|
|
240
|
+
);
|
|
237
241
|
}
|
|
238
242
|
async reloadConfiguration() {
|
|
239
243
|
const configurationModel = await this.userConfiguration.loadConfiguration();
|
|
@@ -255,7 +259,7 @@ class ConfigurationService extends Disposable {
|
|
|
255
259
|
this.trigger(change, previous, 7 );
|
|
256
260
|
}
|
|
257
261
|
trigger(configurationChange, previous, source) {
|
|
258
|
-
const event = ( new ConfigurationChangeEvent(configurationChange, { data: previous }, this.configuration));
|
|
262
|
+
const event = ( (new ConfigurationChangeEvent(configurationChange, { data: previous }, this.configuration)));
|
|
259
263
|
event.source = source;
|
|
260
264
|
event.sourceConfig = this.getTargetConfiguration(source);
|
|
261
265
|
this._onDidChangeConfiguration.fire(event);
|
|
@@ -276,13 +280,13 @@ let TextResourceConfigurationService = class TextResourceConfigurationService ex
|
|
|
276
280
|
this.configurationService = configurationService;
|
|
277
281
|
this.modelService = modelService;
|
|
278
282
|
this.languageService = languageService;
|
|
279
|
-
this._onDidChangeConfiguration = this._register(( new Emitter()));
|
|
283
|
+
this._onDidChangeConfiguration = this._register(( (new Emitter())));
|
|
280
284
|
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
281
285
|
this._register(this.configurationService.onDidChangeConfiguration(e => this._onDidChangeConfiguration.fire(this.toResourceConfigurationChangeEvent(e))));
|
|
282
286
|
}
|
|
283
287
|
getValue(resource, arg2, arg3) {
|
|
284
288
|
if (typeof arg3 === 'string') {
|
|
285
|
-
return this._getValue(resource, Position.isIPosition(arg2) ? arg2 : null, arg3);
|
|
289
|
+
return this._getValue(resource, Position$2.isIPosition(arg2) ? arg2 : null, arg3);
|
|
286
290
|
}
|
|
287
291
|
return this._getValue(resource, null, typeof arg2 === 'string' ? arg2 : undefined);
|
|
288
292
|
}
|
|
@@ -369,11 +373,11 @@ let TextResourceConfigurationService = class TextResourceConfigurationService ex
|
|
|
369
373
|
};
|
|
370
374
|
}
|
|
371
375
|
};
|
|
372
|
-
TextResourceConfigurationService = ( __decorate([
|
|
373
|
-
( __param(0, IConfigurationService)),
|
|
374
|
-
( __param(1, IModelService)),
|
|
375
|
-
( __param(2, ILanguageService))
|
|
376
|
-
], TextResourceConfigurationService));
|
|
376
|
+
TextResourceConfigurationService = ( (__decorate([
|
|
377
|
+
( (__param(0, IConfigurationService))),
|
|
378
|
+
( (__param(1, IModelService))),
|
|
379
|
+
( (__param(2, ILanguageService)))
|
|
380
|
+
], TextResourceConfigurationService)));
|
|
377
381
|
const FOLDER_CONFIG_FOLDER_NAME = '.vscode';
|
|
378
382
|
const defaultSettingsSchemaId = 'vscode://schemas/settings/default';
|
|
379
383
|
const userSettingsSchemaId = 'vscode://schemas/settings/user';
|
|
@@ -388,283 +392,6 @@ WORKSPACE_STANDALONE_CONFIGURATIONS[TASKS_CONFIGURATION_KEY] = `${FOLDER_CONFIG_
|
|
|
388
392
|
WORKSPACE_STANDALONE_CONFIGURATIONS[LAUNCH_CONFIGURATION_KEY] = `${FOLDER_CONFIG_FOLDER_NAME}/${LAUNCH_CONFIGURATION_KEY}.json`;
|
|
389
393
|
const USER_STANDALONE_CONFIGURATIONS = Object.create(null);
|
|
390
394
|
USER_STANDALONE_CONFIGURATIONS[TASKS_CONFIGURATION_KEY] = `${TASKS_CONFIGURATION_KEY}.json`;
|
|
391
|
-
class Memento {
|
|
392
|
-
constructor(id, storageService) {
|
|
393
|
-
this.storageService = storageService;
|
|
394
|
-
this.id = Memento.COMMON_PREFIX + id;
|
|
395
|
-
}
|
|
396
|
-
getMemento(scope, target) {
|
|
397
|
-
switch (scope) {
|
|
398
|
-
case 1 : {
|
|
399
|
-
let workspaceMemento = Memento.workspaceMementos.get(this.id);
|
|
400
|
-
if (!workspaceMemento) {
|
|
401
|
-
workspaceMemento = ( new ScopedMemento(this.id, scope, target, this.storageService));
|
|
402
|
-
Memento.workspaceMementos.set(this.id, workspaceMemento);
|
|
403
|
-
}
|
|
404
|
-
return workspaceMemento.getMemento();
|
|
405
|
-
}
|
|
406
|
-
case 0 : {
|
|
407
|
-
let profileMemento = Memento.profileMementos.get(this.id);
|
|
408
|
-
if (!profileMemento) {
|
|
409
|
-
profileMemento = ( new ScopedMemento(this.id, scope, target, this.storageService));
|
|
410
|
-
Memento.profileMementos.set(this.id, profileMemento);
|
|
411
|
-
}
|
|
412
|
-
return profileMemento.getMemento();
|
|
413
|
-
}
|
|
414
|
-
case -1 : {
|
|
415
|
-
let applicationMemento = Memento.applicationMementos.get(this.id);
|
|
416
|
-
if (!applicationMemento) {
|
|
417
|
-
applicationMemento = ( new ScopedMemento(this.id, scope, target, this.storageService));
|
|
418
|
-
Memento.applicationMementos.set(this.id, applicationMemento);
|
|
419
|
-
}
|
|
420
|
-
return applicationMemento.getMemento();
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
saveMemento() {
|
|
425
|
-
Memento.workspaceMementos.get(this.id)?.save();
|
|
426
|
-
Memento.profileMementos.get(this.id)?.save();
|
|
427
|
-
Memento.applicationMementos.get(this.id)?.save();
|
|
428
|
-
}
|
|
429
|
-
static clear(scope) {
|
|
430
|
-
switch (scope) {
|
|
431
|
-
case 1 :
|
|
432
|
-
Memento.workspaceMementos.clear();
|
|
433
|
-
break;
|
|
434
|
-
case 0 :
|
|
435
|
-
Memento.profileMementos.clear();
|
|
436
|
-
break;
|
|
437
|
-
case -1 :
|
|
438
|
-
Memento.applicationMementos.clear();
|
|
439
|
-
break;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
Memento.applicationMementos = ( new Map());
|
|
444
|
-
Memento.profileMementos = ( new Map());
|
|
445
|
-
Memento.workspaceMementos = ( new Map());
|
|
446
|
-
Memento.COMMON_PREFIX = 'memento/';
|
|
447
|
-
class ScopedMemento {
|
|
448
|
-
constructor(id, scope, target, storageService) {
|
|
449
|
-
this.id = id;
|
|
450
|
-
this.scope = scope;
|
|
451
|
-
this.target = target;
|
|
452
|
-
this.storageService = storageService;
|
|
453
|
-
this.mementoObj = this.load();
|
|
454
|
-
}
|
|
455
|
-
getMemento() {
|
|
456
|
-
return this.mementoObj;
|
|
457
|
-
}
|
|
458
|
-
load() {
|
|
459
|
-
const memento = this.storageService.get(this.id, this.scope);
|
|
460
|
-
if (memento) {
|
|
461
|
-
try {
|
|
462
|
-
return JSON.parse(memento);
|
|
463
|
-
}
|
|
464
|
-
catch (error) {
|
|
465
|
-
onUnexpectedError(`[memento]: failed to parse contents: ${error} (id: ${this.id}, scope: ${this.scope}, contents: ${memento})`);
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
return {};
|
|
469
|
-
}
|
|
470
|
-
save() {
|
|
471
|
-
if (!isEmptyObject(this.mementoObj)) {
|
|
472
|
-
this.storageService.store(this.id, JSON.stringify(this.mementoObj), this.scope, this.target);
|
|
473
|
-
}
|
|
474
|
-
else {
|
|
475
|
-
this.storageService.remove(this.id, this.scope);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
const ASSIGNMENT_STORAGE_KEY = 'VSCode.ABExp.FeatureData';
|
|
480
|
-
const ASSIGNMENT_REFETCH_INTERVAL = 0;
|
|
481
|
-
var TargetPopulation;
|
|
482
|
-
( (function(TargetPopulation) {
|
|
483
|
-
TargetPopulation["Team"] = "team";
|
|
484
|
-
TargetPopulation["Internal"] = "internal";
|
|
485
|
-
TargetPopulation["Insiders"] = "insider";
|
|
486
|
-
TargetPopulation["Public"] = "public";
|
|
487
|
-
})(TargetPopulation || (TargetPopulation = {})));
|
|
488
|
-
var Filters;
|
|
489
|
-
( (function(Filters) {
|
|
490
|
-
Filters["Market"] = "X-MSEdge-Market";
|
|
491
|
-
Filters["CorpNet"] = "X-FD-Corpnet";
|
|
492
|
-
Filters["ApplicationVersion"] = "X-VSCode-AppVersion";
|
|
493
|
-
Filters["Build"] = "X-VSCode-Build";
|
|
494
|
-
Filters["ClientId"] = "X-MSEdge-ClientId";
|
|
495
|
-
Filters["ExtensionName"] = "X-VSCode-ExtensionName";
|
|
496
|
-
Filters["ExtensionVersion"] = "X-VSCode-ExtensionVersion";
|
|
497
|
-
Filters["Language"] = "X-VSCode-Language";
|
|
498
|
-
Filters["TargetPopulation"] = "X-VSCode-TargetPopulation";
|
|
499
|
-
})(Filters || (Filters = {})));
|
|
500
|
-
class AssignmentFilterProvider {
|
|
501
|
-
constructor(version, appName, machineId, targetPopulation) {
|
|
502
|
-
this.version = version;
|
|
503
|
-
this.appName = appName;
|
|
504
|
-
this.machineId = machineId;
|
|
505
|
-
this.targetPopulation = targetPopulation;
|
|
506
|
-
}
|
|
507
|
-
getFilterValue(filter) {
|
|
508
|
-
switch (filter) {
|
|
509
|
-
case Filters.ApplicationVersion:
|
|
510
|
-
return this.version;
|
|
511
|
-
case Filters.Build:
|
|
512
|
-
return this.appName;
|
|
513
|
-
case Filters.ClientId:
|
|
514
|
-
return this.machineId;
|
|
515
|
-
case Filters.Language:
|
|
516
|
-
return language;
|
|
517
|
-
case Filters.ExtensionName:
|
|
518
|
-
return 'vscode-core';
|
|
519
|
-
case Filters.ExtensionVersion:
|
|
520
|
-
return '999999.0';
|
|
521
|
-
case Filters.TargetPopulation:
|
|
522
|
-
return this.targetPopulation;
|
|
523
|
-
default:
|
|
524
|
-
return '';
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
getFilters() {
|
|
528
|
-
const filters = ( new Map());
|
|
529
|
-
const filterValues = ( Object.values(Filters));
|
|
530
|
-
for (const value of filterValues) {
|
|
531
|
-
filters.set(value, this.getFilterValue(value));
|
|
532
|
-
}
|
|
533
|
-
return filters;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
class BaseAssignmentService {
|
|
537
|
-
constructor(getMachineId, configurationService, productService, telemetry, keyValueStorage) {
|
|
538
|
-
this.getMachineId = getMachineId;
|
|
539
|
-
this.configurationService = configurationService;
|
|
540
|
-
this.productService = productService;
|
|
541
|
-
this.telemetry = telemetry;
|
|
542
|
-
this.keyValueStorage = keyValueStorage;
|
|
543
|
-
this.networkInitialized = false;
|
|
544
|
-
if (productService.tasConfig && this.experimentsEnabled && getTelemetryLevel(this.configurationService) === 3 ) {
|
|
545
|
-
this.tasClient = this.setupTASClient();
|
|
546
|
-
}
|
|
547
|
-
const overrideDelaySetting = this.configurationService.getValue('experiments.overrideDelay');
|
|
548
|
-
const overrideDelay = typeof overrideDelaySetting === 'number' ? overrideDelaySetting : 0;
|
|
549
|
-
this.overrideInitDelay = ( new Promise(resolve => setTimeout(resolve, overrideDelay)));
|
|
550
|
-
}
|
|
551
|
-
get experimentsEnabled() {
|
|
552
|
-
return true;
|
|
553
|
-
}
|
|
554
|
-
async getTreatment(name) {
|
|
555
|
-
await this.overrideInitDelay;
|
|
556
|
-
const override = this.configurationService.getValue('experiments.override.' + name);
|
|
557
|
-
if (override !== undefined) {
|
|
558
|
-
return override;
|
|
559
|
-
}
|
|
560
|
-
if (!this.tasClient) {
|
|
561
|
-
return undefined;
|
|
562
|
-
}
|
|
563
|
-
if (!this.experimentsEnabled) {
|
|
564
|
-
return undefined;
|
|
565
|
-
}
|
|
566
|
-
let result;
|
|
567
|
-
const client = await this.tasClient;
|
|
568
|
-
if (this.networkInitialized) {
|
|
569
|
-
result = client.getTreatmentVariable('vscode', name);
|
|
570
|
-
}
|
|
571
|
-
else {
|
|
572
|
-
result = await client.getTreatmentVariableAsync('vscode', name, true);
|
|
573
|
-
}
|
|
574
|
-
result = client.getTreatmentVariable('vscode', name);
|
|
575
|
-
return result;
|
|
576
|
-
}
|
|
577
|
-
async setupTASClient() {
|
|
578
|
-
const targetPopulation = this.productService.quality === 'stable' ? TargetPopulation.Public : TargetPopulation.Insiders;
|
|
579
|
-
const machineId = await this.getMachineId();
|
|
580
|
-
const filterProvider = ( new AssignmentFilterProvider(
|
|
581
|
-
this.productService.version,
|
|
582
|
-
this.productService.nameLong,
|
|
583
|
-
machineId,
|
|
584
|
-
targetPopulation
|
|
585
|
-
));
|
|
586
|
-
const tasConfig = this.productService.tasConfig;
|
|
587
|
-
const tasClient = new ((await import('tas-client-umd').then(module => module.default ?? module)).ExperimentationService)({
|
|
588
|
-
filterProviders: [filterProvider],
|
|
589
|
-
telemetry: this.telemetry,
|
|
590
|
-
storageKey: ASSIGNMENT_STORAGE_KEY,
|
|
591
|
-
keyValueStorage: this.keyValueStorage,
|
|
592
|
-
featuresTelemetryPropertyName: tasConfig.featuresTelemetryPropertyName,
|
|
593
|
-
assignmentContextTelemetryPropertyName: tasConfig.assignmentContextTelemetryPropertyName,
|
|
594
|
-
telemetryEventName: tasConfig.telemetryEventName,
|
|
595
|
-
endpoint: tasConfig.endpoint,
|
|
596
|
-
refetchInterval: ASSIGNMENT_REFETCH_INTERVAL,
|
|
597
|
-
});
|
|
598
|
-
await tasClient.initializePromise;
|
|
599
|
-
tasClient.initialFetch.then(() => this.networkInitialized = true);
|
|
600
|
-
return tasClient;
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
const IWorkbenchAssignmentService = ( createDecorator('WorkbenchAssignmentService'));
|
|
604
|
-
class MementoKeyValueStorage {
|
|
605
|
-
constructor(memento) {
|
|
606
|
-
this.memento = memento;
|
|
607
|
-
this.mementoObj = memento.getMemento(-1 , 1 );
|
|
608
|
-
}
|
|
609
|
-
async getValue(key, defaultValue) {
|
|
610
|
-
const value = await this.mementoObj[key];
|
|
611
|
-
return value || defaultValue;
|
|
612
|
-
}
|
|
613
|
-
setValue(key, value) {
|
|
614
|
-
this.mementoObj[key] = value;
|
|
615
|
-
this.memento.saveMemento();
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
class WorkbenchAssignmentServiceTelemetry {
|
|
619
|
-
constructor(telemetryService, productService) {
|
|
620
|
-
this.telemetryService = telemetryService;
|
|
621
|
-
this.productService = productService;
|
|
622
|
-
}
|
|
623
|
-
get assignmentContext() {
|
|
624
|
-
return this._lastAssignmentContext?.split(';');
|
|
625
|
-
}
|
|
626
|
-
setSharedProperty(name, value) {
|
|
627
|
-
if (name === this.productService.tasConfig?.assignmentContextTelemetryPropertyName) {
|
|
628
|
-
this._lastAssignmentContext = value;
|
|
629
|
-
}
|
|
630
|
-
this.telemetryService.setExperimentProperty(name, value);
|
|
631
|
-
}
|
|
632
|
-
postEvent(eventName, props) {
|
|
633
|
-
const data = {};
|
|
634
|
-
for (const [key, value] of props.entries()) {
|
|
635
|
-
data[key] = value;
|
|
636
|
-
}
|
|
637
|
-
this.telemetryService.publicLog(eventName, data);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
(class WorkbenchAssignmentService extends BaseAssignmentService {
|
|
641
|
-
constructor(telemetryService, storageService, configurationService, productService) {
|
|
642
|
-
super(() => {
|
|
643
|
-
return telemetryService.getTelemetryInfo().then(telemetryInfo => {
|
|
644
|
-
return telemetryInfo.machineId;
|
|
645
|
-
});
|
|
646
|
-
}, configurationService, productService, ( new WorkbenchAssignmentServiceTelemetry(telemetryService, productService)), ( new MementoKeyValueStorage(( new Memento('experiment.service.memento', storageService)))));
|
|
647
|
-
this.telemetryService = telemetryService;
|
|
648
|
-
}
|
|
649
|
-
get experimentsEnabled() {
|
|
650
|
-
return this.configurationService.getValue('workbench.enableExperiments') === true;
|
|
651
|
-
}
|
|
652
|
-
async getTreatment(name) {
|
|
653
|
-
const result = await super.getTreatment(name);
|
|
654
|
-
this.telemetryService.publicLog2('tasClientReadTreatmentComplete', { treatmentName: name, treatmentValue: JSON.stringify(result) });
|
|
655
|
-
return result;
|
|
656
|
-
}
|
|
657
|
-
async getCurrentExperiments() {
|
|
658
|
-
if (!this.tasClient) {
|
|
659
|
-
return undefined;
|
|
660
|
-
}
|
|
661
|
-
if (!this.experimentsEnabled) {
|
|
662
|
-
return undefined;
|
|
663
|
-
}
|
|
664
|
-
await this.tasClient;
|
|
665
|
-
return this.telemetry?.assignmentContext;
|
|
666
|
-
}
|
|
667
|
-
});
|
|
668
395
|
let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchemasContribution extends Disposable {
|
|
669
396
|
constructor(workspaceContextService, environmentService, workspaceTrustManagementService) {
|
|
670
397
|
super();
|
|
@@ -672,13 +399,13 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
672
399
|
this.environmentService = environmentService;
|
|
673
400
|
this.workspaceTrustManagementService = workspaceTrustManagementService;
|
|
674
401
|
this.registerConfigurationSchemas();
|
|
675
|
-
const configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
402
|
+
const configurationRegistry = ( (Registry.as(Extensions.Configuration)));
|
|
676
403
|
this._register(configurationRegistry.onDidUpdateConfiguration(e => this.registerConfigurationSchemas()));
|
|
677
404
|
this._register(configurationRegistry.onDidSchemaChange(e => this.registerConfigurationSchemas()));
|
|
678
405
|
this._register(workspaceTrustManagementService.onDidChangeTrust(() => this.registerConfigurationSchemas()));
|
|
679
406
|
}
|
|
680
407
|
registerConfigurationSchemas() {
|
|
681
|
-
const jsonRegistry = ( Registry.as(Extensions$1.JSONContribution));
|
|
408
|
+
const jsonRegistry = ( (Registry.as(Extensions$1.JSONContribution)));
|
|
682
409
|
const allSettingsSchema = {
|
|
683
410
|
properties: allSettings.properties,
|
|
684
411
|
patternProperties: allSettings.patternProperties,
|
|
@@ -735,14 +462,14 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
735
462
|
allowComments: true
|
|
736
463
|
};
|
|
737
464
|
jsonRegistry.registerSchema(defaultSettingsSchemaId, {
|
|
738
|
-
properties: ( Object.keys(allSettings.properties)).reduce((result, key) => {
|
|
465
|
+
properties: ( (Object.keys(allSettings.properties))).reduce((result, key) => {
|
|
739
466
|
result[key] = {
|
|
740
467
|
...allSettings.properties[key],
|
|
741
468
|
deprecationMessage: undefined
|
|
742
469
|
};
|
|
743
470
|
return result;
|
|
744
471
|
}, {}),
|
|
745
|
-
patternProperties: ( Object.keys(allSettings.patternProperties)).reduce((result, key) => {
|
|
472
|
+
patternProperties: ( (Object.keys(allSettings.patternProperties))).reduce((result, key) => {
|
|
746
473
|
result[key] = {
|
|
747
474
|
...allSettings.patternProperties[key],
|
|
748
475
|
deprecationMessage: undefined
|
|
@@ -776,10 +503,10 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
776
503
|
}
|
|
777
504
|
jsonRegistry.registerSchema(configurationDefaultsSchemaId, {
|
|
778
505
|
type: 'object',
|
|
779
|
-
description: ( localize(
|
|
506
|
+
description: ( (localize(
|
|
780
507
|
'configurationDefaults.description',
|
|
781
508
|
'Contribute defaults for configurations'
|
|
782
|
-
)),
|
|
509
|
+
))),
|
|
783
510
|
properties: {
|
|
784
511
|
...machineOverridableSettings.properties,
|
|
785
512
|
...windowSettings.properties,
|
|
@@ -808,53 +535,16 @@ let RegisterConfigurationSchemasContribution = class RegisterConfigurationSchema
|
|
|
808
535
|
return result;
|
|
809
536
|
}
|
|
810
537
|
};
|
|
811
|
-
RegisterConfigurationSchemasContribution = ( __decorate([
|
|
812
|
-
( __param(0, IWorkspaceContextService)),
|
|
813
|
-
( __param(1, IWorkbenchEnvironmentService)),
|
|
814
|
-
( __param(2, IWorkspaceTrustManagementService))
|
|
815
|
-
], RegisterConfigurationSchemasContribution));
|
|
816
|
-
let UpdateExperimentalSettingsDefaults = class UpdateExperimentalSettingsDefaults extends Disposable {
|
|
817
|
-
constructor(workbenchAssignmentService) {
|
|
818
|
-
super();
|
|
819
|
-
this.workbenchAssignmentService = workbenchAssignmentService;
|
|
820
|
-
this.processedExperimentalSettings = ( new Set());
|
|
821
|
-
this.configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
822
|
-
this.processExperimentalSettings(( Object.keys(this.configurationRegistry.getConfigurationProperties())));
|
|
823
|
-
this._register(this.configurationRegistry.onDidUpdateConfiguration(({ properties }) => this.processExperimentalSettings(properties)));
|
|
824
|
-
}
|
|
825
|
-
async processExperimentalSettings(properties) {
|
|
826
|
-
const overrides = {};
|
|
827
|
-
const allProperties = this.configurationRegistry.getConfigurationProperties();
|
|
828
|
-
for (const property of properties) {
|
|
829
|
-
const schema = allProperties[property];
|
|
830
|
-
if (!schema?.tags?.includes('experimental')) {
|
|
831
|
-
continue;
|
|
832
|
-
}
|
|
833
|
-
if (this.processedExperimentalSettings.has(property)) {
|
|
834
|
-
continue;
|
|
835
|
-
}
|
|
836
|
-
this.processedExperimentalSettings.add(property);
|
|
837
|
-
try {
|
|
838
|
-
const value = await this.workbenchAssignmentService.getTreatment(`config.${property}`);
|
|
839
|
-
if (!isUndefined(value) && !equals(value, schema.default)) {
|
|
840
|
-
overrides[property] = value;
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
catch (error) { }
|
|
844
|
-
}
|
|
845
|
-
if (( Object.keys(overrides)).length) {
|
|
846
|
-
this.configurationRegistry.registerDefaultConfigurations([{ overrides, source: ( localize('experimental', "Experiments")) }]);
|
|
847
|
-
}
|
|
848
|
-
}
|
|
849
|
-
};
|
|
850
|
-
UpdateExperimentalSettingsDefaults = ( __decorate([
|
|
851
|
-
( __param(0, IWorkbenchAssignmentService))
|
|
852
|
-
], UpdateExperimentalSettingsDefaults));
|
|
538
|
+
RegisterConfigurationSchemasContribution = ( (__decorate([
|
|
539
|
+
( (__param(0, IWorkspaceContextService))),
|
|
540
|
+
( (__param(1, IWorkbenchEnvironmentService))),
|
|
541
|
+
( (__param(2, IWorkspaceTrustManagementService)))
|
|
542
|
+
], RegisterConfigurationSchemasContribution)));
|
|
853
543
|
function updateUserConfiguration(configurationJson) {
|
|
854
544
|
const userDataProfilesService = StandaloneServices.get(IUserDataProfilesService);
|
|
855
545
|
void StandaloneServices.get(IFileService).writeFile(userDataProfilesService.defaultProfile.settingsResource, VSBuffer.fromString(configurationJson));
|
|
856
546
|
}
|
|
857
|
-
const configurationRegistry = Registry.as(Extensions.Configuration);
|
|
547
|
+
const configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
858
548
|
let InjectedConfigurationService = class InjectedConfigurationService extends ConfigurationService {
|
|
859
549
|
constructor(userDataProfilesService, fileService, policyService, logService) {
|
|
860
550
|
super(userDataProfilesService.defaultProfile.settingsResource, fileService, policyService, logService);
|
|
@@ -873,12 +563,12 @@ let InjectedConfigurationService = class InjectedConfigurationService extends Co
|
|
|
873
563
|
return Promise.reject(new Error('not supported'));
|
|
874
564
|
}
|
|
875
565
|
};
|
|
876
|
-
InjectedConfigurationService = __decorate([
|
|
877
|
-
__param(0, IUserDataProfilesService),
|
|
878
|
-
__param(1, IFileService),
|
|
879
|
-
__param(2, IPolicyService),
|
|
880
|
-
__param(3, ILogService)
|
|
881
|
-
], InjectedConfigurationService);
|
|
566
|
+
InjectedConfigurationService = ( __decorate([
|
|
567
|
+
( __param(0, IUserDataProfilesService)),
|
|
568
|
+
( __param(1, IFileService)),
|
|
569
|
+
( __param(2, IPolicyService)),
|
|
570
|
+
( __param(3, ILogService))
|
|
571
|
+
], InjectedConfigurationService));
|
|
882
572
|
function initialize(instantiationService) {
|
|
883
573
|
instantiationService.createInstance(RegisterConfigurationSchemasContribution);
|
|
884
574
|
}
|
|
@@ -887,8 +577,8 @@ function getServiceOverride() {
|
|
|
887
577
|
return {
|
|
888
578
|
...getServiceOverride$1(),
|
|
889
579
|
...getServiceOverride$2(),
|
|
890
|
-
[IConfigurationService.toString()]: new SyncDescriptor(InjectedConfigurationService),
|
|
891
|
-
[ITextResourceConfigurationService.toString()]: new SyncDescriptor(TextResourceConfigurationService)
|
|
580
|
+
[( IConfigurationService.toString())]: new SyncDescriptor(InjectedConfigurationService),
|
|
581
|
+
[( ITextResourceConfigurationService.toString())]: new SyncDescriptor(TextResourceConfigurationService)
|
|
892
582
|
};
|
|
893
583
|
}
|
|
894
584
|
export { configurationRegistry, getServiceOverride as default, updateUserConfiguration };
|