@codingame/monaco-vscode-api 1.67.12 → 1.67.15
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 +5 -2
- package/dist/api.js +1214 -33
- package/dist/async-f842d13c.js +212 -0
- package/dist/configuration.d.ts +293 -0
- package/dist/configuration.js +2069 -0
- package/dist/messages.js +40 -859
- package/dist/{missing-services-71e80bea.js → missing-services-8687ea11.js} +364 -66
- package/dist/modelEditor.js +27 -6
- package/dist/{services-fb7952fb.js → services-7a462d46.js} +292 -1
- package/dist/services.d.ts +2871 -2873
- package/dist/services.js +4 -2
- package/dist/types-371cc315.js +27 -0
- package/package.json +8 -1
- package/dist/async-9ffe4d42.js +0 -46
package/dist/api.js
CHANGED
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as __classPrivateFieldSet, a as __classPrivateFieldGet, b as __decorate, c as coalesceInPlace, m as markAsFileSystemProviderError, F as FileSystemProviderErrorCode, S as SIDE_GROUP, A as ACTIVE_GROUP, d as __param, C as CancellationTokenSource$1, I as IProgressService, r as readonly,
|
|
1
|
+
import { E as Emitter, u as unsupported$1 } from './missing-services-8687ea11.js';
|
|
2
|
+
import { _ as __classPrivateFieldSet, a as __classPrivateFieldGet, b as __decorate, c as coalesceInPlace, m as markAsFileSystemProviderError, F as FileSystemProviderErrorCode, S as SIDE_GROUP, A as ACTIVE_GROUP, d as __param, C as CancellationTokenSource$1, e as delta$1, f as mapArrayOrNot, I as IProgressService, r as readonly, g as ITextFileService, h as IFileService, i as IWorkbenchEnvironmentService, j as IUriIdentityService, k as IWorkingCopyFileService, l as IPathService, n as disposed, o as IEditorService, p as IEditorGroupsService, q as IPaneCompositePartService, s as IProductService, t as ILanguageStatusService, u as IHostService, v as Services, w as FileType$1, x as FilePermission$1 } from './services-7a462d46.js';
|
|
3
|
+
import { i as isStringArray, w as withUndefinedAsNull } from './types-371cc315.js';
|
|
3
4
|
import { illegalArgument, onUnexpectedError, canceled, transformErrorForSerialization, isCancellationError, onUnexpectedExternalError, CancellationError as CancellationError$1 } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
4
5
|
import { uriToFsPath, URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
5
|
-
import { equals, coalesce, asArray, isNonEmptyArray, groupBy, isFalsyOrEmpty } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
6
|
+
import { distinct, equals, coalesce, asArray, isNonEmptyArray, groupBy, isFalsyOrEmpty } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
6
7
|
import { MarkdownString as MarkdownString$3, parseHrefAndDimensions, isMarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
|
|
7
8
|
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
8
9
|
import { compare, equalsIgnoreCase, nextCharLength, regExpLeadsToEndlessLoop, splitLines, isFalsyOrWhitespace, regExpFlags } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
9
10
|
import { Mimes } from 'monaco-editor/esm/vs/base/common/mime.js';
|
|
10
|
-
import {
|
|
11
|
-
import { ResourceMap } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
11
|
+
import { isString, isUndefinedOrNull, isUndefined, isArray, isNumber, validateConstraint, assertIsDefined, withNullAsUndefined, isObject } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
12
|
+
import { ResourceMap, TernarySearchTree } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
12
13
|
import { marked as marked$1 } from 'monaco-editor/esm/vs/base/common/marked/marked.js';
|
|
13
14
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
|
|
14
15
|
import { MarkerSeverity, IMarkerService } from 'monaco-editor/esm/vs/platform/markers/common/markers.js';
|
|
15
16
|
import { parse, revive } from 'monaco-editor/esm/vs/base/common/marshalling.js';
|
|
16
|
-
import { cloneAndChange, deepFreeze, equals as equals$1, mixin } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
17
|
+
import { cloneAndChange, deepFreeze, equals as equals$1, mixin, deepClone } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
17
18
|
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
18
19
|
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
19
20
|
import { toErrorMessage } from 'monaco-editor/esm/vs/base/common/errorMessage.js';
|
|
20
|
-
import { ILogService, LogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
21
|
+
import { ILogService, LogLevel as LogLevel$1, LogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
21
22
|
import { Disposable as Disposable$2, toDisposable, dispose, combinedDisposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
22
23
|
import { Event, DebounceEmitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
23
24
|
import { CommandsRegistry, ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
24
25
|
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
25
|
-
import { ExtUri as ExtUri$1, extUri as extUri$1 } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
26
|
+
import { ExtUri as ExtUri$1, basename as basename$1, dirname as dirname$1, basenameOrAuthority, relativePath, extUri as extUri$1 } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
26
27
|
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
27
28
|
import { RunOnceScheduler, createCancelablePromise, disposableTimeout } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
28
29
|
import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
29
30
|
import { MirrorTextModel } from 'monaco-editor/esm/vs/editor/common/model/mirrorTextModel.js';
|
|
30
31
|
import { ok } from 'monaco-editor/esm/vs/base/common/assert.js';
|
|
31
32
|
import { getWordAtText, ensureValidWordDefinition } from 'monaco-editor/esm/vs/editor/common/core/wordHelper.js';
|
|
32
|
-
import { a as asPromise, r as raceCancellationError } from './async-
|
|
33
|
+
import { a as asPromise, B as Barrier, r as raceCancellationError } from './async-f842d13c.js';
|
|
33
34
|
import { ThemeIcon as ThemeIcon$2 } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
34
35
|
import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
|
|
36
|
+
import { Severity as Severity$1, INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
37
|
+
import { Workspace, WorkspaceFolder, IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
35
38
|
import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
|
|
36
39
|
import { IDialogService } from 'monaco-editor/esm/vs/platform/dialogs/common/dialogs.js';
|
|
37
|
-
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
38
40
|
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
39
41
|
import { Progress } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
40
42
|
import { EditOperation } from 'monaco-editor/esm/vs/editor/common/core/editOperation.js';
|
|
@@ -66,13 +68,17 @@ import { StopWatch } from 'monaco-editor/esm/vs/base/common/stopwatch.js';
|
|
|
66
68
|
import { LanguageFeatureRegistry } from 'monaco-editor/esm/vs/editor/common/languageFeatureRegistry.js';
|
|
67
69
|
import { LanguageConfigurationRegistry, ILanguageConfigurationService } from 'monaco-editor/esm/vs/editor/common/languages/languageConfigurationRegistry.js';
|
|
68
70
|
import { ILanguageFeaturesService } from 'monaco-editor/esm/vs/editor/common/services/languageFeatures.js';
|
|
71
|
+
import { Configuration, ConfigurationChangeEvent } from 'monaco-editor/esm/vs/platform/configuration/common/configurationModels.js';
|
|
72
|
+
import { OVERRIDE_PROPERTY_REGEX as OVERRIDE_PROPERTY_REGEX$1, Extensions as Extensions$1 } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
73
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
74
|
+
import { Extensions } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js';
|
|
69
75
|
import { ExtensionIdentifier } from 'monaco-editor/esm/vs/platform/extensions/common/extensions.js';
|
|
70
76
|
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
71
77
|
import { score } from 'monaco-editor/esm/vs/editor/common/languageSelector.js';
|
|
72
78
|
import { IndentAction as IndentAction$1 } from 'monaco-editor/esm/vs/editor/common/languages/languageConfiguration.js';
|
|
73
79
|
import 'monaco-editor/esm/vs/base/browser/ui/progressbar/progressbar.js';
|
|
74
|
-
import 'monaco-editor/esm/vs/base/common/color.js';
|
|
75
80
|
import 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
81
|
+
import 'monaco-editor/esm/vs/base/common/color.js';
|
|
76
82
|
import 'monaco-editor/esm/vs/editor/common/services/languageService.js';
|
|
77
83
|
import 'monaco-editor/esm/vs/editor/common/services/languagesRegistry.js';
|
|
78
84
|
import 'monaco-editor/esm/vs/editor/common/languages/modesRegistry.js';
|
|
@@ -81,7 +87,6 @@ import 'monaco-editor/esm/vs/base/parts/quickinput/browser/quickInput.js';
|
|
|
81
87
|
import 'monaco-editor/esm/vs/platform/instantiation/common/extensions.js';
|
|
82
88
|
import 'monaco-editor/esm/vs/platform/label/common/label.js';
|
|
83
89
|
import 'monaco-editor/esm/vs/base/browser/event.js';
|
|
84
|
-
import 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
85
90
|
import 'monaco-editor/esm/vs/base/common/linkedList.js';
|
|
86
91
|
function originalFSPath(uri) {
|
|
87
92
|
return uriToFsPath(uri, true);
|
|
@@ -274,6 +279,363 @@ function toLocalResource(resource, authority, localScheme) {
|
|
|
274
279
|
}
|
|
275
280
|
const Range$3 = monaco.Range;
|
|
276
281
|
const FoldingRangeKind$3 = monaco.languages.FoldingRangeKind;
|
|
282
|
+
const resourceLanguageSettingsSchemaId = 'vscode://schemas/settings/resourceLanguage';
|
|
283
|
+
const contributionRegistry = Registry.as(Extensions.JSONContribution);
|
|
284
|
+
class ConfigurationRegistry {
|
|
285
|
+
constructor() {
|
|
286
|
+
this.overrideIdentifiers = new Set();
|
|
287
|
+
this._onDidSchemaChange = new Emitter();
|
|
288
|
+
this.onDidSchemaChange = this._onDidSchemaChange.event;
|
|
289
|
+
this._onDidUpdateConfiguration = new Emitter();
|
|
290
|
+
this.onDidUpdateConfiguration = this._onDidUpdateConfiguration.event;
|
|
291
|
+
this.configurationDefaultsOverrides = new Map();
|
|
292
|
+
this.defaultLanguageConfigurationOverridesNode = {
|
|
293
|
+
id: 'defaultOverrides',
|
|
294
|
+
title: localize(
|
|
295
|
+
'defaultLanguageConfigurationOverrides.title',
|
|
296
|
+
"Default Language Configuration Overrides"
|
|
297
|
+
),
|
|
298
|
+
properties: {}
|
|
299
|
+
};
|
|
300
|
+
this.configurationContributors = [this.defaultLanguageConfigurationOverridesNode];
|
|
301
|
+
this.resourceLanguageSettingsSchema = { properties: {}, patternProperties: {}, additionalProperties: false, errorMessage: 'Unknown editor configuration setting', allowTrailingCommas: true, allowComments: true };
|
|
302
|
+
this.configurationProperties = {};
|
|
303
|
+
this.excludedConfigurationProperties = {};
|
|
304
|
+
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
|
|
305
|
+
this.registerOverridePropertyPatternKey();
|
|
306
|
+
}
|
|
307
|
+
registerConfiguration(configuration, validate = true) {
|
|
308
|
+
this.registerConfigurations([configuration], validate);
|
|
309
|
+
}
|
|
310
|
+
registerConfigurations(configurations, validate = true) {
|
|
311
|
+
const properties = this.doRegisterConfigurations(configurations, validate);
|
|
312
|
+
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
|
|
313
|
+
this._onDidSchemaChange.fire();
|
|
314
|
+
this._onDidUpdateConfiguration.fire({ properties });
|
|
315
|
+
}
|
|
316
|
+
deregisterConfigurations(configurations) {
|
|
317
|
+
const properties = this.doDeregisterConfigurations(configurations);
|
|
318
|
+
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
|
|
319
|
+
this._onDidSchemaChange.fire();
|
|
320
|
+
this._onDidUpdateConfiguration.fire({ properties });
|
|
321
|
+
}
|
|
322
|
+
updateConfigurations({ add, remove }) {
|
|
323
|
+
const properties = [];
|
|
324
|
+
properties.push(...this.doDeregisterConfigurations(remove));
|
|
325
|
+
properties.push(...this.doRegisterConfigurations(add, false));
|
|
326
|
+
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
|
|
327
|
+
this._onDidSchemaChange.fire();
|
|
328
|
+
this._onDidUpdateConfiguration.fire({ properties: distinct(properties) });
|
|
329
|
+
}
|
|
330
|
+
registerDefaultConfigurations(configurationDefaults) {
|
|
331
|
+
const properties = [];
|
|
332
|
+
const overrideIdentifiers = [];
|
|
333
|
+
for (const { overrides, source } of configurationDefaults) {
|
|
334
|
+
for (const key in overrides) {
|
|
335
|
+
properties.push(key);
|
|
336
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
337
|
+
const defaultValue = { ...(this.configurationDefaultsOverrides.get(key)?.value || {}), ...overrides[key] };
|
|
338
|
+
this.configurationDefaultsOverrides.set(key, { source, value: defaultValue });
|
|
339
|
+
const property = {
|
|
340
|
+
type: 'object',
|
|
341
|
+
default: defaultValue,
|
|
342
|
+
description: localize(
|
|
343
|
+
'defaultLanguageConfiguration.description',
|
|
344
|
+
"Configure settings to be overridden for {0} language.",
|
|
345
|
+
key
|
|
346
|
+
),
|
|
347
|
+
$ref: resourceLanguageSettingsSchemaId,
|
|
348
|
+
defaultDefaultValue: defaultValue,
|
|
349
|
+
source: isString(source) ? undefined : source,
|
|
350
|
+
};
|
|
351
|
+
overrideIdentifiers.push(...overrideIdentifiersFromKey(key));
|
|
352
|
+
this.configurationProperties[key] = property;
|
|
353
|
+
this.defaultLanguageConfigurationOverridesNode.properties[key] = property;
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
this.configurationDefaultsOverrides.set(key, { value: overrides[key], source });
|
|
357
|
+
const property = this.configurationProperties[key];
|
|
358
|
+
if (property) {
|
|
359
|
+
this.updatePropertyDefaultValue(key, property);
|
|
360
|
+
this.updateSchema(key, property);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
this.registerOverrideIdentifiers(overrideIdentifiers);
|
|
366
|
+
this._onDidSchemaChange.fire();
|
|
367
|
+
this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });
|
|
368
|
+
}
|
|
369
|
+
deregisterDefaultConfigurations(defaultConfigurations) {
|
|
370
|
+
const properties = [];
|
|
371
|
+
for (const { overrides, source } of defaultConfigurations) {
|
|
372
|
+
for (const key in overrides) {
|
|
373
|
+
const configurationDefaultsOverride = this.configurationDefaultsOverrides.get(key);
|
|
374
|
+
const id = isString(source) ? source : source?.id;
|
|
375
|
+
const configurationDefaultsOverrideSourceId = isString(configurationDefaultsOverride?.source) ? configurationDefaultsOverride?.source : configurationDefaultsOverride?.source?.id;
|
|
376
|
+
if (id !== configurationDefaultsOverrideSourceId) {
|
|
377
|
+
continue;
|
|
378
|
+
}
|
|
379
|
+
properties.push(key);
|
|
380
|
+
this.configurationDefaultsOverrides.delete(key);
|
|
381
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
382
|
+
delete this.configurationProperties[key];
|
|
383
|
+
delete this.defaultLanguageConfigurationOverridesNode.properties[key];
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
const property = this.configurationProperties[key];
|
|
387
|
+
if (property) {
|
|
388
|
+
this.updatePropertyDefaultValue(key, property);
|
|
389
|
+
this.updateSchema(key, property);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
this.updateOverridePropertyPatternKey();
|
|
395
|
+
this._onDidSchemaChange.fire();
|
|
396
|
+
this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });
|
|
397
|
+
}
|
|
398
|
+
notifyConfigurationSchemaUpdated(...configurations) {
|
|
399
|
+
this._onDidSchemaChange.fire();
|
|
400
|
+
}
|
|
401
|
+
registerOverrideIdentifiers(overrideIdentifiers) {
|
|
402
|
+
for (const overrideIdentifier of overrideIdentifiers) {
|
|
403
|
+
this.overrideIdentifiers.add(overrideIdentifier);
|
|
404
|
+
}
|
|
405
|
+
this.updateOverridePropertyPatternKey();
|
|
406
|
+
}
|
|
407
|
+
doRegisterConfigurations(configurations, validate) {
|
|
408
|
+
const properties = [];
|
|
409
|
+
configurations.forEach(configuration => {
|
|
410
|
+
properties.push(...this.validateAndRegisterProperties(configuration, validate, configuration.extensionInfo, configuration.restrictedProperties));
|
|
411
|
+
this.configurationContributors.push(configuration);
|
|
412
|
+
this.registerJSONConfiguration(configuration);
|
|
413
|
+
});
|
|
414
|
+
return properties;
|
|
415
|
+
}
|
|
416
|
+
doDeregisterConfigurations(configurations) {
|
|
417
|
+
const properties = [];
|
|
418
|
+
const deregisterConfiguration = (configuration) => {
|
|
419
|
+
if (configuration.properties) {
|
|
420
|
+
for (const key in configuration.properties) {
|
|
421
|
+
properties.push(key);
|
|
422
|
+
delete this.configurationProperties[key];
|
|
423
|
+
this.removeFromSchema(key, configuration.properties[key]);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
if (configuration.allOf) {
|
|
427
|
+
configuration.allOf.forEach(node => deregisterConfiguration(node));
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
for (const configuration of configurations) {
|
|
431
|
+
deregisterConfiguration(configuration);
|
|
432
|
+
const index = this.configurationContributors.indexOf(configuration);
|
|
433
|
+
if (index !== -1) {
|
|
434
|
+
this.configurationContributors.splice(index, 1);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
return properties;
|
|
438
|
+
}
|
|
439
|
+
validateAndRegisterProperties(configuration, validate = true, extensionInfo, restrictedProperties, scope = 3 ) {
|
|
440
|
+
scope = isUndefinedOrNull(configuration.scope) ? scope : configuration.scope;
|
|
441
|
+
let propertyKeys = [];
|
|
442
|
+
let properties = configuration.properties;
|
|
443
|
+
if (properties) {
|
|
444
|
+
for (let key in properties) {
|
|
445
|
+
if (validate && validateProperty(key)) {
|
|
446
|
+
delete properties[key];
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
const property = properties[key];
|
|
450
|
+
property.source = extensionInfo;
|
|
451
|
+
property.defaultDefaultValue = properties[key].default;
|
|
452
|
+
this.updatePropertyDefaultValue(key, property);
|
|
453
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
454
|
+
property.scope = undefined;
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
property.scope = isUndefinedOrNull(property.scope) ? scope : property.scope;
|
|
458
|
+
property.restricted = isUndefinedOrNull(property.restricted) ? !!restrictedProperties?.includes(key) : property.restricted;
|
|
459
|
+
}
|
|
460
|
+
if (properties[key].hasOwnProperty('included') && !properties[key].included) {
|
|
461
|
+
this.excludedConfigurationProperties[key] = properties[key];
|
|
462
|
+
delete properties[key];
|
|
463
|
+
continue;
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
this.configurationProperties[key] = properties[key];
|
|
467
|
+
}
|
|
468
|
+
if (!properties[key].deprecationMessage && properties[key].markdownDeprecationMessage) {
|
|
469
|
+
properties[key].deprecationMessage = properties[key].markdownDeprecationMessage;
|
|
470
|
+
}
|
|
471
|
+
propertyKeys.push(key);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
let subNodes = configuration.allOf;
|
|
475
|
+
if (subNodes) {
|
|
476
|
+
for (let node of subNodes) {
|
|
477
|
+
propertyKeys.push(...this.validateAndRegisterProperties(node, validate, extensionInfo, restrictedProperties, scope));
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return propertyKeys;
|
|
481
|
+
}
|
|
482
|
+
getConfigurations() {
|
|
483
|
+
return this.configurationContributors;
|
|
484
|
+
}
|
|
485
|
+
getConfigurationProperties() {
|
|
486
|
+
return this.configurationProperties;
|
|
487
|
+
}
|
|
488
|
+
getExcludedConfigurationProperties() {
|
|
489
|
+
return this.excludedConfigurationProperties;
|
|
490
|
+
}
|
|
491
|
+
getConfigurationDefaultsOverrides() {
|
|
492
|
+
return this.configurationDefaultsOverrides;
|
|
493
|
+
}
|
|
494
|
+
registerJSONConfiguration(configuration) {
|
|
495
|
+
}
|
|
496
|
+
updateSchema(key, property) {
|
|
497
|
+
switch (property.scope) {
|
|
498
|
+
case 1 :
|
|
499
|
+
break;
|
|
500
|
+
case 2 :
|
|
501
|
+
break;
|
|
502
|
+
case 6 :
|
|
503
|
+
break;
|
|
504
|
+
case 3 :
|
|
505
|
+
break;
|
|
506
|
+
case 4 :
|
|
507
|
+
break;
|
|
508
|
+
case 5 :
|
|
509
|
+
this.resourceLanguageSettingsSchema.properties[key] = property;
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
removeFromSchema(key, property) {
|
|
514
|
+
switch (property.scope) {
|
|
515
|
+
case 1 :
|
|
516
|
+
break;
|
|
517
|
+
case 2 :
|
|
518
|
+
break;
|
|
519
|
+
case 6 :
|
|
520
|
+
break;
|
|
521
|
+
case 3 :
|
|
522
|
+
break;
|
|
523
|
+
case 4 :
|
|
524
|
+
case 5 :
|
|
525
|
+
delete this.resourceLanguageSettingsSchema.properties[key];
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
updateOverridePropertyPatternKey() {
|
|
530
|
+
for (const overrideIdentifier of this.overrideIdentifiers.values()) {
|
|
531
|
+
const overrideIdentifierProperty = `[${overrideIdentifier}]`;
|
|
532
|
+
const resourceLanguagePropertiesSchema = {
|
|
533
|
+
type: 'object',
|
|
534
|
+
description: localize(
|
|
535
|
+
'overrideSettings.defaultDescription',
|
|
536
|
+
"Configure editor settings to be overridden for a language."
|
|
537
|
+
),
|
|
538
|
+
errorMessage: localize(
|
|
539
|
+
'overrideSettings.errorMessage',
|
|
540
|
+
"This setting does not support per-language configuration."
|
|
541
|
+
),
|
|
542
|
+
$ref: resourceLanguageSettingsSchemaId,
|
|
543
|
+
};
|
|
544
|
+
this.updatePropertyDefaultValue(overrideIdentifierProperty, resourceLanguagePropertiesSchema);
|
|
545
|
+
}
|
|
546
|
+
this._onDidSchemaChange.fire();
|
|
547
|
+
}
|
|
548
|
+
registerOverridePropertyPatternKey() {
|
|
549
|
+
this._onDidSchemaChange.fire();
|
|
550
|
+
}
|
|
551
|
+
updatePropertyDefaultValue(key, property) {
|
|
552
|
+
const configurationdefaultOverride = this.configurationDefaultsOverrides.get(key);
|
|
553
|
+
let defaultValue = configurationdefaultOverride?.value;
|
|
554
|
+
let defaultSource = configurationdefaultOverride?.source;
|
|
555
|
+
if (isUndefined(defaultValue)) {
|
|
556
|
+
defaultValue = property.defaultDefaultValue;
|
|
557
|
+
defaultSource = undefined;
|
|
558
|
+
}
|
|
559
|
+
if (isUndefined(defaultValue)) {
|
|
560
|
+
defaultValue = getDefaultValue(property.type);
|
|
561
|
+
}
|
|
562
|
+
property.default = defaultValue;
|
|
563
|
+
property.defaultValueSource = defaultSource;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
const OVERRIDE_IDENTIFIER_PATTERN = `\\[([^\\]]+)\\]`;
|
|
567
|
+
const OVERRIDE_IDENTIFIER_REGEX = new RegExp(OVERRIDE_IDENTIFIER_PATTERN, 'g');
|
|
568
|
+
const OVERRIDE_PROPERTY_PATTERN = `^(${OVERRIDE_IDENTIFIER_PATTERN})+$`;
|
|
569
|
+
const OVERRIDE_PROPERTY_REGEX = new RegExp(OVERRIDE_PROPERTY_PATTERN);
|
|
570
|
+
function overrideIdentifiersFromKey(key) {
|
|
571
|
+
const identifiers = [];
|
|
572
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
573
|
+
let matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);
|
|
574
|
+
while (matches?.length) {
|
|
575
|
+
const identifier = matches[1].trim();
|
|
576
|
+
if (identifier) {
|
|
577
|
+
identifiers.push(identifier);
|
|
578
|
+
}
|
|
579
|
+
matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return distinct(identifiers);
|
|
583
|
+
}
|
|
584
|
+
function getDefaultValue(type) {
|
|
585
|
+
const t = Array.isArray(type) ? type[0] : type;
|
|
586
|
+
switch (t) {
|
|
587
|
+
case 'boolean':
|
|
588
|
+
return false;
|
|
589
|
+
case 'integer':
|
|
590
|
+
case 'number':
|
|
591
|
+
return 0;
|
|
592
|
+
case 'string':
|
|
593
|
+
return '';
|
|
594
|
+
case 'array':
|
|
595
|
+
return [];
|
|
596
|
+
case 'object':
|
|
597
|
+
return {};
|
|
598
|
+
default:
|
|
599
|
+
return null;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
const configurationRegistry = new ConfigurationRegistry();
|
|
603
|
+
function validateProperty(property) {
|
|
604
|
+
if (!property.trim()) {
|
|
605
|
+
return (
|
|
606
|
+
localize('config.property.empty', "Cannot register an empty property")
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
if (OVERRIDE_PROPERTY_REGEX.test(property)) {
|
|
610
|
+
return (
|
|
611
|
+
localize(
|
|
612
|
+
'config.property.languageDefault',
|
|
613
|
+
"Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.",
|
|
614
|
+
property
|
|
615
|
+
)
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
if (configurationRegistry.getConfigurationProperties()[property] !== undefined) {
|
|
619
|
+
return (
|
|
620
|
+
localize(
|
|
621
|
+
'config.property.duplicate',
|
|
622
|
+
"Cannot register '{0}'. This property is already registered.",
|
|
623
|
+
property
|
|
624
|
+
)
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
return null;
|
|
628
|
+
}
|
|
629
|
+
function getScopes() {
|
|
630
|
+
const scopes = [];
|
|
631
|
+
const configurationProperties = configurationRegistry.getConfigurationProperties();
|
|
632
|
+
for (const key of Object.keys(configurationProperties)) {
|
|
633
|
+
scopes.push([key, configurationProperties[key].scope]);
|
|
634
|
+
}
|
|
635
|
+
scopes.push(['launch', 4 ]);
|
|
636
|
+
scopes.push(['task', 4 ]);
|
|
637
|
+
return scopes;
|
|
638
|
+
}
|
|
277
639
|
const _simplePattern = /^(.+)\/(.+?)(;.+)?$/;
|
|
278
640
|
function normalizeMimeType(mimeType, strict) {
|
|
279
641
|
const match = _simplePattern.exec(mimeType);
|
|
@@ -7935,6 +8297,442 @@ function createExtHostQuickOpen(mainContext, workspace, commands) {
|
|
|
7935
8297
|
new ExtHostQuickOpenImpl(workspace, commands)
|
|
7936
8298
|
);
|
|
7937
8299
|
}
|
|
8300
|
+
class Counter {
|
|
8301
|
+
constructor() {
|
|
8302
|
+
this._next = 0;
|
|
8303
|
+
}
|
|
8304
|
+
getNext() {
|
|
8305
|
+
return this._next++;
|
|
8306
|
+
}
|
|
8307
|
+
}
|
|
8308
|
+
const IExtHostInitDataService = createDecorator('IExtHostInitDataService');
|
|
8309
|
+
function resultIsMatch(result) {
|
|
8310
|
+
return !!result.preview;
|
|
8311
|
+
}
|
|
8312
|
+
function isFolderEqual(folderA, folderB, extHostFileSystemInfo) {
|
|
8313
|
+
return (
|
|
8314
|
+
new ExtUri$1(uri => ignorePathCasing(uri, extHostFileSystemInfo)).isEqual(folderA, folderB)
|
|
8315
|
+
);
|
|
8316
|
+
}
|
|
8317
|
+
function compareWorkspaceFolderByUri(a, b, extHostFileSystemInfo) {
|
|
8318
|
+
return isFolderEqual(a.uri, b.uri, extHostFileSystemInfo) ? 0 : compare(a.uri.toString(), b.uri.toString());
|
|
8319
|
+
}
|
|
8320
|
+
function compareWorkspaceFolderByUriAndNameAndIndex(a, b, extHostFileSystemInfo) {
|
|
8321
|
+
if (a.index !== b.index) {
|
|
8322
|
+
return a.index < b.index ? -1 : 1;
|
|
8323
|
+
}
|
|
8324
|
+
return isFolderEqual(a.uri, b.uri, extHostFileSystemInfo) ? compare(a.name, b.name) : compare(a.uri.toString(), b.uri.toString());
|
|
8325
|
+
}
|
|
8326
|
+
function delta(oldFolders, newFolders, compare, extHostFileSystemInfo) {
|
|
8327
|
+
const oldSortedFolders = oldFolders.slice(0).sort((a, b) => compare(a, b, extHostFileSystemInfo));
|
|
8328
|
+
const newSortedFolders = newFolders.slice(0).sort((a, b) => compare(a, b, extHostFileSystemInfo));
|
|
8329
|
+
return delta$1(oldSortedFolders, newSortedFolders, (a, b) => compare(a, b, extHostFileSystemInfo));
|
|
8330
|
+
}
|
|
8331
|
+
function ignorePathCasing(uri, extHostFileSystemInfo) {
|
|
8332
|
+
const capabilities = extHostFileSystemInfo.getCapabilities(uri.scheme);
|
|
8333
|
+
return !(capabilities && ((capabilities & 1024) ));
|
|
8334
|
+
}
|
|
8335
|
+
class ExtHostWorkspaceImpl extends Workspace {
|
|
8336
|
+
constructor(id, _name, folders, transient, configuration, _isUntitled, ignorePathCasing) {
|
|
8337
|
+
super(id, folders.map(f => new WorkspaceFolder(f)), transient, configuration, ignorePathCasing);
|
|
8338
|
+
this._name = _name;
|
|
8339
|
+
this._isUntitled = _isUntitled;
|
|
8340
|
+
this._workspaceFolders = [];
|
|
8341
|
+
this._structure = TernarySearchTree.forUris(ignorePathCasing);
|
|
8342
|
+
folders.forEach(folder => {
|
|
8343
|
+
this._workspaceFolders.push(folder);
|
|
8344
|
+
this._structure.set(folder.uri, folder);
|
|
8345
|
+
});
|
|
8346
|
+
}
|
|
8347
|
+
static toExtHostWorkspace(data, previousConfirmedWorkspace, previousUnconfirmedWorkspace, extHostFileSystemInfo) {
|
|
8348
|
+
if (!data) {
|
|
8349
|
+
return { workspace: null, added: [], removed: [] };
|
|
8350
|
+
}
|
|
8351
|
+
const { id, name, folders, configuration, transient, isUntitled } = data;
|
|
8352
|
+
const newWorkspaceFolders = [];
|
|
8353
|
+
const oldWorkspace = previousConfirmedWorkspace;
|
|
8354
|
+
if (previousConfirmedWorkspace) {
|
|
8355
|
+
folders.forEach((folderData, index) => {
|
|
8356
|
+
const folderUri = URI.revive(folderData.uri);
|
|
8357
|
+
const existingFolder = ExtHostWorkspaceImpl._findFolder(previousUnconfirmedWorkspace || previousConfirmedWorkspace, folderUri, extHostFileSystemInfo);
|
|
8358
|
+
if (existingFolder) {
|
|
8359
|
+
existingFolder.name = folderData.name;
|
|
8360
|
+
existingFolder.index = folderData.index;
|
|
8361
|
+
newWorkspaceFolders.push(existingFolder);
|
|
8362
|
+
}
|
|
8363
|
+
else {
|
|
8364
|
+
newWorkspaceFolders.push({ uri: folderUri, name: folderData.name, index });
|
|
8365
|
+
}
|
|
8366
|
+
});
|
|
8367
|
+
}
|
|
8368
|
+
else {
|
|
8369
|
+
newWorkspaceFolders.push(...folders.map(({ uri, name, index }) => ({ uri: URI.revive(uri), name, index })));
|
|
8370
|
+
}
|
|
8371
|
+
newWorkspaceFolders.sort((f1, f2) => f1.index < f2.index ? -1 : 1);
|
|
8372
|
+
const workspace = new ExtHostWorkspaceImpl(
|
|
8373
|
+
id,
|
|
8374
|
+
name,
|
|
8375
|
+
newWorkspaceFolders,
|
|
8376
|
+
!!transient,
|
|
8377
|
+
configuration ? URI.revive(configuration) : null,
|
|
8378
|
+
!!isUntitled,
|
|
8379
|
+
uri => ignorePathCasing(uri, extHostFileSystemInfo)
|
|
8380
|
+
);
|
|
8381
|
+
const { added, removed } = delta(oldWorkspace ? oldWorkspace.workspaceFolders : [], workspace.workspaceFolders, compareWorkspaceFolderByUri, extHostFileSystemInfo);
|
|
8382
|
+
return { workspace, added, removed };
|
|
8383
|
+
}
|
|
8384
|
+
static _findFolder(workspace, folderUriToFind, extHostFileSystemInfo) {
|
|
8385
|
+
for (let i = 0; i < workspace.folders.length; i++) {
|
|
8386
|
+
const folder = workspace.workspaceFolders[i];
|
|
8387
|
+
if (isFolderEqual(folder.uri, folderUriToFind, extHostFileSystemInfo)) {
|
|
8388
|
+
return folder;
|
|
8389
|
+
}
|
|
8390
|
+
}
|
|
8391
|
+
return undefined;
|
|
8392
|
+
}
|
|
8393
|
+
get name() {
|
|
8394
|
+
return this._name;
|
|
8395
|
+
}
|
|
8396
|
+
get isUntitled() {
|
|
8397
|
+
return this._isUntitled;
|
|
8398
|
+
}
|
|
8399
|
+
get workspaceFolders() {
|
|
8400
|
+
return this._workspaceFolders.slice(0);
|
|
8401
|
+
}
|
|
8402
|
+
getWorkspaceFolder(uri, resolveParent) {
|
|
8403
|
+
if (resolveParent && this._structure.get(uri)) {
|
|
8404
|
+
uri = dirname$1(uri);
|
|
8405
|
+
}
|
|
8406
|
+
return this._structure.findSubstr(uri);
|
|
8407
|
+
}
|
|
8408
|
+
resolveWorkspaceFolder(uri) {
|
|
8409
|
+
return this._structure.get(uri);
|
|
8410
|
+
}
|
|
8411
|
+
}
|
|
8412
|
+
let ExtHostWorkspace = class ExtHostWorkspace {
|
|
8413
|
+
constructor(extHostRpc, initData, extHostFileSystemInfo, logService) {
|
|
8414
|
+
this._onDidChangeWorkspace = new Emitter();
|
|
8415
|
+
this.onDidChangeWorkspace = this._onDidChangeWorkspace.event;
|
|
8416
|
+
this._onDidGrantWorkspaceTrust = new Emitter();
|
|
8417
|
+
this.onDidGrantWorkspaceTrust = this._onDidGrantWorkspaceTrust.event;
|
|
8418
|
+
this._activeSearchCallbacks = [];
|
|
8419
|
+
this._trusted = false;
|
|
8420
|
+
this._logService = logService;
|
|
8421
|
+
this._extHostFileSystemInfo = extHostFileSystemInfo;
|
|
8422
|
+
this._requestIdProvider = new Counter();
|
|
8423
|
+
this._barrier = new Barrier();
|
|
8424
|
+
this._proxy = extHostRpc.getProxy(MainContext.MainThreadWorkspace);
|
|
8425
|
+
this._messageService = extHostRpc.getProxy(MainContext.MainThreadMessageService);
|
|
8426
|
+
const data = initData.workspace;
|
|
8427
|
+
this._confirmedWorkspace = data ? new ExtHostWorkspaceImpl(
|
|
8428
|
+
data.id,
|
|
8429
|
+
data.name,
|
|
8430
|
+
[],
|
|
8431
|
+
!!data.transient,
|
|
8432
|
+
data.configuration ? URI.revive(data.configuration) : null,
|
|
8433
|
+
!!data.isUntitled,
|
|
8434
|
+
uri => ignorePathCasing(uri, extHostFileSystemInfo)
|
|
8435
|
+
) : undefined;
|
|
8436
|
+
}
|
|
8437
|
+
$initializeWorkspace(data, trusted) {
|
|
8438
|
+
this._trusted = trusted;
|
|
8439
|
+
this.$acceptWorkspaceData(data);
|
|
8440
|
+
this._barrier.open();
|
|
8441
|
+
}
|
|
8442
|
+
waitForInitializeCall() {
|
|
8443
|
+
return this._barrier.wait();
|
|
8444
|
+
}
|
|
8445
|
+
get workspace() {
|
|
8446
|
+
return this._actualWorkspace;
|
|
8447
|
+
}
|
|
8448
|
+
get name() {
|
|
8449
|
+
return this._actualWorkspace ? this._actualWorkspace.name : undefined;
|
|
8450
|
+
}
|
|
8451
|
+
get workspaceFile() {
|
|
8452
|
+
if (this._actualWorkspace) {
|
|
8453
|
+
if (this._actualWorkspace.configuration) {
|
|
8454
|
+
if (this._actualWorkspace.isUntitled) {
|
|
8455
|
+
return URI.from({ scheme: Schemas.untitled, path: basename$1(dirname$1(this._actualWorkspace.configuration)) });
|
|
8456
|
+
}
|
|
8457
|
+
return this._actualWorkspace.configuration;
|
|
8458
|
+
}
|
|
8459
|
+
}
|
|
8460
|
+
return undefined;
|
|
8461
|
+
}
|
|
8462
|
+
get _actualWorkspace() {
|
|
8463
|
+
return this._unconfirmedWorkspace || this._confirmedWorkspace;
|
|
8464
|
+
}
|
|
8465
|
+
getWorkspaceFolders() {
|
|
8466
|
+
if (!this._actualWorkspace) {
|
|
8467
|
+
return undefined;
|
|
8468
|
+
}
|
|
8469
|
+
return this._actualWorkspace.workspaceFolders.slice(0);
|
|
8470
|
+
}
|
|
8471
|
+
async getWorkspaceFolders2() {
|
|
8472
|
+
await this._barrier.wait();
|
|
8473
|
+
if (!this._actualWorkspace) {
|
|
8474
|
+
return undefined;
|
|
8475
|
+
}
|
|
8476
|
+
return this._actualWorkspace.workspaceFolders.slice(0);
|
|
8477
|
+
}
|
|
8478
|
+
updateWorkspaceFolders(extension, index, deleteCount, ...workspaceFoldersToAdd) {
|
|
8479
|
+
const validatedDistinctWorkspaceFoldersToAdd = [];
|
|
8480
|
+
if (Array.isArray(workspaceFoldersToAdd)) {
|
|
8481
|
+
workspaceFoldersToAdd.forEach(folderToAdd => {
|
|
8482
|
+
if (URI.isUri(folderToAdd.uri) && !validatedDistinctWorkspaceFoldersToAdd.some(f => isFolderEqual(f.uri, folderToAdd.uri, this._extHostFileSystemInfo))) {
|
|
8483
|
+
validatedDistinctWorkspaceFoldersToAdd.push({ uri: folderToAdd.uri, name: folderToAdd.name || basenameOrAuthority(folderToAdd.uri) });
|
|
8484
|
+
}
|
|
8485
|
+
});
|
|
8486
|
+
}
|
|
8487
|
+
if (!!this._unconfirmedWorkspace) {
|
|
8488
|
+
return false;
|
|
8489
|
+
}
|
|
8490
|
+
if ([index, deleteCount].some(i => typeof i !== 'number' || i < 0)) {
|
|
8491
|
+
return false;
|
|
8492
|
+
}
|
|
8493
|
+
if (deleteCount === 0 && validatedDistinctWorkspaceFoldersToAdd.length === 0) {
|
|
8494
|
+
return false;
|
|
8495
|
+
}
|
|
8496
|
+
const currentWorkspaceFolders = this._actualWorkspace ? this._actualWorkspace.workspaceFolders : [];
|
|
8497
|
+
if (index + deleteCount > currentWorkspaceFolders.length) {
|
|
8498
|
+
return false;
|
|
8499
|
+
}
|
|
8500
|
+
const newWorkspaceFolders = currentWorkspaceFolders.slice(0);
|
|
8501
|
+
newWorkspaceFolders.splice(index, deleteCount, ...validatedDistinctWorkspaceFoldersToAdd.map(f => ({ uri: f.uri, name: f.name || basenameOrAuthority(f.uri), index: undefined })));
|
|
8502
|
+
for (let i = 0; i < newWorkspaceFolders.length; i++) {
|
|
8503
|
+
const folder = newWorkspaceFolders[i];
|
|
8504
|
+
if (newWorkspaceFolders.some((otherFolder, index) => index !== i && isFolderEqual(folder.uri, otherFolder.uri, this._extHostFileSystemInfo))) {
|
|
8505
|
+
return false;
|
|
8506
|
+
}
|
|
8507
|
+
}
|
|
8508
|
+
newWorkspaceFolders.forEach((f, index) => f.index = index);
|
|
8509
|
+
const { added, removed } = delta(currentWorkspaceFolders, newWorkspaceFolders, compareWorkspaceFolderByUriAndNameAndIndex, this._extHostFileSystemInfo);
|
|
8510
|
+
if (added.length === 0 && removed.length === 0) {
|
|
8511
|
+
return false;
|
|
8512
|
+
}
|
|
8513
|
+
if (this._proxy) {
|
|
8514
|
+
const extName = extension.displayName || extension.name;
|
|
8515
|
+
this._proxy.$updateWorkspaceFolders(extName, index, deleteCount, validatedDistinctWorkspaceFoldersToAdd).then(undefined, error => {
|
|
8516
|
+
this._unconfirmedWorkspace = undefined;
|
|
8517
|
+
const options = { source: { identifier: extension.identifier, label: extension.displayName || extension.name } };
|
|
8518
|
+
this._messageService.$showMessage(Severity$1.Error, localize(
|
|
8519
|
+
'updateerror',
|
|
8520
|
+
"Extension '{0}' failed to update workspace folders: {1}",
|
|
8521
|
+
extName,
|
|
8522
|
+
error.toString()
|
|
8523
|
+
), options, []);
|
|
8524
|
+
});
|
|
8525
|
+
}
|
|
8526
|
+
this.trySetWorkspaceFolders(newWorkspaceFolders);
|
|
8527
|
+
return true;
|
|
8528
|
+
}
|
|
8529
|
+
getWorkspaceFolder(uri, resolveParent) {
|
|
8530
|
+
if (!this._actualWorkspace) {
|
|
8531
|
+
return undefined;
|
|
8532
|
+
}
|
|
8533
|
+
return this._actualWorkspace.getWorkspaceFolder(uri, resolveParent);
|
|
8534
|
+
}
|
|
8535
|
+
async getWorkspaceFolder2(uri, resolveParent) {
|
|
8536
|
+
await this._barrier.wait();
|
|
8537
|
+
if (!this._actualWorkspace) {
|
|
8538
|
+
return undefined;
|
|
8539
|
+
}
|
|
8540
|
+
return this._actualWorkspace.getWorkspaceFolder(uri, resolveParent);
|
|
8541
|
+
}
|
|
8542
|
+
async resolveWorkspaceFolder(uri) {
|
|
8543
|
+
await this._barrier.wait();
|
|
8544
|
+
if (!this._actualWorkspace) {
|
|
8545
|
+
return undefined;
|
|
8546
|
+
}
|
|
8547
|
+
return this._actualWorkspace.resolveWorkspaceFolder(uri);
|
|
8548
|
+
}
|
|
8549
|
+
getPath() {
|
|
8550
|
+
if (!this._actualWorkspace) {
|
|
8551
|
+
return undefined;
|
|
8552
|
+
}
|
|
8553
|
+
const { folders } = this._actualWorkspace;
|
|
8554
|
+
if (folders.length === 0) {
|
|
8555
|
+
return undefined;
|
|
8556
|
+
}
|
|
8557
|
+
return folders[0].uri.fsPath;
|
|
8558
|
+
}
|
|
8559
|
+
getRelativePath(pathOrUri, includeWorkspace) {
|
|
8560
|
+
let resource;
|
|
8561
|
+
let path = '';
|
|
8562
|
+
if (typeof pathOrUri === 'string') {
|
|
8563
|
+
resource = URI.file(pathOrUri);
|
|
8564
|
+
path = pathOrUri;
|
|
8565
|
+
}
|
|
8566
|
+
else if (typeof pathOrUri !== 'undefined') {
|
|
8567
|
+
resource = pathOrUri;
|
|
8568
|
+
path = pathOrUri.fsPath;
|
|
8569
|
+
}
|
|
8570
|
+
if (!resource) {
|
|
8571
|
+
return path;
|
|
8572
|
+
}
|
|
8573
|
+
const folder = this.getWorkspaceFolder(resource, true);
|
|
8574
|
+
if (!folder) {
|
|
8575
|
+
return path;
|
|
8576
|
+
}
|
|
8577
|
+
if (typeof includeWorkspace === 'undefined' && this._actualWorkspace) {
|
|
8578
|
+
includeWorkspace = this._actualWorkspace.folders.length > 1;
|
|
8579
|
+
}
|
|
8580
|
+
let result = relativePath(folder.uri, resource);
|
|
8581
|
+
if (includeWorkspace && folder.name) {
|
|
8582
|
+
result = `${folder.name}/${result}`;
|
|
8583
|
+
}
|
|
8584
|
+
return result;
|
|
8585
|
+
}
|
|
8586
|
+
trySetWorkspaceFolders(folders) {
|
|
8587
|
+
if (this._actualWorkspace) {
|
|
8588
|
+
this._unconfirmedWorkspace = ExtHostWorkspaceImpl.toExtHostWorkspace({
|
|
8589
|
+
id: this._actualWorkspace.id,
|
|
8590
|
+
name: this._actualWorkspace.name,
|
|
8591
|
+
configuration: this._actualWorkspace.configuration,
|
|
8592
|
+
folders,
|
|
8593
|
+
isUntitled: this._actualWorkspace.isUntitled
|
|
8594
|
+
}, this._actualWorkspace, undefined, this._extHostFileSystemInfo).workspace || undefined;
|
|
8595
|
+
}
|
|
8596
|
+
}
|
|
8597
|
+
$acceptWorkspaceData(data) {
|
|
8598
|
+
const { workspace, added, removed } = ExtHostWorkspaceImpl.toExtHostWorkspace(data, this._confirmedWorkspace, this._unconfirmedWorkspace, this._extHostFileSystemInfo);
|
|
8599
|
+
this._confirmedWorkspace = workspace || undefined;
|
|
8600
|
+
this._unconfirmedWorkspace = undefined;
|
|
8601
|
+
this._onDidChangeWorkspace.fire( Object.freeze({
|
|
8602
|
+
added,
|
|
8603
|
+
removed,
|
|
8604
|
+
}));
|
|
8605
|
+
}
|
|
8606
|
+
findFiles(include, exclude, maxResults, extensionId, token = CancellationToken.None) {
|
|
8607
|
+
this._logService.trace(`extHostWorkspace#findFiles: fileSearch, extension: ${extensionId.value}, entryPoint: findFiles`);
|
|
8608
|
+
let excludePatternOrDisregardExcludes = undefined;
|
|
8609
|
+
if (exclude === null) {
|
|
8610
|
+
excludePatternOrDisregardExcludes = false;
|
|
8611
|
+
}
|
|
8612
|
+
else if (exclude) {
|
|
8613
|
+
if (typeof exclude === 'string') {
|
|
8614
|
+
excludePatternOrDisregardExcludes = exclude;
|
|
8615
|
+
}
|
|
8616
|
+
else {
|
|
8617
|
+
excludePatternOrDisregardExcludes = exclude.pattern;
|
|
8618
|
+
}
|
|
8619
|
+
}
|
|
8620
|
+
if (token && token.isCancellationRequested) {
|
|
8621
|
+
return Promise.resolve([]);
|
|
8622
|
+
}
|
|
8623
|
+
const { includePattern, folder } = parseSearchInclude(GlobPattern.from(include));
|
|
8624
|
+
return this._proxy.$startFileSearch(withUndefinedAsNull(includePattern), withUndefinedAsNull(folder), withUndefinedAsNull(excludePatternOrDisregardExcludes), withUndefinedAsNull(maxResults), token)
|
|
8625
|
+
.then(data => Array.isArray(data) ? data.map(d => URI.revive(d)) : []);
|
|
8626
|
+
}
|
|
8627
|
+
async findTextInFiles(query, options, callback, extensionId, token = CancellationToken.None) {
|
|
8628
|
+
this._logService.trace(`extHostWorkspace#findTextInFiles: textSearch, extension: ${extensionId.value}, entryPoint: findTextInFiles`);
|
|
8629
|
+
const requestId = this._requestIdProvider.getNext();
|
|
8630
|
+
const previewOptions = typeof options.previewOptions === 'undefined' ?
|
|
8631
|
+
{
|
|
8632
|
+
matchLines: 100,
|
|
8633
|
+
charsPerLine: 10000
|
|
8634
|
+
} :
|
|
8635
|
+
options.previewOptions;
|
|
8636
|
+
const { includePattern, folder } = parseSearchInclude(GlobPattern.from(options.include));
|
|
8637
|
+
const excludePattern = (typeof options.exclude === 'string') ? options.exclude :
|
|
8638
|
+
options.exclude ? options.exclude.pattern : undefined;
|
|
8639
|
+
const queryOptions = {
|
|
8640
|
+
ignoreSymlinks: typeof options.followSymlinks === 'boolean' ? !options.followSymlinks : undefined,
|
|
8641
|
+
disregardIgnoreFiles: typeof options.useIgnoreFiles === 'boolean' ? !options.useIgnoreFiles : undefined,
|
|
8642
|
+
disregardGlobalIgnoreFiles: typeof options.useGlobalIgnoreFiles === 'boolean' ? !options.useGlobalIgnoreFiles : undefined,
|
|
8643
|
+
disregardParentIgnoreFiles: typeof options.useParentIgnoreFiles === 'boolean' ? !options.useParentIgnoreFiles : undefined,
|
|
8644
|
+
disregardExcludeSettings: typeof options.useDefaultExcludes === 'boolean' ? !options.useDefaultExcludes : true,
|
|
8645
|
+
fileEncoding: options.encoding,
|
|
8646
|
+
maxResults: options.maxResults,
|
|
8647
|
+
previewOptions,
|
|
8648
|
+
afterContext: options.afterContext,
|
|
8649
|
+
beforeContext: options.beforeContext,
|
|
8650
|
+
includePattern: includePattern,
|
|
8651
|
+
excludePattern: excludePattern
|
|
8652
|
+
};
|
|
8653
|
+
this._activeSearchCallbacks[requestId] = p => {
|
|
8654
|
+
const uri = URI.revive(p.resource);
|
|
8655
|
+
p.results.forEach(result => {
|
|
8656
|
+
if (resultIsMatch(result)) {
|
|
8657
|
+
callback({
|
|
8658
|
+
uri,
|
|
8659
|
+
preview: {
|
|
8660
|
+
text: result.preview.text,
|
|
8661
|
+
matches: mapArrayOrNot(result.preview.matches, m => new Range$2(m.startLineNumber, m.startColumn, m.endLineNumber, m.endColumn))
|
|
8662
|
+
},
|
|
8663
|
+
ranges: mapArrayOrNot(result.ranges, r => new Range$2(r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn))
|
|
8664
|
+
});
|
|
8665
|
+
}
|
|
8666
|
+
else {
|
|
8667
|
+
callback({
|
|
8668
|
+
uri,
|
|
8669
|
+
text: result.text,
|
|
8670
|
+
lineNumber: result.lineNumber
|
|
8671
|
+
});
|
|
8672
|
+
}
|
|
8673
|
+
});
|
|
8674
|
+
};
|
|
8675
|
+
if (token.isCancellationRequested) {
|
|
8676
|
+
return {};
|
|
8677
|
+
}
|
|
8678
|
+
try {
|
|
8679
|
+
const result = await this._proxy.$startTextSearch(query, withUndefinedAsNull(folder), queryOptions, requestId, token);
|
|
8680
|
+
delete this._activeSearchCallbacks[requestId];
|
|
8681
|
+
return result || {};
|
|
8682
|
+
}
|
|
8683
|
+
catch (err) {
|
|
8684
|
+
delete this._activeSearchCallbacks[requestId];
|
|
8685
|
+
throw err;
|
|
8686
|
+
}
|
|
8687
|
+
}
|
|
8688
|
+
$handleTextSearchResult(result, requestId) {
|
|
8689
|
+
if (this._activeSearchCallbacks[requestId]) {
|
|
8690
|
+
this._activeSearchCallbacks[requestId](result);
|
|
8691
|
+
}
|
|
8692
|
+
}
|
|
8693
|
+
saveAll(includeUntitled) {
|
|
8694
|
+
return this._proxy.$saveAll(includeUntitled);
|
|
8695
|
+
}
|
|
8696
|
+
resolveProxy(url) {
|
|
8697
|
+
return this._proxy.$resolveProxy(url);
|
|
8698
|
+
}
|
|
8699
|
+
get trusted() {
|
|
8700
|
+
return this._trusted;
|
|
8701
|
+
}
|
|
8702
|
+
requestWorkspaceTrust(options) {
|
|
8703
|
+
return this._proxy.$requestWorkspaceTrust(options);
|
|
8704
|
+
}
|
|
8705
|
+
$onDidGrantWorkspaceTrust() {
|
|
8706
|
+
if (!this._trusted) {
|
|
8707
|
+
this._trusted = true;
|
|
8708
|
+
this._onDidGrantWorkspaceTrust.fire();
|
|
8709
|
+
}
|
|
8710
|
+
}
|
|
8711
|
+
};
|
|
8712
|
+
ExtHostWorkspace = __decorate([
|
|
8713
|
+
__param(0, IExtHostRpcService),
|
|
8714
|
+
__param(1, IExtHostInitDataService),
|
|
8715
|
+
__param(2, IExtHostFileSystemInfo),
|
|
8716
|
+
__param(3, ILogService)
|
|
8717
|
+
], ExtHostWorkspace);
|
|
8718
|
+
const IExtHostWorkspace = createDecorator('IExtHostWorkspace');
|
|
8719
|
+
function parseSearchInclude(include) {
|
|
8720
|
+
let includePattern;
|
|
8721
|
+
let includeFolder;
|
|
8722
|
+
if (include) {
|
|
8723
|
+
if (typeof include === 'string') {
|
|
8724
|
+
includePattern = include;
|
|
8725
|
+
}
|
|
8726
|
+
else {
|
|
8727
|
+
includePattern = include.pattern;
|
|
8728
|
+
includeFolder = URI.revive(include.baseUri);
|
|
8729
|
+
}
|
|
8730
|
+
}
|
|
8731
|
+
return {
|
|
8732
|
+
includePattern,
|
|
8733
|
+
folder: includeFolder
|
|
8734
|
+
};
|
|
8735
|
+
}
|
|
7938
8736
|
function reviveIconPathUris(iconPath) {
|
|
7939
8737
|
iconPath.dark = URI.revive(iconPath.dark);
|
|
7940
8738
|
if (iconPath.light) {
|
|
@@ -13863,6 +14661,302 @@ class MainThreadDocumentRangeSemanticTokensProvider {
|
|
|
13863
14661
|
throw new Error(`Unexpected`);
|
|
13864
14662
|
}
|
|
13865
14663
|
}
|
|
14664
|
+
function lookUp(tree, key) {
|
|
14665
|
+
if (key) {
|
|
14666
|
+
const parts = key.split('.');
|
|
14667
|
+
let node = tree;
|
|
14668
|
+
for (let i = 0; node && i < parts.length; i++) {
|
|
14669
|
+
node = node[parts[i]];
|
|
14670
|
+
}
|
|
14671
|
+
return node;
|
|
14672
|
+
}
|
|
14673
|
+
}
|
|
14674
|
+
function isUri(thing) {
|
|
14675
|
+
return thing instanceof URI;
|
|
14676
|
+
}
|
|
14677
|
+
function isResourceLanguage(thing) {
|
|
14678
|
+
return thing
|
|
14679
|
+
&& thing.uri instanceof URI
|
|
14680
|
+
&& (thing.languageId && typeof thing.languageId === 'string');
|
|
14681
|
+
}
|
|
14682
|
+
function isLanguage(thing) {
|
|
14683
|
+
return thing
|
|
14684
|
+
&& !thing.uri
|
|
14685
|
+
&& (thing.languageId && typeof thing.languageId === 'string');
|
|
14686
|
+
}
|
|
14687
|
+
function isWorkspaceFolder(thing) {
|
|
14688
|
+
return thing
|
|
14689
|
+
&& thing.uri instanceof URI
|
|
14690
|
+
&& (!thing.name || typeof thing.name === 'string')
|
|
14691
|
+
&& (!thing.index || typeof thing.index === 'number');
|
|
14692
|
+
}
|
|
14693
|
+
function scopeToOverrides(scope) {
|
|
14694
|
+
if (isUri(scope)) {
|
|
14695
|
+
return { resource: scope };
|
|
14696
|
+
}
|
|
14697
|
+
if (isResourceLanguage(scope)) {
|
|
14698
|
+
return { resource: scope.uri, overrideIdentifier: scope.languageId };
|
|
14699
|
+
}
|
|
14700
|
+
if (isLanguage(scope)) {
|
|
14701
|
+
return { overrideIdentifier: scope.languageId };
|
|
14702
|
+
}
|
|
14703
|
+
if (isWorkspaceFolder(scope)) {
|
|
14704
|
+
return { resource: scope.uri };
|
|
14705
|
+
}
|
|
14706
|
+
if (scope === null) {
|
|
14707
|
+
return { resource: null };
|
|
14708
|
+
}
|
|
14709
|
+
return undefined;
|
|
14710
|
+
}
|
|
14711
|
+
class ExtHostConfigProvider {
|
|
14712
|
+
constructor(proxy, extHostWorkspace, data, logService) {
|
|
14713
|
+
this._onDidChangeConfiguration = new Emitter();
|
|
14714
|
+
this._proxy = proxy;
|
|
14715
|
+
this._logService = logService;
|
|
14716
|
+
this._extHostWorkspace = extHostWorkspace;
|
|
14717
|
+
this._configuration = Configuration.parse(data);
|
|
14718
|
+
this._configurationScopes = this._toMap(data.configurationScopes);
|
|
14719
|
+
}
|
|
14720
|
+
get onDidChangeConfiguration() {
|
|
14721
|
+
return this._onDidChangeConfiguration && this._onDidChangeConfiguration.event;
|
|
14722
|
+
}
|
|
14723
|
+
$acceptConfigurationChanged(data, change) {
|
|
14724
|
+
const previous = { data: this._configuration.toData(), workspace: this._extHostWorkspace.workspace };
|
|
14725
|
+
this._configuration = Configuration.parse(data);
|
|
14726
|
+
this._configurationScopes = this._toMap(data.configurationScopes);
|
|
14727
|
+
this._onDidChangeConfiguration.fire(this._toConfigurationChangeEvent(change, previous));
|
|
14728
|
+
}
|
|
14729
|
+
getConfiguration(section, scope, extensionDescription) {
|
|
14730
|
+
const overrides = scopeToOverrides(scope) || {};
|
|
14731
|
+
const config = this._toReadonlyValue(section
|
|
14732
|
+
? lookUp(this._configuration.getValue(undefined, overrides, this._extHostWorkspace.workspace), section)
|
|
14733
|
+
: this._configuration.getValue(undefined, overrides, this._extHostWorkspace.workspace));
|
|
14734
|
+
if (section) {
|
|
14735
|
+
this._validateConfigurationAccess(section, overrides, extensionDescription?.identifier);
|
|
14736
|
+
}
|
|
14737
|
+
function parseConfigurationTarget(arg) {
|
|
14738
|
+
if (arg === undefined || arg === null) {
|
|
14739
|
+
return null;
|
|
14740
|
+
}
|
|
14741
|
+
if (typeof arg === 'boolean') {
|
|
14742
|
+
return arg ? 1 : 4 ;
|
|
14743
|
+
}
|
|
14744
|
+
switch (arg) {
|
|
14745
|
+
case ConfigurationTarget$1.Global: return 1 ;
|
|
14746
|
+
case ConfigurationTarget$1.Workspace: return 4 ;
|
|
14747
|
+
case ConfigurationTarget$1.WorkspaceFolder: return 5 ;
|
|
14748
|
+
}
|
|
14749
|
+
}
|
|
14750
|
+
const result = {
|
|
14751
|
+
has(key) {
|
|
14752
|
+
return typeof lookUp(config, key) !== 'undefined';
|
|
14753
|
+
},
|
|
14754
|
+
get: (key, defaultValue) => {
|
|
14755
|
+
this._validateConfigurationAccess(section ? `${section}.${key}` : key, overrides, extensionDescription?.identifier);
|
|
14756
|
+
let result = lookUp(config, key);
|
|
14757
|
+
if (typeof result === 'undefined') {
|
|
14758
|
+
result = defaultValue;
|
|
14759
|
+
}
|
|
14760
|
+
else {
|
|
14761
|
+
let clonedConfig = undefined;
|
|
14762
|
+
const cloneOnWriteProxy = (target, accessor) => {
|
|
14763
|
+
let clonedTarget = undefined;
|
|
14764
|
+
const cloneTarget = () => {
|
|
14765
|
+
clonedConfig = clonedConfig ? clonedConfig : deepClone(config);
|
|
14766
|
+
clonedTarget = clonedTarget ? clonedTarget : lookUp(clonedConfig, accessor);
|
|
14767
|
+
};
|
|
14768
|
+
return isObject(target) ?
|
|
14769
|
+
new Proxy(target, {
|
|
14770
|
+
get: (target, property) => {
|
|
14771
|
+
if (typeof property === 'string' && property.toLowerCase() === 'tojson') {
|
|
14772
|
+
cloneTarget();
|
|
14773
|
+
return () => clonedTarget;
|
|
14774
|
+
}
|
|
14775
|
+
if (clonedConfig) {
|
|
14776
|
+
clonedTarget = clonedTarget ? clonedTarget : lookUp(clonedConfig, accessor);
|
|
14777
|
+
return clonedTarget[property];
|
|
14778
|
+
}
|
|
14779
|
+
const result = target[property];
|
|
14780
|
+
if (typeof property === 'string') {
|
|
14781
|
+
return cloneOnWriteProxy(result, `${accessor}.${property}`);
|
|
14782
|
+
}
|
|
14783
|
+
return result;
|
|
14784
|
+
},
|
|
14785
|
+
set: (_target, property, value) => {
|
|
14786
|
+
cloneTarget();
|
|
14787
|
+
if (clonedTarget) {
|
|
14788
|
+
clonedTarget[property] = value;
|
|
14789
|
+
}
|
|
14790
|
+
return true;
|
|
14791
|
+
},
|
|
14792
|
+
deleteProperty: (_target, property) => {
|
|
14793
|
+
cloneTarget();
|
|
14794
|
+
if (clonedTarget) {
|
|
14795
|
+
delete clonedTarget[property];
|
|
14796
|
+
}
|
|
14797
|
+
return true;
|
|
14798
|
+
},
|
|
14799
|
+
defineProperty: (_target, property, descriptor) => {
|
|
14800
|
+
cloneTarget();
|
|
14801
|
+
if (clonedTarget) {
|
|
14802
|
+
Object.defineProperty(clonedTarget, property, descriptor);
|
|
14803
|
+
}
|
|
14804
|
+
return true;
|
|
14805
|
+
}
|
|
14806
|
+
}) : target;
|
|
14807
|
+
};
|
|
14808
|
+
result = cloneOnWriteProxy(result, key);
|
|
14809
|
+
}
|
|
14810
|
+
return result;
|
|
14811
|
+
},
|
|
14812
|
+
update: (key, value, extHostConfigurationTarget, scopeToLanguage) => {
|
|
14813
|
+
key = section ? `${section}.${key}` : key;
|
|
14814
|
+
const target = parseConfigurationTarget(extHostConfigurationTarget);
|
|
14815
|
+
if (value !== undefined) {
|
|
14816
|
+
return this._proxy.$updateConfigurationOption(target, key, value, overrides, scopeToLanguage);
|
|
14817
|
+
}
|
|
14818
|
+
else {
|
|
14819
|
+
return this._proxy.$removeConfigurationOption(target, key, overrides, scopeToLanguage);
|
|
14820
|
+
}
|
|
14821
|
+
},
|
|
14822
|
+
inspect: (key) => {
|
|
14823
|
+
key = section ? `${section}.${key}` : key;
|
|
14824
|
+
const config = deepClone(this._configuration.inspect(key, overrides, this._extHostWorkspace.workspace));
|
|
14825
|
+
if (config) {
|
|
14826
|
+
return {
|
|
14827
|
+
key,
|
|
14828
|
+
defaultValue: config.default?.value,
|
|
14829
|
+
globalValue: config.user?.value,
|
|
14830
|
+
workspaceValue: config.workspace?.value,
|
|
14831
|
+
workspaceFolderValue: config.workspaceFolder?.value,
|
|
14832
|
+
defaultLanguageValue: config.default?.override,
|
|
14833
|
+
globalLanguageValue: config.user?.override,
|
|
14834
|
+
workspaceLanguageValue: config.workspace?.override,
|
|
14835
|
+
workspaceFolderLanguageValue: config.workspaceFolder?.override,
|
|
14836
|
+
languageIds: config.overrideIdentifiers
|
|
14837
|
+
};
|
|
14838
|
+
}
|
|
14839
|
+
return undefined;
|
|
14840
|
+
}
|
|
14841
|
+
};
|
|
14842
|
+
if (typeof config === 'object') {
|
|
14843
|
+
mixin(result, config, false);
|
|
14844
|
+
}
|
|
14845
|
+
return (
|
|
14846
|
+
Object.freeze(result)
|
|
14847
|
+
);
|
|
14848
|
+
}
|
|
14849
|
+
_toReadonlyValue(result) {
|
|
14850
|
+
const readonlyProxy = (target) => {
|
|
14851
|
+
return isObject(target) ?
|
|
14852
|
+
new Proxy(target, {
|
|
14853
|
+
get: (target, property) => readonlyProxy(target[property]),
|
|
14854
|
+
set: (_target, property, _value) => { throw new Error(`TypeError: Cannot assign to read only property '${String(property)}' of object`); },
|
|
14855
|
+
deleteProperty: (_target, property) => { throw new Error(`TypeError: Cannot delete read only property '${String(property)}' of object`); },
|
|
14856
|
+
defineProperty: (_target, property) => { throw new Error(`TypeError: Cannot define property '${String(property)}' for a readonly object`); },
|
|
14857
|
+
setPrototypeOf: (_target) => { throw new Error(`TypeError: Cannot set prototype for a readonly object`); },
|
|
14858
|
+
isExtensible: () => false,
|
|
14859
|
+
preventExtensions: () => true
|
|
14860
|
+
}) : target;
|
|
14861
|
+
};
|
|
14862
|
+
return readonlyProxy(result);
|
|
14863
|
+
}
|
|
14864
|
+
_validateConfigurationAccess(key, overrides, extensionId) {
|
|
14865
|
+
const scope = OVERRIDE_PROPERTY_REGEX$1.test(key) ? 4 : this._configurationScopes.get(key);
|
|
14866
|
+
const extensionIdText = extensionId ? `[${extensionId.value}] ` : '';
|
|
14867
|
+
if (4 === scope) {
|
|
14868
|
+
if (typeof overrides?.resource === 'undefined') {
|
|
14869
|
+
this._logService.warn(`${extensionIdText}Accessing a resource scoped configuration without providing a resource is not expected. To get the effective value for '${key}', provide the URI of a resource or 'null' for any resource.`);
|
|
14870
|
+
}
|
|
14871
|
+
return;
|
|
14872
|
+
}
|
|
14873
|
+
if (3 === scope) {
|
|
14874
|
+
if (overrides?.resource) {
|
|
14875
|
+
this._logService.warn(`${extensionIdText}Accessing a window scoped configuration for a resource is not expected. To associate '${key}' to a resource, define its scope to 'resource' in configuration contributions in 'package.json'.`);
|
|
14876
|
+
}
|
|
14877
|
+
return;
|
|
14878
|
+
}
|
|
14879
|
+
}
|
|
14880
|
+
_toConfigurationChangeEvent(change, previous) {
|
|
14881
|
+
const event = new ConfigurationChangeEvent(change, previous, this._configuration, this._extHostWorkspace.workspace);
|
|
14882
|
+
return (
|
|
14883
|
+
Object.freeze({
|
|
14884
|
+
affectsConfiguration: (section, scope) => event.affectsConfiguration(section, scopeToOverrides(scope))
|
|
14885
|
+
})
|
|
14886
|
+
);
|
|
14887
|
+
}
|
|
14888
|
+
_toMap(scopes) {
|
|
14889
|
+
return scopes.reduce((result, scope) => { result.set(scope[0], scope[1]); return result; }, new Map());
|
|
14890
|
+
}
|
|
14891
|
+
}
|
|
14892
|
+
let MainThreadConfiguration = class MainThreadConfiguration {
|
|
14893
|
+
constructor(extHostContext, _workspaceContextService, configurationService, _environmentService) {
|
|
14894
|
+
this._workspaceContextService = _workspaceContextService;
|
|
14895
|
+
this.configurationService = configurationService;
|
|
14896
|
+
this._environmentService = _environmentService;
|
|
14897
|
+
const proxy = extHostContext.getProxy(ExtHostContext.ExtHostConfiguration);
|
|
14898
|
+
proxy.$initializeConfiguration(this._getConfigurationData());
|
|
14899
|
+
this._configurationListener = configurationService.onDidChangeConfiguration(e => {
|
|
14900
|
+
proxy.$acceptConfigurationChanged(this._getConfigurationData(), e.change);
|
|
14901
|
+
});
|
|
14902
|
+
}
|
|
14903
|
+
_getConfigurationData() {
|
|
14904
|
+
const configurationData = { ...(this.configurationService.getConfigurationData()), configurationScopes: [] };
|
|
14905
|
+
if (!this._environmentService.isBuilt || this._environmentService.isExtensionDevelopment) {
|
|
14906
|
+
configurationData.configurationScopes = getScopes();
|
|
14907
|
+
}
|
|
14908
|
+
return configurationData;
|
|
14909
|
+
}
|
|
14910
|
+
dispose() {
|
|
14911
|
+
this._configurationListener.dispose();
|
|
14912
|
+
}
|
|
14913
|
+
$updateConfigurationOption(target, key, value, overrides, scopeToLanguage) {
|
|
14914
|
+
overrides = { resource: overrides?.resource ? URI.revive(overrides.resource) : undefined, overrideIdentifier: overrides?.overrideIdentifier };
|
|
14915
|
+
return this.writeConfiguration(target, key, value, overrides, scopeToLanguage);
|
|
14916
|
+
}
|
|
14917
|
+
$removeConfigurationOption(target, key, overrides, scopeToLanguage) {
|
|
14918
|
+
overrides = { resource: overrides?.resource ? URI.revive(overrides.resource) : undefined, overrideIdentifier: overrides?.overrideIdentifier };
|
|
14919
|
+
return this.writeConfiguration(target, key, undefined, overrides, scopeToLanguage);
|
|
14920
|
+
}
|
|
14921
|
+
writeConfiguration(target, key, value, overrides, scopeToLanguage) {
|
|
14922
|
+
target = target !== null && target !== undefined ? target : this.deriveConfigurationTarget(key, overrides);
|
|
14923
|
+
const configurationValue = this.configurationService.inspect(key, overrides);
|
|
14924
|
+
switch (target) {
|
|
14925
|
+
case 7 :
|
|
14926
|
+
return this._updateValue(key, value, target, configurationValue?.memory?.override, overrides, scopeToLanguage);
|
|
14927
|
+
case 5 :
|
|
14928
|
+
return this._updateValue(key, value, target, configurationValue?.workspaceFolder?.override, overrides, scopeToLanguage);
|
|
14929
|
+
case 4 :
|
|
14930
|
+
return this._updateValue(key, value, target, configurationValue?.workspace?.override, overrides, scopeToLanguage);
|
|
14931
|
+
case 3 :
|
|
14932
|
+
return this._updateValue(key, value, target, configurationValue?.userRemote?.override, overrides, scopeToLanguage);
|
|
14933
|
+
default:
|
|
14934
|
+
return this._updateValue(key, value, target, configurationValue?.userLocal?.override, overrides, scopeToLanguage);
|
|
14935
|
+
}
|
|
14936
|
+
}
|
|
14937
|
+
_updateValue(key, value, configurationTarget, overriddenValue, overrides, scopeToLanguage) {
|
|
14938
|
+
overrides = scopeToLanguage === true ? overrides
|
|
14939
|
+
: scopeToLanguage === false ? { resource: overrides.resource }
|
|
14940
|
+
: overrides.overrideIdentifier && overriddenValue !== undefined ? overrides
|
|
14941
|
+
: { resource: overrides.resource };
|
|
14942
|
+
return this.configurationService.updateValue(key, value, overrides, configurationTarget, true);
|
|
14943
|
+
}
|
|
14944
|
+
deriveConfigurationTarget(key, overrides) {
|
|
14945
|
+
if (overrides.resource && this._workspaceContextService.getWorkbenchState() === 3 ) {
|
|
14946
|
+
const configurationProperties = Registry.as(Extensions$1.Configuration).getConfigurationProperties();
|
|
14947
|
+
if (configurationProperties[key] && ((configurationProperties[key].scope === 4 || configurationProperties[key].scope === 5) )) {
|
|
14948
|
+
return 5 ;
|
|
14949
|
+
}
|
|
14950
|
+
}
|
|
14951
|
+
return 4 ;
|
|
14952
|
+
}
|
|
14953
|
+
};
|
|
14954
|
+
MainThreadConfiguration = __decorate([
|
|
14955
|
+
extHostNamedCustomer(MainContext.MainThreadConfiguration),
|
|
14956
|
+
__param(1, IWorkspaceContextService),
|
|
14957
|
+
__param(2, IConfigurationService),
|
|
14958
|
+
__param(3, IEnvironmentService)
|
|
14959
|
+
], MainThreadConfiguration);
|
|
13866
14960
|
const DEFAULT_EXTENSION = {
|
|
13867
14961
|
identifier: new ExtensionIdentifier('monaco'),
|
|
13868
14962
|
isBuiltin: true,
|
|
@@ -13917,6 +15011,28 @@ class MainThreadMessageServiceWithoutSource extends MainThreadMessageService {
|
|
|
13917
15011
|
};
|
|
13918
15012
|
}
|
|
13919
15013
|
}
|
|
15014
|
+
let SyncExtHostConfiguration = class SyncExtHostConfiguration {
|
|
15015
|
+
constructor(extHostRpc, extHostWorkspace, logService) {
|
|
15016
|
+
this._proxy = extHostRpc.getProxy(MainContext.MainThreadConfiguration);
|
|
15017
|
+
this._extHostWorkspace = extHostWorkspace;
|
|
15018
|
+
this._logService = logService;
|
|
15019
|
+
this._actual = null;
|
|
15020
|
+
}
|
|
15021
|
+
getConfigProvider() {
|
|
15022
|
+
return this._actual;
|
|
15023
|
+
}
|
|
15024
|
+
$initializeConfiguration(data) {
|
|
15025
|
+
this._actual = new ExtHostConfigProvider(this._proxy, this._extHostWorkspace, data, this._logService);
|
|
15026
|
+
}
|
|
15027
|
+
$acceptConfigurationChanged(data, change) {
|
|
15028
|
+
this.getConfigProvider().$acceptConfigurationChanged(data, change);
|
|
15029
|
+
}
|
|
15030
|
+
};
|
|
15031
|
+
SyncExtHostConfiguration = __decorate([
|
|
15032
|
+
__param(0, IExtHostRpcService),
|
|
15033
|
+
__param(1, IExtHostWorkspace),
|
|
15034
|
+
__param(2, ILogService)
|
|
15035
|
+
], SyncExtHostConfiguration);
|
|
13920
15036
|
function createExtHostServices() {
|
|
13921
15037
|
const commandsService = StandaloneServices.get(ICommandService);
|
|
13922
15038
|
const notificationService = StandaloneServices.get(INotificationService);
|
|
@@ -13948,6 +15064,7 @@ function createExtHostServices() {
|
|
|
13948
15064
|
const languageConfigurationService = StandaloneServices.get(ILanguageConfigurationService);
|
|
13949
15065
|
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
|
|
13950
15066
|
const configurationService = StandaloneServices.get(IConfigurationService);
|
|
15067
|
+
const workspaceContextService = StandaloneServices.get(IWorkspaceContextService);
|
|
13951
15068
|
const imessagePassingProtocol = new SimpleMessagePassingProtocol();
|
|
13952
15069
|
const rpcProtocol = new RPCProtocol(imessagePassingProtocol);
|
|
13953
15070
|
const extHostFileSystemInfo = new ExtHostFileSystemInfo();
|
|
@@ -13968,6 +15085,26 @@ function createExtHostServices() {
|
|
|
13968
15085
|
return rpcProtocol.drain();
|
|
13969
15086
|
}
|
|
13970
15087
|
};
|
|
15088
|
+
const initData = {
|
|
15089
|
+
_serviceBrand: undefined,
|
|
15090
|
+
version: '1.0.0',
|
|
15091
|
+
parentPid: 0,
|
|
15092
|
+
get environment() { return unsupported$1(); },
|
|
15093
|
+
resolvedExtensions: [],
|
|
15094
|
+
hostExtensions: [],
|
|
15095
|
+
extensions: [Services.get().extension ?? DEFAULT_EXTENSION],
|
|
15096
|
+
get telemetryInfo() { return unsupported$1(); },
|
|
15097
|
+
logLevel: LogLevel$1.Trace,
|
|
15098
|
+
get logsLocation() { return unsupported$1(); },
|
|
15099
|
+
get logFile() { return unsupported$1(); },
|
|
15100
|
+
autoStart: false,
|
|
15101
|
+
remote: {
|
|
15102
|
+
isRemote: false,
|
|
15103
|
+
authority: undefined,
|
|
15104
|
+
connectionData: null
|
|
15105
|
+
},
|
|
15106
|
+
uiKind: UIKind$1.Web
|
|
15107
|
+
};
|
|
13971
15108
|
const extHostLogService = new LogService(new ConsoleMainLogger());
|
|
13972
15109
|
const extensionService = new NullExtensionService();
|
|
13973
15110
|
const extHostApiDeprecationService = new ExtHostApiDeprecationService(mainContext, extHostLogService);
|
|
@@ -13987,6 +15124,8 @@ function createExtHostServices() {
|
|
|
13987
15124
|
const extHostEditors = rpcProtocol.set(ExtHostContext.ExtHostEditors, new ExtHostEditors(mainContext, extHostDocumentsAndEditors));
|
|
13988
15125
|
const extHostClipboard = new ExtHostClipboard(mainContext);
|
|
13989
15126
|
const extHostLanguageFeatures = rpcProtocol.set(ExtHostContext.ExtHostLanguageFeatures, new ExtHostLanguageFeatures(rpcProtocol, uriTransformerService, extHostDocuments, extHostCommands, extHostDiagnostics, extHostLogService, extHostApiDeprecationService));
|
|
15127
|
+
const extHostWorkspace = rpcProtocol.set(ExtHostContext.ExtHostWorkspace, new ExtHostWorkspace(mainContext, initData, extHostFileSystemInfo, extHostLogService));
|
|
15128
|
+
const extHostConfiguration = rpcProtocol.set(ExtHostContext.ExtHostConfiguration, new SyncExtHostConfiguration(mainContext, extHostWorkspace, extHostLogService));
|
|
13990
15129
|
rpcProtocol.set(ExtHostContext.ExtHostTelemetry, new ExtHostTelemetry());
|
|
13991
15130
|
rpcProtocol.set(MainContext.MainThreadMessageService, new MainThreadMessageServiceWithoutSource(mainContext, notificationService, commandsService, dialogService));
|
|
13992
15131
|
rpcProtocol.set(MainContext.MainThreadDiagnostics, new MonacoMainThreadDiagnostics(mainContext, markerService, uriIdentityService));
|
|
@@ -13998,6 +15137,7 @@ function createExtHostServices() {
|
|
|
13998
15137
|
rpcProtocol.set(MainContext.MainThreadLanguages, new MainThreadLanguages(mainContext, languageService, modelService, textModelService, languageStatusService));
|
|
13999
15138
|
rpcProtocol.set(MainContext.MainThreadClipboard, new MainThreadClipboard(mainContext, clipboardService));
|
|
14000
15139
|
rpcProtocol.set(MainContext.MainThreadLanguageFeatures, new MainThreadLanguageFeatures(mainContext, languageService, languageConfigurationService, languageFeaturesService));
|
|
15140
|
+
rpcProtocol.set(MainContext.MainThreadConfiguration, new MainThreadConfiguration(mainContext, workspaceContextService, configurationService, workbenchEnvironmentService));
|
|
14001
15141
|
new MainThreadDocumentsAndEditors(mainContext, modelService, textFileService, editorService, codeEditorService, fileService, textModelService, editorGroupsService, bulkEditService, paneCompositePartService, workbenchEnvironmentService, workingCopyFileService, uriIdentityService, clipboardService, pathService);
|
|
14002
15142
|
const extHostBulkEdits = new ExtHostBulkEdits(mainContext, extHostDocumentsAndEditors);
|
|
14003
15143
|
return {
|
|
@@ -14016,7 +15156,9 @@ function createExtHostServices() {
|
|
|
14016
15156
|
extHostLanguages,
|
|
14017
15157
|
extHostWindow,
|
|
14018
15158
|
extHostClipboard,
|
|
14019
|
-
extHostLanguageFeatures
|
|
15159
|
+
extHostLanguageFeatures,
|
|
15160
|
+
extHostWorkspace,
|
|
15161
|
+
extHostConfiguration
|
|
14020
15162
|
};
|
|
14021
15163
|
}
|
|
14022
15164
|
let extHostServices;
|
|
@@ -14298,24 +15440,14 @@ const workspace$1 = {
|
|
|
14298
15440
|
return extHostBulkEdits.applyWorkspaceEdit(edit);
|
|
14299
15441
|
},
|
|
14300
15442
|
getConfiguration: (section, scope) => {
|
|
14301
|
-
const {
|
|
14302
|
-
|
|
14303
|
-
|
|
14304
|
-
}
|
|
14305
|
-
return {
|
|
14306
|
-
get: (section, defaultValue) => {
|
|
14307
|
-
return defaultValue;
|
|
14308
|
-
},
|
|
14309
|
-
has: () => {
|
|
14310
|
-
return false;
|
|
14311
|
-
},
|
|
14312
|
-
inspect: unsupported$1,
|
|
14313
|
-
update: unsupported$1
|
|
14314
|
-
};
|
|
15443
|
+
const { extHostConfiguration } = getExtHostServices();
|
|
15444
|
+
const configProvider = extHostConfiguration.getConfigProvider();
|
|
15445
|
+
return configProvider.getConfiguration(section, scope, Services.get().extension ?? DEFAULT_EXTENSION);
|
|
14315
15446
|
},
|
|
14316
|
-
|
|
14317
|
-
const {
|
|
14318
|
-
|
|
15447
|
+
onDidChangeConfiguration(listener, thisArgs, disposables) {
|
|
15448
|
+
const { extHostConfiguration } = getExtHostServices();
|
|
15449
|
+
const configProvider = extHostConfiguration.getConfigProvider();
|
|
15450
|
+
return configProvider.onDidChangeConfiguration(listener, thisArgs, disposables);
|
|
14319
15451
|
},
|
|
14320
15452
|
get rootPath() {
|
|
14321
15453
|
const { workspace } = Services.get();
|
|
@@ -14442,6 +15574,31 @@ const workspace$1 = {
|
|
|
14442
15574
|
onDidChangeNotebookDocument: unsupported$1,
|
|
14443
15575
|
onDidSaveNotebookDocument: unsupported$1
|
|
14444
15576
|
};
|
|
15577
|
+
class TextTabInput {
|
|
15578
|
+
constructor(uri) {
|
|
15579
|
+
this.uri = uri;
|
|
15580
|
+
}
|
|
15581
|
+
}
|
|
15582
|
+
function getTabFromModel(model, tabGroup) {
|
|
15583
|
+
return {
|
|
15584
|
+
label: model.uri.fsPath,
|
|
15585
|
+
group: tabGroup,
|
|
15586
|
+
get isActive() { return model.isAttachedToEditor(); },
|
|
15587
|
+
isDirty: false,
|
|
15588
|
+
isPinned: false,
|
|
15589
|
+
isPreview: false,
|
|
15590
|
+
input: new TextTabInput(model.uri)
|
|
15591
|
+
};
|
|
15592
|
+
}
|
|
15593
|
+
const tabGroup = {
|
|
15594
|
+
isActive: true,
|
|
15595
|
+
activeTab: undefined,
|
|
15596
|
+
viewColumn: ViewColumn$2.One,
|
|
15597
|
+
get tabs() {
|
|
15598
|
+
const modelService = StandaloneServices.get(IModelService);
|
|
15599
|
+
return modelService.getModels().map(model => getTabFromModel(model, tabGroup));
|
|
15600
|
+
}
|
|
15601
|
+
};
|
|
14445
15602
|
const window$2 = {
|
|
14446
15603
|
showInformationMessage(message, ...rest) {
|
|
14447
15604
|
const { extHostMessageService } = getExtHostServices();
|
|
@@ -14569,8 +15726,32 @@ const window$2 = {
|
|
|
14569
15726
|
registerFileDecorationProvider: unsupported$1,
|
|
14570
15727
|
registerTerminalProfileProvider: unsupported$1,
|
|
14571
15728
|
onDidChangeTerminalState: Event.None,
|
|
14572
|
-
|
|
14573
|
-
|
|
15729
|
+
tabGroups: {
|
|
15730
|
+
get all() {
|
|
15731
|
+
return [tabGroup];
|
|
15732
|
+
},
|
|
15733
|
+
activeTabGroup: tabGroup,
|
|
15734
|
+
onDidChangeTabGroups: Event.None,
|
|
15735
|
+
onDidChangeTabs(listener) {
|
|
15736
|
+
const modelService = StandaloneServices.get(IModelService);
|
|
15737
|
+
const store = new DisposableStore();
|
|
15738
|
+
store.add(modelService.onModelAdded((model) => {
|
|
15739
|
+
listener({
|
|
15740
|
+
opened: [getTabFromModel(model, tabGroup)],
|
|
15741
|
+
closed: [],
|
|
15742
|
+
changed: []
|
|
15743
|
+
});
|
|
15744
|
+
}));
|
|
15745
|
+
store.add(modelService.onModelRemoved((model) => {
|
|
15746
|
+
listener({
|
|
15747
|
+
opened: [],
|
|
15748
|
+
closed: [getTabFromModel(model, tabGroup)],
|
|
15749
|
+
changed: []
|
|
15750
|
+
});
|
|
15751
|
+
}));
|
|
15752
|
+
return store;
|
|
15753
|
+
},
|
|
15754
|
+
close: unsupported$1
|
|
14574
15755
|
}
|
|
14575
15756
|
};
|
|
14576
15757
|
const env$1 = {
|
|
@@ -14764,7 +15945,7 @@ const api = {
|
|
|
14764
15945
|
DataTransferItem: unsupported,
|
|
14765
15946
|
LanguageStatusSeverity: LanguageStatusSeverity$1,
|
|
14766
15947
|
QuickPickItemKind: QuickPickItemKind$1,
|
|
14767
|
-
TabInputText:
|
|
15948
|
+
TabInputText: TextTabInput,
|
|
14768
15949
|
TabInputTextDiff: unsupported,
|
|
14769
15950
|
TabInputCustom: unsupported,
|
|
14770
15951
|
TabInputNotebook: unsupported,
|