@codingame/monaco-vscode-api 1.68.7 → 1.69.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/README.md +102 -7
- package/dist/api.js +481 -9583
- package/dist/configuration.d.ts +488 -0
- package/dist/configuration.js +409 -0
- package/dist/extHost.js +14880 -0
- package/dist/files.js +1325 -0
- package/dist/injection.js +15 -0
- package/dist/jsonErrorMessages.js +17 -0
- package/dist/keybindings.d.ts +502 -0
- package/dist/keybindings.js +2352 -0
- package/dist/languageConfiguration.d.ts +158 -0
- package/dist/languageConfiguration.js +929 -0
- package/dist/languageService.js +340 -0
- package/dist/languages.d.ts +477 -0
- package/dist/languages.js +21 -0
- package/dist/layoutService.js +4 -0
- package/dist/messages.d.ts +7 -0
- package/dist/messages.js +3624 -0
- package/dist/missing-services.js +7293 -0
- package/dist/modelEditor.d.ts +164 -0
- package/dist/modelEditor.js +739 -0
- package/dist/monaco.d.ts +4795 -0
- package/dist/monaco.js +243 -0
- package/dist/services.d.ts +14806 -2098
- package/dist/services.js +22 -25
- package/dist/services2.js +423 -0
- package/dist/snippets.d.ts +466 -0
- package/dist/snippets.js +903 -0
- package/dist/textmate.d.ts +682 -0
- package/dist/textmate.js +740 -0
- package/dist/theme.d.ts +22 -0
- package/dist/theme.js +4167 -0
- package/dist/tokenClassification.d.ts +479 -0
- package/dist/tokenClassification.js +304 -0
- package/dist/tokenClassificationRegistry.js +472 -0
- package/dist/tools.js +17 -0
- package/dist/tslib.es6.js +21 -0
- package/dist/workbenchThemeService.js +46 -0
- package/package.json +107 -24
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { _ as __decorate, a as __param } from './tslib.es6.js';
|
|
2
|
+
import { j as IPolicyService, k as IUserDataProfilesService, E as Emitter, l as isEmptyObject, m as NullPolicyService, U as UserSettings } from './missing-services.js';
|
|
3
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
5
|
+
import { Extensions, OVERRIDE_PROPERTY_REGEX, overrideIdentifiersFromKey } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
6
|
+
import { ConfigurationModel, Configuration, ConfigurationChangeEvent } from 'monaco-editor/esm/vs/platform/configuration/common/configurationModels.js';
|
|
7
|
+
import { IConfigurationService, addToValueTree, toValuesTree } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
8
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
9
|
+
import { coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
10
|
+
import { equals } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
11
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
12
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
13
|
+
import { isArray } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
14
|
+
import { extUriBiasedIgnorePathCase } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
15
|
+
import { RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
16
|
+
import { bf as Position$2 } from './extHost.js';
|
|
17
|
+
export { bg as ConfigurationScope } from './extHost.js';
|
|
18
|
+
import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
|
|
19
|
+
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
20
|
+
import { g as getServiceOverride$1 } from './files.js';
|
|
21
|
+
import { I as IFileService } from './services2.js';
|
|
22
|
+
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
23
|
+
import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
|
|
24
|
+
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
25
|
+
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
26
|
+
function isConfigurationOverrides(thing) {
|
|
27
|
+
return thing
|
|
28
|
+
&& typeof thing === 'object'
|
|
29
|
+
&& (!thing.overrideIdentifier || typeof thing.overrideIdentifier === 'string')
|
|
30
|
+
&& (!thing.resource || thing.resource instanceof URI);
|
|
31
|
+
}
|
|
32
|
+
function isConfigurationUpdateOverrides(thing) {
|
|
33
|
+
return thing
|
|
34
|
+
&& typeof thing === 'object'
|
|
35
|
+
&& (!thing.overrideIdentifiers || isArray(thing.overrideIdentifiers))
|
|
36
|
+
&& !thing.overrideIdentifier
|
|
37
|
+
&& (!thing.resource || thing.resource instanceof URI);
|
|
38
|
+
}
|
|
39
|
+
class DefaultConfiguration extends Disposable {
|
|
40
|
+
constructor() {
|
|
41
|
+
super(...arguments);
|
|
42
|
+
this._onDidChangeConfiguration = this._register(( (new Emitter())));
|
|
43
|
+
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
44
|
+
}
|
|
45
|
+
get configurationModel() {
|
|
46
|
+
if (!this._configurationModel) {
|
|
47
|
+
this._configurationModel = ( (new DefaultConfigurationModel(this.getConfigurationDefaultOverrides())));
|
|
48
|
+
}
|
|
49
|
+
return this._configurationModel;
|
|
50
|
+
}
|
|
51
|
+
async initialize() {
|
|
52
|
+
this._configurationModel = undefined;
|
|
53
|
+
this._register(( (Registry.as(Extensions.Configuration))).onDidUpdateConfiguration(({ properties, defaultsOverrides }) => this.onDidUpdateConfiguration(properties, defaultsOverrides)));
|
|
54
|
+
return this.configurationModel;
|
|
55
|
+
}
|
|
56
|
+
reload() {
|
|
57
|
+
this._configurationModel = undefined;
|
|
58
|
+
return this.configurationModel;
|
|
59
|
+
}
|
|
60
|
+
onDidUpdateConfiguration(properties, defaultsOverrides) {
|
|
61
|
+
this._configurationModel = undefined;
|
|
62
|
+
this._onDidChangeConfiguration.fire({ defaults: this.configurationModel, properties });
|
|
63
|
+
}
|
|
64
|
+
getConfigurationDefaultOverrides() {
|
|
65
|
+
return {};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
class DefaultConfigurationModel extends ConfigurationModel {
|
|
69
|
+
constructor(configurationDefaultsOverrides = {}) {
|
|
70
|
+
const properties = ( (Registry.as(Extensions.Configuration))).getConfigurationProperties();
|
|
71
|
+
const keys = ( (Object.keys(properties)));
|
|
72
|
+
const contents = Object.create(null);
|
|
73
|
+
const overrides = [];
|
|
74
|
+
for (const key in properties) {
|
|
75
|
+
const defaultOverrideValue = configurationDefaultsOverrides[key];
|
|
76
|
+
const value = defaultOverrideValue !== undefined ? defaultOverrideValue : properties[key].default;
|
|
77
|
+
addToValueTree(contents, key, value, message => console.error(`Conflict in default settings: ${message}`));
|
|
78
|
+
}
|
|
79
|
+
for (const key of ( (Object.keys(contents)))) {
|
|
80
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
81
|
+
overrides.push({
|
|
82
|
+
identifiers: overrideIdentifiersFromKey(key),
|
|
83
|
+
keys: ( (Object.keys(contents[key]))),
|
|
84
|
+
contents: toValuesTree(contents[key], message => console.error(`Conflict in default settings file: ${message}`)),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
super(contents, keys, overrides);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
class NullPolicyConfiguration {
|
|
92
|
+
constructor() {
|
|
93
|
+
this.onDidChangeConfiguration = Event.None;
|
|
94
|
+
this.configurationModel = ( (new ConfigurationModel()));
|
|
95
|
+
}
|
|
96
|
+
async initialize() { return this.configurationModel; }
|
|
97
|
+
}
|
|
98
|
+
let PolicyConfiguration = class PolicyConfiguration extends Disposable {
|
|
99
|
+
constructor(defaultConfiguration, policyService, logService) {
|
|
100
|
+
super();
|
|
101
|
+
this.defaultConfiguration = defaultConfiguration;
|
|
102
|
+
this.policyService = policyService;
|
|
103
|
+
this.logService = logService;
|
|
104
|
+
this._onDidChangeConfiguration = this._register(( (new Emitter())));
|
|
105
|
+
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
106
|
+
this._configurationModel = ( (new ConfigurationModel()));
|
|
107
|
+
}
|
|
108
|
+
get configurationModel() { return this._configurationModel; }
|
|
109
|
+
async initialize() {
|
|
110
|
+
this.update(await this.registerPolicyDefinitions(this.defaultConfiguration.configurationModel.keys), false);
|
|
111
|
+
this._register(this.policyService.onDidChange(policyNames => this.onDidChangePolicies(policyNames)));
|
|
112
|
+
this._register(this.defaultConfiguration.onDidChangeConfiguration(async ({ properties }) => this.update(await this.registerPolicyDefinitions(properties), true)));
|
|
113
|
+
return this._configurationModel;
|
|
114
|
+
}
|
|
115
|
+
async registerPolicyDefinitions(properties) {
|
|
116
|
+
const policyDefinitions = {};
|
|
117
|
+
const keys = [];
|
|
118
|
+
const configurationProperties = ( (Registry.as(Extensions.Configuration))).getConfigurationProperties();
|
|
119
|
+
for (const key of properties) {
|
|
120
|
+
const config = configurationProperties[key];
|
|
121
|
+
if (!config) {
|
|
122
|
+
keys.push(key);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (config.policy) {
|
|
126
|
+
if (config.type !== 'string' && config.type !== 'number') {
|
|
127
|
+
this.logService.warn(`Policy ${config.policy.name} has unsupported type ${config.type}`);
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
keys.push(key);
|
|
131
|
+
policyDefinitions[config.policy.name] = { type: config.type };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (!isEmptyObject(policyDefinitions)) {
|
|
135
|
+
await this.policyService.registerPolicyDefinitions(policyDefinitions);
|
|
136
|
+
}
|
|
137
|
+
return keys;
|
|
138
|
+
}
|
|
139
|
+
onDidChangePolicies(policyNames) {
|
|
140
|
+
const policyConfigurations = ( (Registry.as(Extensions.Configuration))).getPolicyConfigurations();
|
|
141
|
+
const keys = coalesce(policyNames.map(policyName => policyConfigurations.get(policyName)));
|
|
142
|
+
this.update(keys, true);
|
|
143
|
+
}
|
|
144
|
+
update(keys, trigger) {
|
|
145
|
+
const configurationProperties = ( (Registry.as(Extensions.Configuration))).getConfigurationProperties();
|
|
146
|
+
const changed = [];
|
|
147
|
+
const wasEmpty = this._configurationModel.isEmpty();
|
|
148
|
+
for (const key of keys) {
|
|
149
|
+
const policyName = configurationProperties[key]?.policy?.name;
|
|
150
|
+
if (policyName) {
|
|
151
|
+
const policyValue = this.policyService.getPolicyValue(policyName);
|
|
152
|
+
if (wasEmpty ? policyValue !== undefined : !equals(this._configurationModel.getValue(key), policyValue)) {
|
|
153
|
+
changed.push([key, policyValue]);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
if (this._configurationModel.getValue(key) !== undefined) {
|
|
158
|
+
changed.push([key, undefined]);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (changed.length) {
|
|
163
|
+
const old = this._configurationModel;
|
|
164
|
+
this._configurationModel = ( (new ConfigurationModel()));
|
|
165
|
+
for (const key of old.keys) {
|
|
166
|
+
this._configurationModel.setValue(key, old.getValue(key));
|
|
167
|
+
}
|
|
168
|
+
for (const [key, policyValue] of changed) {
|
|
169
|
+
if (policyValue === undefined) {
|
|
170
|
+
this._configurationModel.removeValue(key);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
this._configurationModel.setValue(key, policyValue);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (trigger) {
|
|
177
|
+
this._onDidChangeConfiguration.fire(this._configurationModel);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
PolicyConfiguration = ( (__decorate([
|
|
183
|
+
( (__param(1, IPolicyService))),
|
|
184
|
+
( (__param(2, ILogService)))
|
|
185
|
+
], PolicyConfiguration)));
|
|
186
|
+
class ConfigurationService extends Disposable {
|
|
187
|
+
constructor(settingsResource, fileService, policyService, logService) {
|
|
188
|
+
super();
|
|
189
|
+
this.settingsResource = settingsResource;
|
|
190
|
+
this._onDidChangeConfiguration = this._register(( (new Emitter())));
|
|
191
|
+
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
192
|
+
this.defaultConfiguration = this._register(( (new DefaultConfiguration())));
|
|
193
|
+
this.policyConfiguration = policyService instanceof NullPolicyService ? ( (new NullPolicyConfiguration())) : this._register(( (new PolicyConfiguration(this.defaultConfiguration, policyService, logService))));
|
|
194
|
+
this.userConfiguration = this._register(( (new UserSettings(this.settingsResource, undefined, extUriBiasedIgnorePathCase, fileService))));
|
|
195
|
+
this.configuration = ( (new Configuration(
|
|
196
|
+
this.defaultConfiguration.configurationModel,
|
|
197
|
+
this.policyConfiguration.configurationModel,
|
|
198
|
+
(new ConfigurationModel()),
|
|
199
|
+
(new ConfigurationModel())
|
|
200
|
+
)));
|
|
201
|
+
this.reloadConfigurationScheduler = this._register(( (new RunOnceScheduler(() => this.reloadConfiguration(), 50))));
|
|
202
|
+
this._register(this.defaultConfiguration.onDidChangeConfiguration(({ defaults, properties }) => this.onDidDefaultConfigurationChange(defaults, properties)));
|
|
203
|
+
this._register(this.policyConfiguration.onDidChangeConfiguration(model => this.onDidPolicyConfigurationChange(model)));
|
|
204
|
+
this._register(this.userConfiguration.onDidChange(() => this.reloadConfigurationScheduler.schedule()));
|
|
205
|
+
}
|
|
206
|
+
async initialize() {
|
|
207
|
+
const [defaultModel, policyModel, userModel] = await Promise.all([this.defaultConfiguration.initialize(), this.policyConfiguration.initialize(), this.userConfiguration.loadConfiguration()]);
|
|
208
|
+
this.configuration = ( (new Configuration(
|
|
209
|
+
defaultModel,
|
|
210
|
+
policyModel,
|
|
211
|
+
(new ConfigurationModel()),
|
|
212
|
+
userModel
|
|
213
|
+
)));
|
|
214
|
+
}
|
|
215
|
+
getConfigurationData() {
|
|
216
|
+
return this.configuration.toData();
|
|
217
|
+
}
|
|
218
|
+
getValue(arg1, arg2) {
|
|
219
|
+
const section = typeof arg1 === 'string' ? arg1 : undefined;
|
|
220
|
+
const overrides = isConfigurationOverrides(arg1) ? arg1 : isConfigurationOverrides(arg2) ? arg2 : {};
|
|
221
|
+
return this.configuration.getValue(section, overrides, undefined);
|
|
222
|
+
}
|
|
223
|
+
updateValue(key, value, arg3, arg4) {
|
|
224
|
+
return Promise.reject(( (new Error('not supported'))));
|
|
225
|
+
}
|
|
226
|
+
inspect(key) {
|
|
227
|
+
return this.configuration.inspect(key, {}, undefined);
|
|
228
|
+
}
|
|
229
|
+
keys() {
|
|
230
|
+
return (
|
|
231
|
+
(this.configuration.keys(undefined))
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
async reloadConfiguration() {
|
|
235
|
+
const configurationModel = await this.userConfiguration.loadConfiguration();
|
|
236
|
+
this.onDidChangeUserConfiguration(configurationModel);
|
|
237
|
+
}
|
|
238
|
+
onDidChangeUserConfiguration(userConfigurationModel) {
|
|
239
|
+
const previous = this.configuration.toData();
|
|
240
|
+
const change = this.configuration.compareAndUpdateLocalUserConfiguration(userConfigurationModel);
|
|
241
|
+
this.trigger(change, previous, 2 );
|
|
242
|
+
}
|
|
243
|
+
onDidDefaultConfigurationChange(defaultConfigurationModel, properties) {
|
|
244
|
+
const previous = this.configuration.toData();
|
|
245
|
+
const change = this.configuration.compareAndUpdateDefaultConfiguration(defaultConfigurationModel, properties);
|
|
246
|
+
this.trigger(change, previous, 7 );
|
|
247
|
+
}
|
|
248
|
+
onDidPolicyConfigurationChange(policyConfiguration) {
|
|
249
|
+
const previous = this.configuration.toData();
|
|
250
|
+
const change = this.configuration.compareAndUpdatePolicyConfiguration(policyConfiguration);
|
|
251
|
+
this.trigger(change, previous, 7 );
|
|
252
|
+
}
|
|
253
|
+
trigger(configurationChange, previous, source) {
|
|
254
|
+
const event = ( (new ConfigurationChangeEvent(configurationChange, { data: previous }, this.configuration)));
|
|
255
|
+
event.source = source;
|
|
256
|
+
event.sourceConfig = this.getTargetConfiguration(source);
|
|
257
|
+
this._onDidChangeConfiguration.fire(event);
|
|
258
|
+
}
|
|
259
|
+
getTargetConfiguration(target) {
|
|
260
|
+
switch (target) {
|
|
261
|
+
case 7 :
|
|
262
|
+
return this.configuration.defaults.contents;
|
|
263
|
+
case 2 :
|
|
264
|
+
return this.configuration.localUserConfiguration.contents;
|
|
265
|
+
}
|
|
266
|
+
return {};
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
let TextResourceConfigurationService = class TextResourceConfigurationService extends Disposable {
|
|
270
|
+
constructor(configurationService, modelService, languageService) {
|
|
271
|
+
super();
|
|
272
|
+
this.configurationService = configurationService;
|
|
273
|
+
this.modelService = modelService;
|
|
274
|
+
this.languageService = languageService;
|
|
275
|
+
this._onDidChangeConfiguration = this._register(( (new Emitter())));
|
|
276
|
+
this.onDidChangeConfiguration = this._onDidChangeConfiguration.event;
|
|
277
|
+
this._register(this.configurationService.onDidChangeConfiguration(e => this._onDidChangeConfiguration.fire(this.toResourceConfigurationChangeEvent(e))));
|
|
278
|
+
}
|
|
279
|
+
getValue(resource, arg2, arg3) {
|
|
280
|
+
if (typeof arg3 === 'string') {
|
|
281
|
+
return this._getValue(resource, Position$2.isIPosition(arg2) ? arg2 : null, arg3);
|
|
282
|
+
}
|
|
283
|
+
return this._getValue(resource, null, typeof arg2 === 'string' ? arg2 : undefined);
|
|
284
|
+
}
|
|
285
|
+
updateValue(resource, key, value, configurationTarget) {
|
|
286
|
+
const language = this.getLanguage(resource, null);
|
|
287
|
+
const configurationValue = this.configurationService.inspect(key, { resource, overrideIdentifier: language });
|
|
288
|
+
if (configurationTarget === undefined) {
|
|
289
|
+
configurationTarget = this.deriveConfigurationTarget(configurationValue, language);
|
|
290
|
+
}
|
|
291
|
+
switch (configurationTarget) {
|
|
292
|
+
case 8 :
|
|
293
|
+
return this._updateValue(key, value, configurationTarget, configurationValue.memory?.override, resource, language);
|
|
294
|
+
case 6 :
|
|
295
|
+
return this._updateValue(key, value, configurationTarget, configurationValue.workspaceFolder?.override, resource, language);
|
|
296
|
+
case 5 :
|
|
297
|
+
return this._updateValue(key, value, configurationTarget, configurationValue.workspace?.override, resource, language);
|
|
298
|
+
case 4 :
|
|
299
|
+
return this._updateValue(key, value, configurationTarget, configurationValue.userRemote?.override, resource, language);
|
|
300
|
+
default:
|
|
301
|
+
return this._updateValue(key, value, configurationTarget, configurationValue.userLocal?.override, resource, language);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
_updateValue(key, value, configurationTarget, overriddenValue, resource, language) {
|
|
305
|
+
if (language && overriddenValue !== undefined) {
|
|
306
|
+
return this.configurationService.updateValue(key, value, { resource, overrideIdentifier: language }, configurationTarget);
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
return this.configurationService.updateValue(key, value, { resource }, configurationTarget);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
deriveConfigurationTarget(configurationValue, language) {
|
|
313
|
+
if (language) {
|
|
314
|
+
if (configurationValue.memory?.override !== undefined) {
|
|
315
|
+
return 8 ;
|
|
316
|
+
}
|
|
317
|
+
if (configurationValue.workspaceFolder?.override !== undefined) {
|
|
318
|
+
return 6 ;
|
|
319
|
+
}
|
|
320
|
+
if (configurationValue.workspace?.override !== undefined) {
|
|
321
|
+
return 5 ;
|
|
322
|
+
}
|
|
323
|
+
if (configurationValue.userRemote?.override !== undefined) {
|
|
324
|
+
return 4 ;
|
|
325
|
+
}
|
|
326
|
+
if (configurationValue.userLocal?.override !== undefined) {
|
|
327
|
+
return 3 ;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (configurationValue.memory?.value !== undefined) {
|
|
331
|
+
return 8 ;
|
|
332
|
+
}
|
|
333
|
+
if (configurationValue.workspaceFolder?.value !== undefined) {
|
|
334
|
+
return 6 ;
|
|
335
|
+
}
|
|
336
|
+
if (configurationValue.workspace?.value !== undefined) {
|
|
337
|
+
return 5 ;
|
|
338
|
+
}
|
|
339
|
+
if (configurationValue.userRemote?.value !== undefined) {
|
|
340
|
+
return 4 ;
|
|
341
|
+
}
|
|
342
|
+
return 3 ;
|
|
343
|
+
}
|
|
344
|
+
_getValue(resource, position, section) {
|
|
345
|
+
const language = resource ? this.getLanguage(resource, position) : undefined;
|
|
346
|
+
if (typeof section === 'undefined') {
|
|
347
|
+
return this.configurationService.getValue({ resource, overrideIdentifier: language });
|
|
348
|
+
}
|
|
349
|
+
return this.configurationService.getValue(section, { resource, overrideIdentifier: language });
|
|
350
|
+
}
|
|
351
|
+
getLanguage(resource, position) {
|
|
352
|
+
const model = this.modelService.getModel(resource);
|
|
353
|
+
if (model) {
|
|
354
|
+
return position ? model.getLanguageIdAtPosition(position.lineNumber, position.column) : model.getLanguageId();
|
|
355
|
+
}
|
|
356
|
+
return this.languageService.guessLanguageIdByFilepathOrFirstLine(resource);
|
|
357
|
+
}
|
|
358
|
+
toResourceConfigurationChangeEvent(configurationChangeEvent) {
|
|
359
|
+
return {
|
|
360
|
+
affectedKeys: configurationChangeEvent.affectedKeys,
|
|
361
|
+
affectsConfiguration: (resource, configuration) => {
|
|
362
|
+
const overrideIdentifier = this.getLanguage(resource, null);
|
|
363
|
+
return configurationChangeEvent.affectsConfiguration(configuration, { resource, overrideIdentifier });
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
TextResourceConfigurationService = ( (__decorate([
|
|
369
|
+
( (__param(0, IConfigurationService))),
|
|
370
|
+
( (__param(1, IModelService))),
|
|
371
|
+
( (__param(2, ILanguageService)))
|
|
372
|
+
], TextResourceConfigurationService)));
|
|
373
|
+
function updateUserConfiguration(configurationJson) {
|
|
374
|
+
const userDataProfilesService = StandaloneServices.get(IUserDataProfilesService);
|
|
375
|
+
void StandaloneServices.get(IFileService).writeFile(userDataProfilesService.defaultProfile.settingsResource, VSBuffer.fromString(configurationJson));
|
|
376
|
+
}
|
|
377
|
+
const configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
378
|
+
let InjectedConfigurationService = class InjectedConfigurationService extends ConfigurationService {
|
|
379
|
+
constructor(userDataProfilesService, fileService, policyService, logService) {
|
|
380
|
+
super(userDataProfilesService.defaultProfile.settingsResource, fileService, policyService, logService);
|
|
381
|
+
this.initialize().catch(error => {
|
|
382
|
+
logService.error(error);
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
updateValue(key, value, arg3, arg4) {
|
|
386
|
+
const overrides = isConfigurationUpdateOverrides(arg3)
|
|
387
|
+
? arg3
|
|
388
|
+
: isConfigurationOverrides(arg3) ? { resource: arg3.resource, overrideIdentifiers: arg3.overrideIdentifier != null ? [arg3.overrideIdentifier] : undefined } : undefined;
|
|
389
|
+
const target = overrides != null ? arg4 : arg3;
|
|
390
|
+
if (target === 8 ) {
|
|
391
|
+
return Promise.resolve(this['configuration'].updateValue(key, value, overrides));
|
|
392
|
+
}
|
|
393
|
+
return Promise.reject(new Error('not supported'));
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
InjectedConfigurationService = ( __decorate([
|
|
397
|
+
( __param(0, IUserDataProfilesService)),
|
|
398
|
+
( __param(1, IFileService)),
|
|
399
|
+
( __param(2, IPolicyService)),
|
|
400
|
+
( __param(3, ILogService))
|
|
401
|
+
], InjectedConfigurationService));
|
|
402
|
+
function getServiceOverride() {
|
|
403
|
+
return {
|
|
404
|
+
...getServiceOverride$1(),
|
|
405
|
+
[( IConfigurationService.toString())]: new SyncDescriptor(InjectedConfigurationService),
|
|
406
|
+
[( ITextResourceConfigurationService.toString())]: new SyncDescriptor(TextResourceConfigurationService)
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
export { configurationRegistry, getServiceOverride as default, updateUserConfiguration };
|