@codingame/monaco-vscode-api 1.67.14 → 1.67.17
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 +36 -3
- package/dist/api.js +1279 -97
- package/dist/async-c7fd4178.js +212 -0
- package/dist/configuration.d.ts +292 -0
- package/dist/configuration.js +2178 -0
- package/dist/messages.d.ts +3 -3
- package/dist/messages.js +14 -6
- package/dist/{missing-services-0f9c8f22.js → missing-services-597951f0.js} +357 -31
- package/dist/modelEditor.d.ts +1 -3
- package/dist/modelEditor.js +25 -20
- package/dist/monaco.d.ts +2683 -0
- package/dist/monaco.js +149 -0
- package/dist/position-291dfe99.js +3 -0
- package/dist/{services-621e567e.js → services-9299c4ca.js} +264 -21
- package/dist/services.d.ts +327 -331
- package/dist/services.js +4 -2
- package/dist/tslib.es6-16b40665.js +21 -0
- package/dist/types-371cc315.js +27 -0
- package/package.json +15 -1
- package/dist/async-9ffe4d42.js +0 -46
package/dist/api.js
CHANGED
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as __classPrivateFieldSet, a as __classPrivateFieldGet, b as __decorate, c as
|
|
1
|
+
import { E as Emitter, u as unsupported$1 } from './missing-services-597951f0.js';
|
|
2
|
+
import { _ as __classPrivateFieldSet, a as __classPrivateFieldGet, b as __decorate, c as __param } from './tslib.es6-16b40665.js';
|
|
3
|
+
import { c as coalesceInPlace, m as markAsFileSystemProviderError, F as FileSystemProviderErrorCode, S as SIDE_GROUP, A as ACTIVE_GROUP, C as CancellationTokenSource$1, d as delta$1, a as mapArrayOrNot, I as IProgressService, r as readonly, b as ITextFileService, e as IFileService, f as IWorkbenchEnvironmentService, g as IUriIdentityService, h as IWorkingCopyFileService, i as IPathService, j as disposed, k as IEditorService, l as IEditorGroupsService, n as IPaneCompositePartService, o as IProductService, p as ILanguageStatusService, q as IHostService, s as Services, t as FileType$1, u as FilePermission$1 } from './services-9299c4ca.js';
|
|
4
|
+
import { i as isStringArray, w as withUndefinedAsNull } from './types-371cc315.js';
|
|
3
5
|
import { illegalArgument, onUnexpectedError, canceled, transformErrorForSerialization, isCancellationError, onUnexpectedExternalError, CancellationError as CancellationError$1 } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
4
6
|
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';
|
|
7
|
+
import { distinct, equals, coalesce, asArray, isNonEmptyArray, groupBy, isFalsyOrEmpty } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
6
8
|
import { MarkdownString as MarkdownString$3, parseHrefAndDimensions, isMarkdownString } from 'monaco-editor/esm/vs/base/common/htmlContent.js';
|
|
7
9
|
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
8
10
|
import { compare, equalsIgnoreCase, nextCharLength, regExpLeadsToEndlessLoop, splitLines, isFalsyOrWhitespace, regExpFlags } from 'monaco-editor/esm/vs/base/common/strings.js';
|
|
9
11
|
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';
|
|
12
|
+
import { isString, isUndefinedOrNull, isUndefined, isArray, isNumber, validateConstraint, assertIsDefined, withNullAsUndefined, isObject } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
13
|
+
import { ResourceMap, TernarySearchTree } from 'monaco-editor/esm/vs/base/common/map.js';
|
|
12
14
|
import { marked as marked$1 } from 'monaco-editor/esm/vs/base/common/marked/marked.js';
|
|
13
15
|
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api.js';
|
|
14
16
|
import { MarkerSeverity, IMarkerService } from 'monaco-editor/esm/vs/platform/markers/common/markers.js';
|
|
15
17
|
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';
|
|
18
|
+
import { cloneAndChange, deepFreeze, equals as equals$1, mixin, deepClone } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
17
19
|
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
20
|
+
import { P as Position$3 } from './position-291dfe99.js';
|
|
18
21
|
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
19
22
|
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';
|
|
23
|
+
import { ILogService, LogLevel as LogLevel$1, LogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
21
24
|
import { Disposable as Disposable$2, toDisposable, dispose, combinedDisposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
22
25
|
import { Event, DebounceEmitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
23
26
|
import { CommandsRegistry, ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
24
27
|
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';
|
|
28
|
+
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
29
|
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
27
30
|
import { RunOnceScheduler, createCancelablePromise, disposableTimeout } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
28
31
|
import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
29
32
|
import { MirrorTextModel } from 'monaco-editor/esm/vs/editor/common/model/mirrorTextModel.js';
|
|
30
33
|
import { ok } from 'monaco-editor/esm/vs/base/common/assert.js';
|
|
31
34
|
import { getWordAtText, ensureValidWordDefinition } from 'monaco-editor/esm/vs/editor/common/core/wordHelper.js';
|
|
32
|
-
import { a as asPromise, r as raceCancellationError } from './async-
|
|
35
|
+
import { a as asPromise, B as Barrier, r as raceCancellationError } from './async-c7fd4178.js';
|
|
33
36
|
import { ThemeIcon as ThemeIcon$2 } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
34
37
|
import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
|
|
38
|
+
import { Severity as Severity$1, INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
39
|
+
import { Workspace, WorkspaceFolder, IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
35
40
|
import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
|
|
36
|
-
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
37
41
|
import { IDialogService } from 'monaco-editor/esm/vs/platform/dialogs/common/dialogs.js';
|
|
38
42
|
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
39
43
|
import { Progress } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
@@ -66,6 +70,10 @@ import { StopWatch } from 'monaco-editor/esm/vs/base/common/stopwatch.js';
|
|
|
66
70
|
import { LanguageFeatureRegistry } from 'monaco-editor/esm/vs/editor/common/languageFeatureRegistry.js';
|
|
67
71
|
import { LanguageConfigurationRegistry, ILanguageConfigurationService } from 'monaco-editor/esm/vs/editor/common/languages/languageConfigurationRegistry.js';
|
|
68
72
|
import { ILanguageFeaturesService } from 'monaco-editor/esm/vs/editor/common/services/languageFeatures.js';
|
|
73
|
+
import { Configuration, ConfigurationChangeEvent } from 'monaco-editor/esm/vs/platform/configuration/common/configurationModels.js';
|
|
74
|
+
import { OVERRIDE_PROPERTY_REGEX as OVERRIDE_PROPERTY_REGEX$1, Extensions as Extensions$1 } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
75
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
76
|
+
import { Extensions } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js';
|
|
69
77
|
import { ExtensionIdentifier } from 'monaco-editor/esm/vs/platform/extensions/common/extensions.js';
|
|
70
78
|
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
71
79
|
import { score } from 'monaco-editor/esm/vs/editor/common/languageSelector.js';
|
|
@@ -81,7 +89,6 @@ import 'monaco-editor/esm/vs/base/parts/quickinput/browser/quickInput.js';
|
|
|
81
89
|
import 'monaco-editor/esm/vs/platform/instantiation/common/extensions.js';
|
|
82
90
|
import 'monaco-editor/esm/vs/platform/label/common/label.js';
|
|
83
91
|
import 'monaco-editor/esm/vs/base/browser/event.js';
|
|
84
|
-
import 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
|
|
85
92
|
import 'monaco-editor/esm/vs/base/common/linkedList.js';
|
|
86
93
|
function originalFSPath(uri) {
|
|
87
94
|
return uriToFsPath(uri, true);
|
|
@@ -274,6 +281,363 @@ function toLocalResource(resource, authority, localScheme) {
|
|
|
274
281
|
}
|
|
275
282
|
const Range$3 = monaco.Range;
|
|
276
283
|
const FoldingRangeKind$3 = monaco.languages.FoldingRangeKind;
|
|
284
|
+
const resourceLanguageSettingsSchemaId = 'vscode://schemas/settings/resourceLanguage';
|
|
285
|
+
const contributionRegistry = Registry.as(Extensions.JSONContribution);
|
|
286
|
+
class ConfigurationRegistry {
|
|
287
|
+
constructor() {
|
|
288
|
+
this.overrideIdentifiers = new Set();
|
|
289
|
+
this._onDidSchemaChange = new Emitter();
|
|
290
|
+
this.onDidSchemaChange = this._onDidSchemaChange.event;
|
|
291
|
+
this._onDidUpdateConfiguration = new Emitter();
|
|
292
|
+
this.onDidUpdateConfiguration = this._onDidUpdateConfiguration.event;
|
|
293
|
+
this.configurationDefaultsOverrides = new Map();
|
|
294
|
+
this.defaultLanguageConfigurationOverridesNode = {
|
|
295
|
+
id: 'defaultOverrides',
|
|
296
|
+
title: localize(
|
|
297
|
+
'defaultLanguageConfigurationOverrides.title',
|
|
298
|
+
"Default Language Configuration Overrides"
|
|
299
|
+
),
|
|
300
|
+
properties: {}
|
|
301
|
+
};
|
|
302
|
+
this.configurationContributors = [this.defaultLanguageConfigurationOverridesNode];
|
|
303
|
+
this.resourceLanguageSettingsSchema = { properties: {}, patternProperties: {}, additionalProperties: false, errorMessage: 'Unknown editor configuration setting', allowTrailingCommas: true, allowComments: true };
|
|
304
|
+
this.configurationProperties = {};
|
|
305
|
+
this.excludedConfigurationProperties = {};
|
|
306
|
+
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
|
|
307
|
+
this.registerOverridePropertyPatternKey();
|
|
308
|
+
}
|
|
309
|
+
registerConfiguration(configuration, validate = true) {
|
|
310
|
+
this.registerConfigurations([configuration], validate);
|
|
311
|
+
}
|
|
312
|
+
registerConfigurations(configurations, validate = true) {
|
|
313
|
+
const properties = this.doRegisterConfigurations(configurations, validate);
|
|
314
|
+
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
|
|
315
|
+
this._onDidSchemaChange.fire();
|
|
316
|
+
this._onDidUpdateConfiguration.fire({ properties });
|
|
317
|
+
}
|
|
318
|
+
deregisterConfigurations(configurations) {
|
|
319
|
+
const properties = this.doDeregisterConfigurations(configurations);
|
|
320
|
+
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
|
|
321
|
+
this._onDidSchemaChange.fire();
|
|
322
|
+
this._onDidUpdateConfiguration.fire({ properties });
|
|
323
|
+
}
|
|
324
|
+
updateConfigurations({ add, remove }) {
|
|
325
|
+
const properties = [];
|
|
326
|
+
properties.push(...this.doDeregisterConfigurations(remove));
|
|
327
|
+
properties.push(...this.doRegisterConfigurations(add, false));
|
|
328
|
+
contributionRegistry.registerSchema(resourceLanguageSettingsSchemaId, this.resourceLanguageSettingsSchema);
|
|
329
|
+
this._onDidSchemaChange.fire();
|
|
330
|
+
this._onDidUpdateConfiguration.fire({ properties: distinct(properties) });
|
|
331
|
+
}
|
|
332
|
+
registerDefaultConfigurations(configurationDefaults) {
|
|
333
|
+
const properties = [];
|
|
334
|
+
const overrideIdentifiers = [];
|
|
335
|
+
for (const { overrides, source } of configurationDefaults) {
|
|
336
|
+
for (const key in overrides) {
|
|
337
|
+
properties.push(key);
|
|
338
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
339
|
+
const defaultValue = { ...(this.configurationDefaultsOverrides.get(key)?.value || {}), ...overrides[key] };
|
|
340
|
+
this.configurationDefaultsOverrides.set(key, { source, value: defaultValue });
|
|
341
|
+
const property = {
|
|
342
|
+
type: 'object',
|
|
343
|
+
default: defaultValue,
|
|
344
|
+
description: localize(
|
|
345
|
+
'defaultLanguageConfiguration.description',
|
|
346
|
+
"Configure settings to be overridden for {0} language.",
|
|
347
|
+
key
|
|
348
|
+
),
|
|
349
|
+
$ref: resourceLanguageSettingsSchemaId,
|
|
350
|
+
defaultDefaultValue: defaultValue,
|
|
351
|
+
source: isString(source) ? undefined : source,
|
|
352
|
+
};
|
|
353
|
+
overrideIdentifiers.push(...overrideIdentifiersFromKey(key));
|
|
354
|
+
this.configurationProperties[key] = property;
|
|
355
|
+
this.defaultLanguageConfigurationOverridesNode.properties[key] = property;
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
this.configurationDefaultsOverrides.set(key, { value: overrides[key], source });
|
|
359
|
+
const property = this.configurationProperties[key];
|
|
360
|
+
if (property) {
|
|
361
|
+
this.updatePropertyDefaultValue(key, property);
|
|
362
|
+
this.updateSchema(key, property);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
this.registerOverrideIdentifiers(overrideIdentifiers);
|
|
368
|
+
this._onDidSchemaChange.fire();
|
|
369
|
+
this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });
|
|
370
|
+
}
|
|
371
|
+
deregisterDefaultConfigurations(defaultConfigurations) {
|
|
372
|
+
const properties = [];
|
|
373
|
+
for (const { overrides, source } of defaultConfigurations) {
|
|
374
|
+
for (const key in overrides) {
|
|
375
|
+
const configurationDefaultsOverride = this.configurationDefaultsOverrides.get(key);
|
|
376
|
+
const id = isString(source) ? source : source?.id;
|
|
377
|
+
const configurationDefaultsOverrideSourceId = isString(configurationDefaultsOverride?.source) ? configurationDefaultsOverride?.source : configurationDefaultsOverride?.source?.id;
|
|
378
|
+
if (id !== configurationDefaultsOverrideSourceId) {
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
properties.push(key);
|
|
382
|
+
this.configurationDefaultsOverrides.delete(key);
|
|
383
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
384
|
+
delete this.configurationProperties[key];
|
|
385
|
+
delete this.defaultLanguageConfigurationOverridesNode.properties[key];
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
const property = this.configurationProperties[key];
|
|
389
|
+
if (property) {
|
|
390
|
+
this.updatePropertyDefaultValue(key, property);
|
|
391
|
+
this.updateSchema(key, property);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
this.updateOverridePropertyPatternKey();
|
|
397
|
+
this._onDidSchemaChange.fire();
|
|
398
|
+
this._onDidUpdateConfiguration.fire({ properties, defaultsOverrides: true });
|
|
399
|
+
}
|
|
400
|
+
notifyConfigurationSchemaUpdated(...configurations) {
|
|
401
|
+
this._onDidSchemaChange.fire();
|
|
402
|
+
}
|
|
403
|
+
registerOverrideIdentifiers(overrideIdentifiers) {
|
|
404
|
+
for (const overrideIdentifier of overrideIdentifiers) {
|
|
405
|
+
this.overrideIdentifiers.add(overrideIdentifier);
|
|
406
|
+
}
|
|
407
|
+
this.updateOverridePropertyPatternKey();
|
|
408
|
+
}
|
|
409
|
+
doRegisterConfigurations(configurations, validate) {
|
|
410
|
+
const properties = [];
|
|
411
|
+
configurations.forEach(configuration => {
|
|
412
|
+
properties.push(...this.validateAndRegisterProperties(configuration, validate, configuration.extensionInfo, configuration.restrictedProperties));
|
|
413
|
+
this.configurationContributors.push(configuration);
|
|
414
|
+
this.registerJSONConfiguration(configuration);
|
|
415
|
+
});
|
|
416
|
+
return properties;
|
|
417
|
+
}
|
|
418
|
+
doDeregisterConfigurations(configurations) {
|
|
419
|
+
const properties = [];
|
|
420
|
+
const deregisterConfiguration = (configuration) => {
|
|
421
|
+
if (configuration.properties) {
|
|
422
|
+
for (const key in configuration.properties) {
|
|
423
|
+
properties.push(key);
|
|
424
|
+
delete this.configurationProperties[key];
|
|
425
|
+
this.removeFromSchema(key, configuration.properties[key]);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
if (configuration.allOf) {
|
|
429
|
+
configuration.allOf.forEach(node => deregisterConfiguration(node));
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
for (const configuration of configurations) {
|
|
433
|
+
deregisterConfiguration(configuration);
|
|
434
|
+
const index = this.configurationContributors.indexOf(configuration);
|
|
435
|
+
if (index !== -1) {
|
|
436
|
+
this.configurationContributors.splice(index, 1);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return properties;
|
|
440
|
+
}
|
|
441
|
+
validateAndRegisterProperties(configuration, validate = true, extensionInfo, restrictedProperties, scope = 3 ) {
|
|
442
|
+
scope = isUndefinedOrNull(configuration.scope) ? scope : configuration.scope;
|
|
443
|
+
let propertyKeys = [];
|
|
444
|
+
let properties = configuration.properties;
|
|
445
|
+
if (properties) {
|
|
446
|
+
for (let key in properties) {
|
|
447
|
+
if (validate && validateProperty(key)) {
|
|
448
|
+
delete properties[key];
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
const property = properties[key];
|
|
452
|
+
property.source = extensionInfo;
|
|
453
|
+
property.defaultDefaultValue = properties[key].default;
|
|
454
|
+
this.updatePropertyDefaultValue(key, property);
|
|
455
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
456
|
+
property.scope = undefined;
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
property.scope = isUndefinedOrNull(property.scope) ? scope : property.scope;
|
|
460
|
+
property.restricted = isUndefinedOrNull(property.restricted) ? !!restrictedProperties?.includes(key) : property.restricted;
|
|
461
|
+
}
|
|
462
|
+
if (properties[key].hasOwnProperty('included') && !properties[key].included) {
|
|
463
|
+
this.excludedConfigurationProperties[key] = properties[key];
|
|
464
|
+
delete properties[key];
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
this.configurationProperties[key] = properties[key];
|
|
469
|
+
}
|
|
470
|
+
if (!properties[key].deprecationMessage && properties[key].markdownDeprecationMessage) {
|
|
471
|
+
properties[key].deprecationMessage = properties[key].markdownDeprecationMessage;
|
|
472
|
+
}
|
|
473
|
+
propertyKeys.push(key);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
let subNodes = configuration.allOf;
|
|
477
|
+
if (subNodes) {
|
|
478
|
+
for (let node of subNodes) {
|
|
479
|
+
propertyKeys.push(...this.validateAndRegisterProperties(node, validate, extensionInfo, restrictedProperties, scope));
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return propertyKeys;
|
|
483
|
+
}
|
|
484
|
+
getConfigurations() {
|
|
485
|
+
return this.configurationContributors;
|
|
486
|
+
}
|
|
487
|
+
getConfigurationProperties() {
|
|
488
|
+
return this.configurationProperties;
|
|
489
|
+
}
|
|
490
|
+
getExcludedConfigurationProperties() {
|
|
491
|
+
return this.excludedConfigurationProperties;
|
|
492
|
+
}
|
|
493
|
+
getConfigurationDefaultsOverrides() {
|
|
494
|
+
return this.configurationDefaultsOverrides;
|
|
495
|
+
}
|
|
496
|
+
registerJSONConfiguration(configuration) {
|
|
497
|
+
}
|
|
498
|
+
updateSchema(key, property) {
|
|
499
|
+
switch (property.scope) {
|
|
500
|
+
case 1 :
|
|
501
|
+
break;
|
|
502
|
+
case 2 :
|
|
503
|
+
break;
|
|
504
|
+
case 6 :
|
|
505
|
+
break;
|
|
506
|
+
case 3 :
|
|
507
|
+
break;
|
|
508
|
+
case 4 :
|
|
509
|
+
break;
|
|
510
|
+
case 5 :
|
|
511
|
+
this.resourceLanguageSettingsSchema.properties[key] = property;
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
removeFromSchema(key, property) {
|
|
516
|
+
switch (property.scope) {
|
|
517
|
+
case 1 :
|
|
518
|
+
break;
|
|
519
|
+
case 2 :
|
|
520
|
+
break;
|
|
521
|
+
case 6 :
|
|
522
|
+
break;
|
|
523
|
+
case 3 :
|
|
524
|
+
break;
|
|
525
|
+
case 4 :
|
|
526
|
+
case 5 :
|
|
527
|
+
delete this.resourceLanguageSettingsSchema.properties[key];
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
updateOverridePropertyPatternKey() {
|
|
532
|
+
for (const overrideIdentifier of this.overrideIdentifiers.values()) {
|
|
533
|
+
const overrideIdentifierProperty = `[${overrideIdentifier}]`;
|
|
534
|
+
const resourceLanguagePropertiesSchema = {
|
|
535
|
+
type: 'object',
|
|
536
|
+
description: localize(
|
|
537
|
+
'overrideSettings.defaultDescription',
|
|
538
|
+
"Configure editor settings to be overridden for a language."
|
|
539
|
+
),
|
|
540
|
+
errorMessage: localize(
|
|
541
|
+
'overrideSettings.errorMessage',
|
|
542
|
+
"This setting does not support per-language configuration."
|
|
543
|
+
),
|
|
544
|
+
$ref: resourceLanguageSettingsSchemaId,
|
|
545
|
+
};
|
|
546
|
+
this.updatePropertyDefaultValue(overrideIdentifierProperty, resourceLanguagePropertiesSchema);
|
|
547
|
+
}
|
|
548
|
+
this._onDidSchemaChange.fire();
|
|
549
|
+
}
|
|
550
|
+
registerOverridePropertyPatternKey() {
|
|
551
|
+
this._onDidSchemaChange.fire();
|
|
552
|
+
}
|
|
553
|
+
updatePropertyDefaultValue(key, property) {
|
|
554
|
+
const configurationdefaultOverride = this.configurationDefaultsOverrides.get(key);
|
|
555
|
+
let defaultValue = configurationdefaultOverride?.value;
|
|
556
|
+
let defaultSource = configurationdefaultOverride?.source;
|
|
557
|
+
if (isUndefined(defaultValue)) {
|
|
558
|
+
defaultValue = property.defaultDefaultValue;
|
|
559
|
+
defaultSource = undefined;
|
|
560
|
+
}
|
|
561
|
+
if (isUndefined(defaultValue)) {
|
|
562
|
+
defaultValue = getDefaultValue(property.type);
|
|
563
|
+
}
|
|
564
|
+
property.default = defaultValue;
|
|
565
|
+
property.defaultValueSource = defaultSource;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
const OVERRIDE_IDENTIFIER_PATTERN = `\\[([^\\]]+)\\]`;
|
|
569
|
+
const OVERRIDE_IDENTIFIER_REGEX = new RegExp(OVERRIDE_IDENTIFIER_PATTERN, 'g');
|
|
570
|
+
const OVERRIDE_PROPERTY_PATTERN = `^(${OVERRIDE_IDENTIFIER_PATTERN})+$`;
|
|
571
|
+
const OVERRIDE_PROPERTY_REGEX = new RegExp(OVERRIDE_PROPERTY_PATTERN);
|
|
572
|
+
function overrideIdentifiersFromKey(key) {
|
|
573
|
+
const identifiers = [];
|
|
574
|
+
if (OVERRIDE_PROPERTY_REGEX.test(key)) {
|
|
575
|
+
let matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);
|
|
576
|
+
while (matches?.length) {
|
|
577
|
+
const identifier = matches[1].trim();
|
|
578
|
+
if (identifier) {
|
|
579
|
+
identifiers.push(identifier);
|
|
580
|
+
}
|
|
581
|
+
matches = OVERRIDE_IDENTIFIER_REGEX.exec(key);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return distinct(identifiers);
|
|
585
|
+
}
|
|
586
|
+
function getDefaultValue(type) {
|
|
587
|
+
const t = Array.isArray(type) ? type[0] : type;
|
|
588
|
+
switch (t) {
|
|
589
|
+
case 'boolean':
|
|
590
|
+
return false;
|
|
591
|
+
case 'integer':
|
|
592
|
+
case 'number':
|
|
593
|
+
return 0;
|
|
594
|
+
case 'string':
|
|
595
|
+
return '';
|
|
596
|
+
case 'array':
|
|
597
|
+
return [];
|
|
598
|
+
case 'object':
|
|
599
|
+
return {};
|
|
600
|
+
default:
|
|
601
|
+
return null;
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
const configurationRegistry = new ConfigurationRegistry();
|
|
605
|
+
function validateProperty(property) {
|
|
606
|
+
if (!property.trim()) {
|
|
607
|
+
return (
|
|
608
|
+
localize('config.property.empty', "Cannot register an empty property")
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
if (OVERRIDE_PROPERTY_REGEX.test(property)) {
|
|
612
|
+
return (
|
|
613
|
+
localize(
|
|
614
|
+
'config.property.languageDefault',
|
|
615
|
+
"Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.",
|
|
616
|
+
property
|
|
617
|
+
)
|
|
618
|
+
);
|
|
619
|
+
}
|
|
620
|
+
if (configurationRegistry.getConfigurationProperties()[property] !== undefined) {
|
|
621
|
+
return (
|
|
622
|
+
localize(
|
|
623
|
+
'config.property.duplicate',
|
|
624
|
+
"Cannot register '{0}'. This property is already registered.",
|
|
625
|
+
property
|
|
626
|
+
)
|
|
627
|
+
);
|
|
628
|
+
}
|
|
629
|
+
return null;
|
|
630
|
+
}
|
|
631
|
+
function getScopes() {
|
|
632
|
+
const scopes = [];
|
|
633
|
+
const configurationProperties = configurationRegistry.getConfigurationProperties();
|
|
634
|
+
for (const key of Object.keys(configurationProperties)) {
|
|
635
|
+
scopes.push([key, configurationProperties[key].scope]);
|
|
636
|
+
}
|
|
637
|
+
scopes.push(['launch', 4 ]);
|
|
638
|
+
scopes.push(['task', 4 ]);
|
|
639
|
+
return scopes;
|
|
640
|
+
}
|
|
277
641
|
const _simplePattern = /^(.+)\/(.+?)(;.+)?$/;
|
|
278
642
|
function normalizeMimeType(mimeType, strict) {
|
|
279
643
|
const match = _simplePattern.exec(mimeType);
|
|
@@ -324,7 +688,7 @@ _Disposable_callOnDispose = new WeakMap();
|
|
|
324
688
|
Disposable$1 = Disposable_1 = __decorate([
|
|
325
689
|
es5ClassCompat
|
|
326
690
|
], Disposable$1);
|
|
327
|
-
let Position$
|
|
691
|
+
let Position$2 = Position_1 = class Position {
|
|
328
692
|
constructor(line, character) {
|
|
329
693
|
if (line < 0) {
|
|
330
694
|
throw illegalArgument('line must be non-negative');
|
|
@@ -485,20 +849,20 @@ let Position$3 = Position_1 = class Position {
|
|
|
485
849
|
return { line: this.line, character: this.character };
|
|
486
850
|
}
|
|
487
851
|
};
|
|
488
|
-
Position$
|
|
852
|
+
Position$2 = Position_1 = __decorate([
|
|
489
853
|
es5ClassCompat
|
|
490
|
-
], Position$
|
|
854
|
+
], Position$2);
|
|
491
855
|
let Range$2 = Range_1 = class Range {
|
|
492
856
|
constructor(startLineOrStart, startColumnOrEnd, endLine, endColumn) {
|
|
493
857
|
let start;
|
|
494
858
|
let end;
|
|
495
859
|
if (typeof startLineOrStart === 'number' && typeof startColumnOrEnd === 'number' && typeof endLine === 'number' && typeof endColumn === 'number') {
|
|
496
|
-
start = new Position$
|
|
497
|
-
end = new Position$
|
|
860
|
+
start = new Position$2(startLineOrStart, startColumnOrEnd);
|
|
861
|
+
end = new Position$2(endLine, endColumn);
|
|
498
862
|
}
|
|
499
|
-
else if (Position$
|
|
500
|
-
start = Position$
|
|
501
|
-
end = Position$
|
|
863
|
+
else if (Position$2.isPosition(startLineOrStart) && Position$2.isPosition(startColumnOrEnd)) {
|
|
864
|
+
start = Position$2.of(startLineOrStart);
|
|
865
|
+
end = Position$2.of(startColumnOrEnd);
|
|
502
866
|
}
|
|
503
867
|
if (!start || !end) {
|
|
504
868
|
throw new Error('Invalid arguments');
|
|
@@ -519,8 +883,8 @@ let Range$2 = Range_1 = class Range {
|
|
|
519
883
|
if (!thing) {
|
|
520
884
|
return false;
|
|
521
885
|
}
|
|
522
|
-
return Position$
|
|
523
|
-
&& Position$
|
|
886
|
+
return Position$2.isPosition(thing.start)
|
|
887
|
+
&& Position$2.isPosition(thing.end);
|
|
524
888
|
}
|
|
525
889
|
static of(obj) {
|
|
526
890
|
if (obj instanceof Range_1) {
|
|
@@ -544,8 +908,8 @@ let Range$2 = Range_1 = class Range {
|
|
|
544
908
|
return this.contains(positionOrRange.start)
|
|
545
909
|
&& this.contains(positionOrRange.end);
|
|
546
910
|
}
|
|
547
|
-
else if (Position$
|
|
548
|
-
if (Position$
|
|
911
|
+
else if (Position$2.isPosition(positionOrRange)) {
|
|
912
|
+
if (Position$2.of(positionOrRange).isBefore(this._start)) {
|
|
549
913
|
return false;
|
|
550
914
|
}
|
|
551
915
|
if (this._end.isBefore(positionOrRange)) {
|
|
@@ -559,8 +923,8 @@ let Range$2 = Range_1 = class Range {
|
|
|
559
923
|
return this._start.isEqual(other._start) && this._end.isEqual(other._end);
|
|
560
924
|
}
|
|
561
925
|
intersection(other) {
|
|
562
|
-
const start = Position$
|
|
563
|
-
const end = Position$
|
|
926
|
+
const start = Position$2.Max(other.start, this._start);
|
|
927
|
+
const end = Position$2.Min(other.end, this._end);
|
|
564
928
|
if (start.isAfter(end)) {
|
|
565
929
|
return undefined;
|
|
566
930
|
}
|
|
@@ -575,8 +939,8 @@ let Range$2 = Range_1 = class Range {
|
|
|
575
939
|
else if (other.contains(this)) {
|
|
576
940
|
return other;
|
|
577
941
|
}
|
|
578
|
-
const start = Position$
|
|
579
|
-
const end = Position$
|
|
942
|
+
const start = Position$2.Min(other.start, this._start);
|
|
943
|
+
const end = Position$2.Max(other.end, this.end);
|
|
580
944
|
return (
|
|
581
945
|
new Range_1(start, end)
|
|
582
946
|
);
|
|
@@ -595,7 +959,7 @@ let Range$2 = Range_1 = class Range {
|
|
|
595
959
|
if (!startOrChange) {
|
|
596
960
|
start = this.start;
|
|
597
961
|
}
|
|
598
|
-
else if (Position$
|
|
962
|
+
else if (Position$2.isPosition(startOrChange)) {
|
|
599
963
|
start = startOrChange;
|
|
600
964
|
}
|
|
601
965
|
else {
|
|
@@ -621,12 +985,12 @@ let Selection$3 = Selection_1 = class Selection extends Range$2 {
|
|
|
621
985
|
let anchor;
|
|
622
986
|
let active;
|
|
623
987
|
if (typeof anchorLineOrAnchor === 'number' && typeof anchorColumnOrActive === 'number' && typeof activeLine === 'number' && typeof activeColumn === 'number') {
|
|
624
|
-
anchor = new Position$
|
|
625
|
-
active = new Position$
|
|
988
|
+
anchor = new Position$2(anchorLineOrAnchor, anchorColumnOrActive);
|
|
989
|
+
active = new Position$2(activeLine, activeColumn);
|
|
626
990
|
}
|
|
627
|
-
else if (Position$
|
|
628
|
-
anchor = Position$
|
|
629
|
-
active = Position$
|
|
991
|
+
else if (Position$2.isPosition(anchorLineOrAnchor) && Position$2.isPosition(anchorColumnOrActive)) {
|
|
992
|
+
anchor = Position$2.of(anchorLineOrAnchor);
|
|
993
|
+
active = Position$2.of(anchorColumnOrActive);
|
|
630
994
|
}
|
|
631
995
|
if (!anchor || !active) {
|
|
632
996
|
throw new Error('Invalid arguments');
|
|
@@ -643,8 +1007,8 @@ let Selection$3 = Selection_1 = class Selection extends Range$2 {
|
|
|
643
1007
|
return false;
|
|
644
1008
|
}
|
|
645
1009
|
return Range$2.isRange(thing)
|
|
646
|
-
&& Position$
|
|
647
|
-
&& Position$
|
|
1010
|
+
&& Position$2.isPosition(thing.anchor)
|
|
1011
|
+
&& Position$2.isPosition(thing.active)
|
|
648
1012
|
&& typeof thing.isReversed === 'boolean';
|
|
649
1013
|
}
|
|
650
1014
|
get anchor() {
|
|
@@ -706,7 +1070,7 @@ let TextEdit$2 = TextEdit_1 = class TextEdit {
|
|
|
706
1070
|
return TextEdit_1.replace(range, '');
|
|
707
1071
|
}
|
|
708
1072
|
static setEndOfLine(eol) {
|
|
709
|
-
const ret = new TextEdit_1( new Range$2( new Position$
|
|
1073
|
+
const ret = new TextEdit_1( new Range$2( new Position$2(0, 0), new Position$2(0, 0)), '');
|
|
710
1074
|
ret.newEol = eol;
|
|
711
1075
|
return ret;
|
|
712
1076
|
}
|
|
@@ -953,7 +1317,7 @@ let Location$1 = Location_1 = class Location {
|
|
|
953
1317
|
else if (Range$2.isRange(rangeOrPosition)) {
|
|
954
1318
|
this.range = Range$2.of(rangeOrPosition);
|
|
955
1319
|
}
|
|
956
|
-
else if (Position$
|
|
1320
|
+
else if (Position$2.isPosition(rangeOrPosition)) {
|
|
957
1321
|
this.range = new Range$2(rangeOrPosition, rangeOrPosition);
|
|
958
1322
|
}
|
|
959
1323
|
else {
|
|
@@ -2895,8 +3259,8 @@ var Selection$2;
|
|
|
2895
3259
|
(function(Selection) {
|
|
2896
3260
|
function to(selection) {
|
|
2897
3261
|
const { selectionStartLineNumber, selectionStartColumn, positionLineNumber, positionColumn } = selection;
|
|
2898
|
-
const start = new Position$
|
|
2899
|
-
const end = new Position$
|
|
3262
|
+
const start = new Position$2(selectionStartLineNumber - 1, selectionStartColumn - 1);
|
|
3263
|
+
const end = new Position$2(positionLineNumber - 1, positionColumn - 1);
|
|
2900
3264
|
return new Selection$3(start, end);
|
|
2901
3265
|
}
|
|
2902
3266
|
Selection.to = to;
|
|
@@ -2947,17 +3311,17 @@ var TokenType;
|
|
|
2947
3311
|
}
|
|
2948
3312
|
TokenType.to = to;
|
|
2949
3313
|
})(TokenType || (TokenType = {}));
|
|
2950
|
-
var Position$
|
|
3314
|
+
var Position$1;
|
|
2951
3315
|
(function(Position) {
|
|
2952
3316
|
function to(position) {
|
|
2953
|
-
return new Position$
|
|
3317
|
+
return new Position$2(position.lineNumber - 1, position.column - 1);
|
|
2954
3318
|
}
|
|
2955
3319
|
Position.to = to;
|
|
2956
3320
|
function from(position) {
|
|
2957
3321
|
return { lineNumber: position.line + 1, column: position.character + 1 };
|
|
2958
3322
|
}
|
|
2959
3323
|
Position.from = from;
|
|
2960
|
-
})(Position$
|
|
3324
|
+
})(Position$1 || (Position$1 = {}));
|
|
2961
3325
|
var DocumentSelector;
|
|
2962
3326
|
(function(DocumentSelector) {
|
|
2963
3327
|
function from(value, uriTransformer) {
|
|
@@ -4539,7 +4903,6 @@ class ConsoleMainLogger extends AbstractLogger {
|
|
|
4539
4903
|
flush() {
|
|
4540
4904
|
}
|
|
4541
4905
|
}
|
|
4542
|
-
const Position$1 = monaco.Position;
|
|
4543
4906
|
const IExtHostRpcService = createDecorator('IExtHostRpcService');
|
|
4544
4907
|
var _ExtHostCommands_proxy;
|
|
4545
4908
|
let ExtHostCommands = class ExtHostCommands {
|
|
@@ -4566,8 +4929,8 @@ let ExtHostCommands = class ExtHostCommands {
|
|
|
4566
4929
|
if (Range$3.isIRange(obj)) {
|
|
4567
4930
|
return Range$1.to(obj);
|
|
4568
4931
|
}
|
|
4569
|
-
if (Position$
|
|
4570
|
-
return Position$
|
|
4932
|
+
if (Position$3.isIPosition(obj)) {
|
|
4933
|
+
return Position$1.to(obj);
|
|
4571
4934
|
}
|
|
4572
4935
|
if (Range$3.isIRange(obj.range) && URI.isUri(obj.uri)) {
|
|
4573
4936
|
return location.to(obj);
|
|
@@ -4638,8 +5001,8 @@ let ExtHostCommands = class ExtHostCommands {
|
|
|
4638
5001
|
else {
|
|
4639
5002
|
let hasBuffers = false;
|
|
4640
5003
|
const toArgs = cloneAndChange(args, function (value) {
|
|
4641
|
-
if (value instanceof Position$
|
|
4642
|
-
return Position$
|
|
5004
|
+
if (value instanceof Position$2) {
|
|
5005
|
+
return Position$1.from(value);
|
|
4643
5006
|
}
|
|
4644
5007
|
else if (value instanceof Range$2) {
|
|
4645
5008
|
return Range$1.from(value);
|
|
@@ -7138,7 +7501,7 @@ class ExtHostDocumentData extends MirrorTextModel {
|
|
|
7138
7501
|
}
|
|
7139
7502
|
_lineAt(lineOrPosition) {
|
|
7140
7503
|
let line;
|
|
7141
|
-
if (lineOrPosition instanceof Position$
|
|
7504
|
+
if (lineOrPosition instanceof Position$2) {
|
|
7142
7505
|
line = lineOrPosition.line;
|
|
7143
7506
|
}
|
|
7144
7507
|
else if (typeof lineOrPosition === 'number') {
|
|
@@ -7163,7 +7526,7 @@ class ExtHostDocumentData extends MirrorTextModel {
|
|
|
7163
7526
|
const out = this._lineStarts.getIndexOf(offset);
|
|
7164
7527
|
const lineLength = this._lines[out.index].length;
|
|
7165
7528
|
return (
|
|
7166
|
-
new Position$
|
|
7529
|
+
new Position$2(out.index, Math.min(out.remainder, lineLength))
|
|
7167
7530
|
);
|
|
7168
7531
|
}
|
|
7169
7532
|
_validateRange(range) {
|
|
@@ -7180,7 +7543,7 @@ class ExtHostDocumentData extends MirrorTextModel {
|
|
|
7180
7543
|
);
|
|
7181
7544
|
}
|
|
7182
7545
|
_validatePosition(position) {
|
|
7183
|
-
if (!(position instanceof Position$
|
|
7546
|
+
if (!(position instanceof Position$2)) {
|
|
7184
7547
|
throw new Error('Invalid argument');
|
|
7185
7548
|
}
|
|
7186
7549
|
if (this._lines.length === 0) {
|
|
@@ -7213,7 +7576,7 @@ class ExtHostDocumentData extends MirrorTextModel {
|
|
|
7213
7576
|
return position;
|
|
7214
7577
|
}
|
|
7215
7578
|
return (
|
|
7216
|
-
new Position$
|
|
7579
|
+
new Position$2(line, character)
|
|
7217
7580
|
);
|
|
7218
7581
|
}
|
|
7219
7582
|
_getWordRangeAtPosition(_position, regexp) {
|
|
@@ -7935,6 +8298,442 @@ function createExtHostQuickOpen(mainContext, workspace, commands) {
|
|
|
7935
8298
|
new ExtHostQuickOpenImpl(workspace, commands)
|
|
7936
8299
|
);
|
|
7937
8300
|
}
|
|
8301
|
+
class Counter {
|
|
8302
|
+
constructor() {
|
|
8303
|
+
this._next = 0;
|
|
8304
|
+
}
|
|
8305
|
+
getNext() {
|
|
8306
|
+
return this._next++;
|
|
8307
|
+
}
|
|
8308
|
+
}
|
|
8309
|
+
const IExtHostInitDataService = createDecorator('IExtHostInitDataService');
|
|
8310
|
+
function resultIsMatch(result) {
|
|
8311
|
+
return !!result.preview;
|
|
8312
|
+
}
|
|
8313
|
+
function isFolderEqual(folderA, folderB, extHostFileSystemInfo) {
|
|
8314
|
+
return (
|
|
8315
|
+
new ExtUri$1(uri => ignorePathCasing(uri, extHostFileSystemInfo)).isEqual(folderA, folderB)
|
|
8316
|
+
);
|
|
8317
|
+
}
|
|
8318
|
+
function compareWorkspaceFolderByUri(a, b, extHostFileSystemInfo) {
|
|
8319
|
+
return isFolderEqual(a.uri, b.uri, extHostFileSystemInfo) ? 0 : compare(a.uri.toString(), b.uri.toString());
|
|
8320
|
+
}
|
|
8321
|
+
function compareWorkspaceFolderByUriAndNameAndIndex(a, b, extHostFileSystemInfo) {
|
|
8322
|
+
if (a.index !== b.index) {
|
|
8323
|
+
return a.index < b.index ? -1 : 1;
|
|
8324
|
+
}
|
|
8325
|
+
return isFolderEqual(a.uri, b.uri, extHostFileSystemInfo) ? compare(a.name, b.name) : compare(a.uri.toString(), b.uri.toString());
|
|
8326
|
+
}
|
|
8327
|
+
function delta(oldFolders, newFolders, compare, extHostFileSystemInfo) {
|
|
8328
|
+
const oldSortedFolders = oldFolders.slice(0).sort((a, b) => compare(a, b, extHostFileSystemInfo));
|
|
8329
|
+
const newSortedFolders = newFolders.slice(0).sort((a, b) => compare(a, b, extHostFileSystemInfo));
|
|
8330
|
+
return delta$1(oldSortedFolders, newSortedFolders, (a, b) => compare(a, b, extHostFileSystemInfo));
|
|
8331
|
+
}
|
|
8332
|
+
function ignorePathCasing(uri, extHostFileSystemInfo) {
|
|
8333
|
+
const capabilities = extHostFileSystemInfo.getCapabilities(uri.scheme);
|
|
8334
|
+
return !(capabilities && ((capabilities & 1024) ));
|
|
8335
|
+
}
|
|
8336
|
+
class ExtHostWorkspaceImpl extends Workspace {
|
|
8337
|
+
constructor(id, _name, folders, transient, configuration, _isUntitled, ignorePathCasing) {
|
|
8338
|
+
super(id, folders.map(f => new WorkspaceFolder(f)), transient, configuration, ignorePathCasing);
|
|
8339
|
+
this._name = _name;
|
|
8340
|
+
this._isUntitled = _isUntitled;
|
|
8341
|
+
this._workspaceFolders = [];
|
|
8342
|
+
this._structure = TernarySearchTree.forUris(ignorePathCasing);
|
|
8343
|
+
folders.forEach(folder => {
|
|
8344
|
+
this._workspaceFolders.push(folder);
|
|
8345
|
+
this._structure.set(folder.uri, folder);
|
|
8346
|
+
});
|
|
8347
|
+
}
|
|
8348
|
+
static toExtHostWorkspace(data, previousConfirmedWorkspace, previousUnconfirmedWorkspace, extHostFileSystemInfo) {
|
|
8349
|
+
if (!data) {
|
|
8350
|
+
return { workspace: null, added: [], removed: [] };
|
|
8351
|
+
}
|
|
8352
|
+
const { id, name, folders, configuration, transient, isUntitled } = data;
|
|
8353
|
+
const newWorkspaceFolders = [];
|
|
8354
|
+
const oldWorkspace = previousConfirmedWorkspace;
|
|
8355
|
+
if (previousConfirmedWorkspace) {
|
|
8356
|
+
folders.forEach((folderData, index) => {
|
|
8357
|
+
const folderUri = URI.revive(folderData.uri);
|
|
8358
|
+
const existingFolder = ExtHostWorkspaceImpl._findFolder(previousUnconfirmedWorkspace || previousConfirmedWorkspace, folderUri, extHostFileSystemInfo);
|
|
8359
|
+
if (existingFolder) {
|
|
8360
|
+
existingFolder.name = folderData.name;
|
|
8361
|
+
existingFolder.index = folderData.index;
|
|
8362
|
+
newWorkspaceFolders.push(existingFolder);
|
|
8363
|
+
}
|
|
8364
|
+
else {
|
|
8365
|
+
newWorkspaceFolders.push({ uri: folderUri, name: folderData.name, index });
|
|
8366
|
+
}
|
|
8367
|
+
});
|
|
8368
|
+
}
|
|
8369
|
+
else {
|
|
8370
|
+
newWorkspaceFolders.push(...folders.map(({ uri, name, index }) => ({ uri: URI.revive(uri), name, index })));
|
|
8371
|
+
}
|
|
8372
|
+
newWorkspaceFolders.sort((f1, f2) => f1.index < f2.index ? -1 : 1);
|
|
8373
|
+
const workspace = new ExtHostWorkspaceImpl(
|
|
8374
|
+
id,
|
|
8375
|
+
name,
|
|
8376
|
+
newWorkspaceFolders,
|
|
8377
|
+
!!transient,
|
|
8378
|
+
configuration ? URI.revive(configuration) : null,
|
|
8379
|
+
!!isUntitled,
|
|
8380
|
+
uri => ignorePathCasing(uri, extHostFileSystemInfo)
|
|
8381
|
+
);
|
|
8382
|
+
const { added, removed } = delta(oldWorkspace ? oldWorkspace.workspaceFolders : [], workspace.workspaceFolders, compareWorkspaceFolderByUri, extHostFileSystemInfo);
|
|
8383
|
+
return { workspace, added, removed };
|
|
8384
|
+
}
|
|
8385
|
+
static _findFolder(workspace, folderUriToFind, extHostFileSystemInfo) {
|
|
8386
|
+
for (let i = 0; i < workspace.folders.length; i++) {
|
|
8387
|
+
const folder = workspace.workspaceFolders[i];
|
|
8388
|
+
if (isFolderEqual(folder.uri, folderUriToFind, extHostFileSystemInfo)) {
|
|
8389
|
+
return folder;
|
|
8390
|
+
}
|
|
8391
|
+
}
|
|
8392
|
+
return undefined;
|
|
8393
|
+
}
|
|
8394
|
+
get name() {
|
|
8395
|
+
return this._name;
|
|
8396
|
+
}
|
|
8397
|
+
get isUntitled() {
|
|
8398
|
+
return this._isUntitled;
|
|
8399
|
+
}
|
|
8400
|
+
get workspaceFolders() {
|
|
8401
|
+
return this._workspaceFolders.slice(0);
|
|
8402
|
+
}
|
|
8403
|
+
getWorkspaceFolder(uri, resolveParent) {
|
|
8404
|
+
if (resolveParent && this._structure.get(uri)) {
|
|
8405
|
+
uri = dirname$1(uri);
|
|
8406
|
+
}
|
|
8407
|
+
return this._structure.findSubstr(uri);
|
|
8408
|
+
}
|
|
8409
|
+
resolveWorkspaceFolder(uri) {
|
|
8410
|
+
return this._structure.get(uri);
|
|
8411
|
+
}
|
|
8412
|
+
}
|
|
8413
|
+
let ExtHostWorkspace = class ExtHostWorkspace {
|
|
8414
|
+
constructor(extHostRpc, initData, extHostFileSystemInfo, logService) {
|
|
8415
|
+
this._onDidChangeWorkspace = new Emitter();
|
|
8416
|
+
this.onDidChangeWorkspace = this._onDidChangeWorkspace.event;
|
|
8417
|
+
this._onDidGrantWorkspaceTrust = new Emitter();
|
|
8418
|
+
this.onDidGrantWorkspaceTrust = this._onDidGrantWorkspaceTrust.event;
|
|
8419
|
+
this._activeSearchCallbacks = [];
|
|
8420
|
+
this._trusted = false;
|
|
8421
|
+
this._logService = logService;
|
|
8422
|
+
this._extHostFileSystemInfo = extHostFileSystemInfo;
|
|
8423
|
+
this._requestIdProvider = new Counter();
|
|
8424
|
+
this._barrier = new Barrier();
|
|
8425
|
+
this._proxy = extHostRpc.getProxy(MainContext.MainThreadWorkspace);
|
|
8426
|
+
this._messageService = extHostRpc.getProxy(MainContext.MainThreadMessageService);
|
|
8427
|
+
const data = initData.workspace;
|
|
8428
|
+
this._confirmedWorkspace = data ? new ExtHostWorkspaceImpl(
|
|
8429
|
+
data.id,
|
|
8430
|
+
data.name,
|
|
8431
|
+
[],
|
|
8432
|
+
!!data.transient,
|
|
8433
|
+
data.configuration ? URI.revive(data.configuration) : null,
|
|
8434
|
+
!!data.isUntitled,
|
|
8435
|
+
uri => ignorePathCasing(uri, extHostFileSystemInfo)
|
|
8436
|
+
) : undefined;
|
|
8437
|
+
}
|
|
8438
|
+
$initializeWorkspace(data, trusted) {
|
|
8439
|
+
this._trusted = trusted;
|
|
8440
|
+
this.$acceptWorkspaceData(data);
|
|
8441
|
+
this._barrier.open();
|
|
8442
|
+
}
|
|
8443
|
+
waitForInitializeCall() {
|
|
8444
|
+
return this._barrier.wait();
|
|
8445
|
+
}
|
|
8446
|
+
get workspace() {
|
|
8447
|
+
return this._actualWorkspace;
|
|
8448
|
+
}
|
|
8449
|
+
get name() {
|
|
8450
|
+
return this._actualWorkspace ? this._actualWorkspace.name : undefined;
|
|
8451
|
+
}
|
|
8452
|
+
get workspaceFile() {
|
|
8453
|
+
if (this._actualWorkspace) {
|
|
8454
|
+
if (this._actualWorkspace.configuration) {
|
|
8455
|
+
if (this._actualWorkspace.isUntitled) {
|
|
8456
|
+
return URI.from({ scheme: Schemas.untitled, path: basename$1(dirname$1(this._actualWorkspace.configuration)) });
|
|
8457
|
+
}
|
|
8458
|
+
return this._actualWorkspace.configuration;
|
|
8459
|
+
}
|
|
8460
|
+
}
|
|
8461
|
+
return undefined;
|
|
8462
|
+
}
|
|
8463
|
+
get _actualWorkspace() {
|
|
8464
|
+
return this._unconfirmedWorkspace || this._confirmedWorkspace;
|
|
8465
|
+
}
|
|
8466
|
+
getWorkspaceFolders() {
|
|
8467
|
+
if (!this._actualWorkspace) {
|
|
8468
|
+
return undefined;
|
|
8469
|
+
}
|
|
8470
|
+
return this._actualWorkspace.workspaceFolders.slice(0);
|
|
8471
|
+
}
|
|
8472
|
+
async getWorkspaceFolders2() {
|
|
8473
|
+
await this._barrier.wait();
|
|
8474
|
+
if (!this._actualWorkspace) {
|
|
8475
|
+
return undefined;
|
|
8476
|
+
}
|
|
8477
|
+
return this._actualWorkspace.workspaceFolders.slice(0);
|
|
8478
|
+
}
|
|
8479
|
+
updateWorkspaceFolders(extension, index, deleteCount, ...workspaceFoldersToAdd) {
|
|
8480
|
+
const validatedDistinctWorkspaceFoldersToAdd = [];
|
|
8481
|
+
if (Array.isArray(workspaceFoldersToAdd)) {
|
|
8482
|
+
workspaceFoldersToAdd.forEach(folderToAdd => {
|
|
8483
|
+
if (URI.isUri(folderToAdd.uri) && !validatedDistinctWorkspaceFoldersToAdd.some(f => isFolderEqual(f.uri, folderToAdd.uri, this._extHostFileSystemInfo))) {
|
|
8484
|
+
validatedDistinctWorkspaceFoldersToAdd.push({ uri: folderToAdd.uri, name: folderToAdd.name || basenameOrAuthority(folderToAdd.uri) });
|
|
8485
|
+
}
|
|
8486
|
+
});
|
|
8487
|
+
}
|
|
8488
|
+
if (!!this._unconfirmedWorkspace) {
|
|
8489
|
+
return false;
|
|
8490
|
+
}
|
|
8491
|
+
if ([index, deleteCount].some(i => typeof i !== 'number' || i < 0)) {
|
|
8492
|
+
return false;
|
|
8493
|
+
}
|
|
8494
|
+
if (deleteCount === 0 && validatedDistinctWorkspaceFoldersToAdd.length === 0) {
|
|
8495
|
+
return false;
|
|
8496
|
+
}
|
|
8497
|
+
const currentWorkspaceFolders = this._actualWorkspace ? this._actualWorkspace.workspaceFolders : [];
|
|
8498
|
+
if (index + deleteCount > currentWorkspaceFolders.length) {
|
|
8499
|
+
return false;
|
|
8500
|
+
}
|
|
8501
|
+
const newWorkspaceFolders = currentWorkspaceFolders.slice(0);
|
|
8502
|
+
newWorkspaceFolders.splice(index, deleteCount, ...validatedDistinctWorkspaceFoldersToAdd.map(f => ({ uri: f.uri, name: f.name || basenameOrAuthority(f.uri), index: undefined })));
|
|
8503
|
+
for (let i = 0; i < newWorkspaceFolders.length; i++) {
|
|
8504
|
+
const folder = newWorkspaceFolders[i];
|
|
8505
|
+
if (newWorkspaceFolders.some((otherFolder, index) => index !== i && isFolderEqual(folder.uri, otherFolder.uri, this._extHostFileSystemInfo))) {
|
|
8506
|
+
return false;
|
|
8507
|
+
}
|
|
8508
|
+
}
|
|
8509
|
+
newWorkspaceFolders.forEach((f, index) => f.index = index);
|
|
8510
|
+
const { added, removed } = delta(currentWorkspaceFolders, newWorkspaceFolders, compareWorkspaceFolderByUriAndNameAndIndex, this._extHostFileSystemInfo);
|
|
8511
|
+
if (added.length === 0 && removed.length === 0) {
|
|
8512
|
+
return false;
|
|
8513
|
+
}
|
|
8514
|
+
if (this._proxy) {
|
|
8515
|
+
const extName = extension.displayName || extension.name;
|
|
8516
|
+
this._proxy.$updateWorkspaceFolders(extName, index, deleteCount, validatedDistinctWorkspaceFoldersToAdd).then(undefined, error => {
|
|
8517
|
+
this._unconfirmedWorkspace = undefined;
|
|
8518
|
+
const options = { source: { identifier: extension.identifier, label: extension.displayName || extension.name } };
|
|
8519
|
+
this._messageService.$showMessage(Severity$1.Error, localize(
|
|
8520
|
+
'updateerror',
|
|
8521
|
+
"Extension '{0}' failed to update workspace folders: {1}",
|
|
8522
|
+
extName,
|
|
8523
|
+
error.toString()
|
|
8524
|
+
), options, []);
|
|
8525
|
+
});
|
|
8526
|
+
}
|
|
8527
|
+
this.trySetWorkspaceFolders(newWorkspaceFolders);
|
|
8528
|
+
return true;
|
|
8529
|
+
}
|
|
8530
|
+
getWorkspaceFolder(uri, resolveParent) {
|
|
8531
|
+
if (!this._actualWorkspace) {
|
|
8532
|
+
return undefined;
|
|
8533
|
+
}
|
|
8534
|
+
return this._actualWorkspace.getWorkspaceFolder(uri, resolveParent);
|
|
8535
|
+
}
|
|
8536
|
+
async getWorkspaceFolder2(uri, resolveParent) {
|
|
8537
|
+
await this._barrier.wait();
|
|
8538
|
+
if (!this._actualWorkspace) {
|
|
8539
|
+
return undefined;
|
|
8540
|
+
}
|
|
8541
|
+
return this._actualWorkspace.getWorkspaceFolder(uri, resolveParent);
|
|
8542
|
+
}
|
|
8543
|
+
async resolveWorkspaceFolder(uri) {
|
|
8544
|
+
await this._barrier.wait();
|
|
8545
|
+
if (!this._actualWorkspace) {
|
|
8546
|
+
return undefined;
|
|
8547
|
+
}
|
|
8548
|
+
return this._actualWorkspace.resolveWorkspaceFolder(uri);
|
|
8549
|
+
}
|
|
8550
|
+
getPath() {
|
|
8551
|
+
if (!this._actualWorkspace) {
|
|
8552
|
+
return undefined;
|
|
8553
|
+
}
|
|
8554
|
+
const { folders } = this._actualWorkspace;
|
|
8555
|
+
if (folders.length === 0) {
|
|
8556
|
+
return undefined;
|
|
8557
|
+
}
|
|
8558
|
+
return folders[0].uri.fsPath;
|
|
8559
|
+
}
|
|
8560
|
+
getRelativePath(pathOrUri, includeWorkspace) {
|
|
8561
|
+
let resource;
|
|
8562
|
+
let path = '';
|
|
8563
|
+
if (typeof pathOrUri === 'string') {
|
|
8564
|
+
resource = URI.file(pathOrUri);
|
|
8565
|
+
path = pathOrUri;
|
|
8566
|
+
}
|
|
8567
|
+
else if (typeof pathOrUri !== 'undefined') {
|
|
8568
|
+
resource = pathOrUri;
|
|
8569
|
+
path = pathOrUri.fsPath;
|
|
8570
|
+
}
|
|
8571
|
+
if (!resource) {
|
|
8572
|
+
return path;
|
|
8573
|
+
}
|
|
8574
|
+
const folder = this.getWorkspaceFolder(resource, true);
|
|
8575
|
+
if (!folder) {
|
|
8576
|
+
return path;
|
|
8577
|
+
}
|
|
8578
|
+
if (typeof includeWorkspace === 'undefined' && this._actualWorkspace) {
|
|
8579
|
+
includeWorkspace = this._actualWorkspace.folders.length > 1;
|
|
8580
|
+
}
|
|
8581
|
+
let result = relativePath(folder.uri, resource);
|
|
8582
|
+
if (includeWorkspace && folder.name) {
|
|
8583
|
+
result = `${folder.name}/${result}`;
|
|
8584
|
+
}
|
|
8585
|
+
return result;
|
|
8586
|
+
}
|
|
8587
|
+
trySetWorkspaceFolders(folders) {
|
|
8588
|
+
if (this._actualWorkspace) {
|
|
8589
|
+
this._unconfirmedWorkspace = ExtHostWorkspaceImpl.toExtHostWorkspace({
|
|
8590
|
+
id: this._actualWorkspace.id,
|
|
8591
|
+
name: this._actualWorkspace.name,
|
|
8592
|
+
configuration: this._actualWorkspace.configuration,
|
|
8593
|
+
folders,
|
|
8594
|
+
isUntitled: this._actualWorkspace.isUntitled
|
|
8595
|
+
}, this._actualWorkspace, undefined, this._extHostFileSystemInfo).workspace || undefined;
|
|
8596
|
+
}
|
|
8597
|
+
}
|
|
8598
|
+
$acceptWorkspaceData(data) {
|
|
8599
|
+
const { workspace, added, removed } = ExtHostWorkspaceImpl.toExtHostWorkspace(data, this._confirmedWorkspace, this._unconfirmedWorkspace, this._extHostFileSystemInfo);
|
|
8600
|
+
this._confirmedWorkspace = workspace || undefined;
|
|
8601
|
+
this._unconfirmedWorkspace = undefined;
|
|
8602
|
+
this._onDidChangeWorkspace.fire( Object.freeze({
|
|
8603
|
+
added,
|
|
8604
|
+
removed,
|
|
8605
|
+
}));
|
|
8606
|
+
}
|
|
8607
|
+
findFiles(include, exclude, maxResults, extensionId, token = CancellationToken.None) {
|
|
8608
|
+
this._logService.trace(`extHostWorkspace#findFiles: fileSearch, extension: ${extensionId.value}, entryPoint: findFiles`);
|
|
8609
|
+
let excludePatternOrDisregardExcludes = undefined;
|
|
8610
|
+
if (exclude === null) {
|
|
8611
|
+
excludePatternOrDisregardExcludes = false;
|
|
8612
|
+
}
|
|
8613
|
+
else if (exclude) {
|
|
8614
|
+
if (typeof exclude === 'string') {
|
|
8615
|
+
excludePatternOrDisregardExcludes = exclude;
|
|
8616
|
+
}
|
|
8617
|
+
else {
|
|
8618
|
+
excludePatternOrDisregardExcludes = exclude.pattern;
|
|
8619
|
+
}
|
|
8620
|
+
}
|
|
8621
|
+
if (token && token.isCancellationRequested) {
|
|
8622
|
+
return Promise.resolve([]);
|
|
8623
|
+
}
|
|
8624
|
+
const { includePattern, folder } = parseSearchInclude(GlobPattern.from(include));
|
|
8625
|
+
return this._proxy.$startFileSearch(withUndefinedAsNull(includePattern), withUndefinedAsNull(folder), withUndefinedAsNull(excludePatternOrDisregardExcludes), withUndefinedAsNull(maxResults), token)
|
|
8626
|
+
.then(data => Array.isArray(data) ? data.map(d => URI.revive(d)) : []);
|
|
8627
|
+
}
|
|
8628
|
+
async findTextInFiles(query, options, callback, extensionId, token = CancellationToken.None) {
|
|
8629
|
+
this._logService.trace(`extHostWorkspace#findTextInFiles: textSearch, extension: ${extensionId.value}, entryPoint: findTextInFiles`);
|
|
8630
|
+
const requestId = this._requestIdProvider.getNext();
|
|
8631
|
+
const previewOptions = typeof options.previewOptions === 'undefined' ?
|
|
8632
|
+
{
|
|
8633
|
+
matchLines: 100,
|
|
8634
|
+
charsPerLine: 10000
|
|
8635
|
+
} :
|
|
8636
|
+
options.previewOptions;
|
|
8637
|
+
const { includePattern, folder } = parseSearchInclude(GlobPattern.from(options.include));
|
|
8638
|
+
const excludePattern = (typeof options.exclude === 'string') ? options.exclude :
|
|
8639
|
+
options.exclude ? options.exclude.pattern : undefined;
|
|
8640
|
+
const queryOptions = {
|
|
8641
|
+
ignoreSymlinks: typeof options.followSymlinks === 'boolean' ? !options.followSymlinks : undefined,
|
|
8642
|
+
disregardIgnoreFiles: typeof options.useIgnoreFiles === 'boolean' ? !options.useIgnoreFiles : undefined,
|
|
8643
|
+
disregardGlobalIgnoreFiles: typeof options.useGlobalIgnoreFiles === 'boolean' ? !options.useGlobalIgnoreFiles : undefined,
|
|
8644
|
+
disregardParentIgnoreFiles: typeof options.useParentIgnoreFiles === 'boolean' ? !options.useParentIgnoreFiles : undefined,
|
|
8645
|
+
disregardExcludeSettings: typeof options.useDefaultExcludes === 'boolean' ? !options.useDefaultExcludes : true,
|
|
8646
|
+
fileEncoding: options.encoding,
|
|
8647
|
+
maxResults: options.maxResults,
|
|
8648
|
+
previewOptions,
|
|
8649
|
+
afterContext: options.afterContext,
|
|
8650
|
+
beforeContext: options.beforeContext,
|
|
8651
|
+
includePattern: includePattern,
|
|
8652
|
+
excludePattern: excludePattern
|
|
8653
|
+
};
|
|
8654
|
+
this._activeSearchCallbacks[requestId] = p => {
|
|
8655
|
+
const uri = URI.revive(p.resource);
|
|
8656
|
+
p.results.forEach(result => {
|
|
8657
|
+
if (resultIsMatch(result)) {
|
|
8658
|
+
callback({
|
|
8659
|
+
uri,
|
|
8660
|
+
preview: {
|
|
8661
|
+
text: result.preview.text,
|
|
8662
|
+
matches: mapArrayOrNot(result.preview.matches, m => new Range$2(m.startLineNumber, m.startColumn, m.endLineNumber, m.endColumn))
|
|
8663
|
+
},
|
|
8664
|
+
ranges: mapArrayOrNot(result.ranges, r => new Range$2(r.startLineNumber, r.startColumn, r.endLineNumber, r.endColumn))
|
|
8665
|
+
});
|
|
8666
|
+
}
|
|
8667
|
+
else {
|
|
8668
|
+
callback({
|
|
8669
|
+
uri,
|
|
8670
|
+
text: result.text,
|
|
8671
|
+
lineNumber: result.lineNumber
|
|
8672
|
+
});
|
|
8673
|
+
}
|
|
8674
|
+
});
|
|
8675
|
+
};
|
|
8676
|
+
if (token.isCancellationRequested) {
|
|
8677
|
+
return {};
|
|
8678
|
+
}
|
|
8679
|
+
try {
|
|
8680
|
+
const result = await this._proxy.$startTextSearch(query, withUndefinedAsNull(folder), queryOptions, requestId, token);
|
|
8681
|
+
delete this._activeSearchCallbacks[requestId];
|
|
8682
|
+
return result || {};
|
|
8683
|
+
}
|
|
8684
|
+
catch (err) {
|
|
8685
|
+
delete this._activeSearchCallbacks[requestId];
|
|
8686
|
+
throw err;
|
|
8687
|
+
}
|
|
8688
|
+
}
|
|
8689
|
+
$handleTextSearchResult(result, requestId) {
|
|
8690
|
+
if (this._activeSearchCallbacks[requestId]) {
|
|
8691
|
+
this._activeSearchCallbacks[requestId](result);
|
|
8692
|
+
}
|
|
8693
|
+
}
|
|
8694
|
+
saveAll(includeUntitled) {
|
|
8695
|
+
return this._proxy.$saveAll(includeUntitled);
|
|
8696
|
+
}
|
|
8697
|
+
resolveProxy(url) {
|
|
8698
|
+
return this._proxy.$resolveProxy(url);
|
|
8699
|
+
}
|
|
8700
|
+
get trusted() {
|
|
8701
|
+
return this._trusted;
|
|
8702
|
+
}
|
|
8703
|
+
requestWorkspaceTrust(options) {
|
|
8704
|
+
return this._proxy.$requestWorkspaceTrust(options);
|
|
8705
|
+
}
|
|
8706
|
+
$onDidGrantWorkspaceTrust() {
|
|
8707
|
+
if (!this._trusted) {
|
|
8708
|
+
this._trusted = true;
|
|
8709
|
+
this._onDidGrantWorkspaceTrust.fire();
|
|
8710
|
+
}
|
|
8711
|
+
}
|
|
8712
|
+
};
|
|
8713
|
+
ExtHostWorkspace = __decorate([
|
|
8714
|
+
__param(0, IExtHostRpcService),
|
|
8715
|
+
__param(1, IExtHostInitDataService),
|
|
8716
|
+
__param(2, IExtHostFileSystemInfo),
|
|
8717
|
+
__param(3, ILogService)
|
|
8718
|
+
], ExtHostWorkspace);
|
|
8719
|
+
const IExtHostWorkspace = createDecorator('IExtHostWorkspace');
|
|
8720
|
+
function parseSearchInclude(include) {
|
|
8721
|
+
let includePattern;
|
|
8722
|
+
let includeFolder;
|
|
8723
|
+
if (include) {
|
|
8724
|
+
if (typeof include === 'string') {
|
|
8725
|
+
includePattern = include;
|
|
8726
|
+
}
|
|
8727
|
+
else {
|
|
8728
|
+
includePattern = include.pattern;
|
|
8729
|
+
includeFolder = URI.revive(include.baseUri);
|
|
8730
|
+
}
|
|
8731
|
+
}
|
|
8732
|
+
return {
|
|
8733
|
+
includePattern,
|
|
8734
|
+
folder: includeFolder
|
|
8735
|
+
};
|
|
8736
|
+
}
|
|
7938
8737
|
function reviveIconPathUris(iconPath) {
|
|
7939
8738
|
iconPath.dark = URI.revive(iconPath.dark);
|
|
7940
8739
|
if (iconPath.light) {
|
|
@@ -8541,7 +9340,7 @@ class TextEditorEdit {
|
|
|
8541
9340
|
replace(location, value) {
|
|
8542
9341
|
this._throwIfFinalized();
|
|
8543
9342
|
let range = null;
|
|
8544
|
-
if (location instanceof Position$
|
|
9343
|
+
if (location instanceof Position$2) {
|
|
8545
9344
|
range = new Range$2(location, location);
|
|
8546
9345
|
}
|
|
8547
9346
|
else if (location instanceof Range$2) {
|
|
@@ -8818,8 +9617,8 @@ class ExtHostTextEditor {
|
|
|
8818
9617
|
if (!where || (Array.isArray(where) && where.length === 0)) {
|
|
8819
9618
|
ranges = that._selections.map(range => Range$1.from(range));
|
|
8820
9619
|
}
|
|
8821
|
-
else if (where instanceof Position$
|
|
8822
|
-
const { lineNumber, column } = Position$
|
|
9620
|
+
else if (where instanceof Position$2) {
|
|
9621
|
+
const { lineNumber, column } = Position$1.from(where);
|
|
8823
9622
|
ranges = [{ startLineNumber: lineNumber, startColumn: column, endLineNumber: lineNumber, endColumn: column }];
|
|
8824
9623
|
}
|
|
8825
9624
|
else if (where instanceof Range$2) {
|
|
@@ -8832,7 +9631,7 @@ class ExtHostTextEditor {
|
|
|
8832
9631
|
ranges.push(Range$1.from(posOrRange));
|
|
8833
9632
|
}
|
|
8834
9633
|
else {
|
|
8835
|
-
const { lineNumber, column } = Position$
|
|
9634
|
+
const { lineNumber, column } = Position$1.from(posOrRange);
|
|
8836
9635
|
ranges.push({ startLineNumber: lineNumber, startColumn: column, endLineNumber: lineNumber, endColumn: column });
|
|
8837
9636
|
}
|
|
8838
9637
|
}
|
|
@@ -10807,7 +11606,7 @@ class ExtHostLanguages {
|
|
|
10807
11606
|
}
|
|
10808
11607
|
async tokenAtPosition(document, position) {
|
|
10809
11608
|
const versionNow = document.version;
|
|
10810
|
-
const pos = Position$
|
|
11609
|
+
const pos = Position$1.from(position);
|
|
10811
11610
|
const info = await this._proxy.$tokensAtPosition(document.uri, pos);
|
|
10812
11611
|
const defaultRange = {
|
|
10813
11612
|
type: StandardTokenType.Other,
|
|
@@ -11403,7 +12202,7 @@ class DefinitionAdapter {
|
|
|
11403
12202
|
}
|
|
11404
12203
|
async provideDefinition(resource, position, token) {
|
|
11405
12204
|
const doc = this._documents.getDocument(resource);
|
|
11406
|
-
const pos = Position$
|
|
12205
|
+
const pos = Position$1.to(position);
|
|
11407
12206
|
const value = await this._provider.provideDefinition(doc, pos, token);
|
|
11408
12207
|
return convertToLocationLinks(value);
|
|
11409
12208
|
}
|
|
@@ -11415,7 +12214,7 @@ class DeclarationAdapter {
|
|
|
11415
12214
|
}
|
|
11416
12215
|
async provideDeclaration(resource, position, token) {
|
|
11417
12216
|
const doc = this._documents.getDocument(resource);
|
|
11418
|
-
const pos = Position$
|
|
12217
|
+
const pos = Position$1.to(position);
|
|
11419
12218
|
const value = await this._provider.provideDeclaration(doc, pos, token);
|
|
11420
12219
|
return convertToLocationLinks(value);
|
|
11421
12220
|
}
|
|
@@ -11427,7 +12226,7 @@ class ImplementationAdapter {
|
|
|
11427
12226
|
}
|
|
11428
12227
|
async provideImplementation(resource, position, token) {
|
|
11429
12228
|
const doc = this._documents.getDocument(resource);
|
|
11430
|
-
const pos = Position$
|
|
12229
|
+
const pos = Position$1.to(position);
|
|
11431
12230
|
const value = await this._provider.provideImplementation(doc, pos, token);
|
|
11432
12231
|
return convertToLocationLinks(value);
|
|
11433
12232
|
}
|
|
@@ -11439,7 +12238,7 @@ class TypeDefinitionAdapter {
|
|
|
11439
12238
|
}
|
|
11440
12239
|
async provideTypeDefinition(resource, position, token) {
|
|
11441
12240
|
const doc = this._documents.getDocument(resource);
|
|
11442
|
-
const pos = Position$
|
|
12241
|
+
const pos = Position$1.to(position);
|
|
11443
12242
|
const value = await this._provider.provideTypeDefinition(doc, pos, token);
|
|
11444
12243
|
return convertToLocationLinks(value);
|
|
11445
12244
|
}
|
|
@@ -11451,7 +12250,7 @@ class HoverAdapter {
|
|
|
11451
12250
|
}
|
|
11452
12251
|
async provideHover(resource, position, token) {
|
|
11453
12252
|
const doc = this._documents.getDocument(resource);
|
|
11454
|
-
const pos = Position$
|
|
12253
|
+
const pos = Position$1.to(position);
|
|
11455
12254
|
const value = await this._provider.provideHover(doc, pos, token);
|
|
11456
12255
|
if (!value || isFalsyOrEmpty(value.contents)) {
|
|
11457
12256
|
return undefined;
|
|
@@ -11472,7 +12271,7 @@ class EvaluatableExpressionAdapter {
|
|
|
11472
12271
|
}
|
|
11473
12272
|
async provideEvaluatableExpression(resource, position, token) {
|
|
11474
12273
|
const doc = this._documents.getDocument(resource);
|
|
11475
|
-
const pos = Position$
|
|
12274
|
+
const pos = Position$1.to(position);
|
|
11476
12275
|
const value = await this._provider.provideEvaluatableExpression(doc, pos, token);
|
|
11477
12276
|
if (value) {
|
|
11478
12277
|
return EvaluatableExpression$1.from(value);
|
|
@@ -11501,7 +12300,7 @@ class DocumentHighlightAdapter {
|
|
|
11501
12300
|
}
|
|
11502
12301
|
async provideDocumentHighlights(resource, position, token) {
|
|
11503
12302
|
const doc = this._documents.getDocument(resource);
|
|
11504
|
-
const pos = Position$
|
|
12303
|
+
const pos = Position$1.to(position);
|
|
11505
12304
|
const value = await this._provider.provideDocumentHighlights(doc, pos, token);
|
|
11506
12305
|
if (Array.isArray(value)) {
|
|
11507
12306
|
return value.map(DocumentHighlight$1.from);
|
|
@@ -11516,7 +12315,7 @@ class LinkedEditingRangeAdapter {
|
|
|
11516
12315
|
}
|
|
11517
12316
|
async provideLinkedEditingRanges(resource, position, token) {
|
|
11518
12317
|
const doc = this._documents.getDocument(resource);
|
|
11519
|
-
const pos = Position$
|
|
12318
|
+
const pos = Position$1.to(position);
|
|
11520
12319
|
const value = await this._provider.provideLinkedEditingRanges(doc, pos, token);
|
|
11521
12320
|
if (value && Array.isArray(value.ranges)) {
|
|
11522
12321
|
return {
|
|
@@ -11534,7 +12333,7 @@ class ReferenceAdapter {
|
|
|
11534
12333
|
}
|
|
11535
12334
|
async provideReferences(resource, position, context, token) {
|
|
11536
12335
|
const doc = this._documents.getDocument(resource);
|
|
11537
|
-
const pos = Position$
|
|
12336
|
+
const pos = Position$1.to(position);
|
|
11538
12337
|
const value = await this._provider.provideReferences(doc, pos, context, token);
|
|
11539
12338
|
if (Array.isArray(value)) {
|
|
11540
12339
|
return value.map(location.from);
|
|
@@ -11678,7 +12477,7 @@ class OnTypeFormattingAdapter {
|
|
|
11678
12477
|
}
|
|
11679
12478
|
async provideOnTypeFormattingEdits(resource, position, ch, options, token) {
|
|
11680
12479
|
const document = this._documents.getDocument(resource);
|
|
11681
|
-
const pos = Position$
|
|
12480
|
+
const pos = Position$1.to(position);
|
|
11682
12481
|
const value = await this._provider.provideOnTypeFormattingEdits(document, pos, ch, options, token);
|
|
11683
12482
|
if (Array.isArray(value)) {
|
|
11684
12483
|
return value.map(TextEdit$1.from);
|
|
@@ -11744,7 +12543,7 @@ class RenameAdapter {
|
|
|
11744
12543
|
}
|
|
11745
12544
|
async provideRenameEdits(resource, position, newName, token) {
|
|
11746
12545
|
const doc = this._documents.getDocument(resource);
|
|
11747
|
-
const pos = Position$
|
|
12546
|
+
const pos = Position$1.to(position);
|
|
11748
12547
|
try {
|
|
11749
12548
|
const value = await this._provider.provideRenameEdits(doc, pos, newName, token);
|
|
11750
12549
|
if (!value) {
|
|
@@ -11767,7 +12566,7 @@ class RenameAdapter {
|
|
|
11767
12566
|
return Promise.resolve(undefined);
|
|
11768
12567
|
}
|
|
11769
12568
|
const doc = this._documents.getDocument(resource);
|
|
11770
|
-
const pos = Position$
|
|
12569
|
+
const pos = Position$1.to(position);
|
|
11771
12570
|
try {
|
|
11772
12571
|
const rangeOrLocation = await this._provider.prepareRename(doc, pos, token);
|
|
11773
12572
|
let range;
|
|
@@ -11975,7 +12774,7 @@ class SuggestAdapter {
|
|
|
11975
12774
|
}
|
|
11976
12775
|
async provideCompletionItems(resource, position, context, token) {
|
|
11977
12776
|
const doc = this._documents.getDocument(resource);
|
|
11978
|
-
const pos = Position$
|
|
12777
|
+
const pos = Position$1.to(position);
|
|
11979
12778
|
const replaceRange = doc.getWordRangeAtPosition(pos) || new Range$2(pos, pos);
|
|
11980
12779
|
const insertRange = replaceRange.with({ end: pos });
|
|
11981
12780
|
const sw = new StopWatch(true);
|
|
@@ -12084,7 +12883,7 @@ class InlineCompletionAdapter {
|
|
|
12084
12883
|
}
|
|
12085
12884
|
async provideInlineCompletions(resource, position, context, token) {
|
|
12086
12885
|
const doc = this._documents.getDocument(resource);
|
|
12087
|
-
const pos = Position$
|
|
12886
|
+
const pos = Position$1.to(position);
|
|
12088
12887
|
const result = await this._provider.provideInlineCompletionItems(doc, pos, {
|
|
12089
12888
|
selectedCompletionInfo: context.selectedSuggestionInfo
|
|
12090
12889
|
? {
|
|
@@ -12173,7 +12972,7 @@ class SignatureHelpAdapter {
|
|
|
12173
12972
|
}
|
|
12174
12973
|
async provideSignatureHelp(resource, position, context, token) {
|
|
12175
12974
|
const doc = this._documents.getDocument(resource);
|
|
12176
|
-
const pos = Position$
|
|
12975
|
+
const pos = Position$1.to(position);
|
|
12177
12976
|
const vscodeContext = this.reviveContext(context);
|
|
12178
12977
|
const value = await this._provider.provideSignatureHelp(doc, pos, token, vscodeContext);
|
|
12179
12978
|
if (value) {
|
|
@@ -12275,7 +13074,7 @@ class InlayHintsAdapter {
|
|
|
12275
13074
|
label: '',
|
|
12276
13075
|
cacheId: id,
|
|
12277
13076
|
tooltip: MarkdownString$1.fromStrict(hint.tooltip),
|
|
12278
|
-
position: Position$
|
|
13077
|
+
position: Position$1.from(hint.position),
|
|
12279
13078
|
kind: hint.kind && InlayHintKind$1.from(hint.kind),
|
|
12280
13079
|
paddingLeft: hint.paddingLeft,
|
|
12281
13080
|
paddingRight: hint.paddingRight,
|
|
@@ -12408,7 +13207,7 @@ class SelectionRangeAdapter {
|
|
|
12408
13207
|
}
|
|
12409
13208
|
async provideSelectionRanges(resource, pos, token) {
|
|
12410
13209
|
const document = this._documents.getDocument(resource);
|
|
12411
|
-
const positions = pos.map(Position$
|
|
13210
|
+
const positions = pos.map(Position$1.to);
|
|
12412
13211
|
const allProviderRanges = await this._provider.provideSelectionRanges(document, positions, token);
|
|
12413
13212
|
if (!isNonEmptyArray(allProviderRanges)) {
|
|
12414
13213
|
return [];
|
|
@@ -12447,7 +13246,7 @@ class CallHierarchyAdapter {
|
|
|
12447
13246
|
}
|
|
12448
13247
|
async prepareSession(uri, position, token) {
|
|
12449
13248
|
const doc = this._documents.getDocument(uri);
|
|
12450
|
-
const pos = Position$
|
|
13249
|
+
const pos = Position$1.to(position);
|
|
12451
13250
|
const items = await this._provider.prepareCallHierarchy(doc, pos, token);
|
|
12452
13251
|
if (!items) {
|
|
12453
13252
|
return undefined;
|
|
@@ -12516,7 +13315,7 @@ class TypeHierarchyAdapter {
|
|
|
12516
13315
|
}
|
|
12517
13316
|
async prepareSession(uri, position, token) {
|
|
12518
13317
|
const doc = this._documents.getDocument(uri);
|
|
12519
|
-
const pos = Position$
|
|
13318
|
+
const pos = Position$1.to(position);
|
|
12520
13319
|
const items = await this._provider.prepareTypeHierarchy(doc, pos, token);
|
|
12521
13320
|
if (!items) {
|
|
12522
13321
|
return undefined;
|
|
@@ -13863,6 +14662,302 @@ class MainThreadDocumentRangeSemanticTokensProvider {
|
|
|
13863
14662
|
throw new Error(`Unexpected`);
|
|
13864
14663
|
}
|
|
13865
14664
|
}
|
|
14665
|
+
function lookUp(tree, key) {
|
|
14666
|
+
if (key) {
|
|
14667
|
+
const parts = key.split('.');
|
|
14668
|
+
let node = tree;
|
|
14669
|
+
for (let i = 0; node && i < parts.length; i++) {
|
|
14670
|
+
node = node[parts[i]];
|
|
14671
|
+
}
|
|
14672
|
+
return node;
|
|
14673
|
+
}
|
|
14674
|
+
}
|
|
14675
|
+
function isUri(thing) {
|
|
14676
|
+
return thing instanceof URI;
|
|
14677
|
+
}
|
|
14678
|
+
function isResourceLanguage(thing) {
|
|
14679
|
+
return thing
|
|
14680
|
+
&& thing.uri instanceof URI
|
|
14681
|
+
&& (thing.languageId && typeof thing.languageId === 'string');
|
|
14682
|
+
}
|
|
14683
|
+
function isLanguage(thing) {
|
|
14684
|
+
return thing
|
|
14685
|
+
&& !thing.uri
|
|
14686
|
+
&& (thing.languageId && typeof thing.languageId === 'string');
|
|
14687
|
+
}
|
|
14688
|
+
function isWorkspaceFolder(thing) {
|
|
14689
|
+
return thing
|
|
14690
|
+
&& thing.uri instanceof URI
|
|
14691
|
+
&& (!thing.name || typeof thing.name === 'string')
|
|
14692
|
+
&& (!thing.index || typeof thing.index === 'number');
|
|
14693
|
+
}
|
|
14694
|
+
function scopeToOverrides(scope) {
|
|
14695
|
+
if (isUri(scope)) {
|
|
14696
|
+
return { resource: scope };
|
|
14697
|
+
}
|
|
14698
|
+
if (isResourceLanguage(scope)) {
|
|
14699
|
+
return { resource: scope.uri, overrideIdentifier: scope.languageId };
|
|
14700
|
+
}
|
|
14701
|
+
if (isLanguage(scope)) {
|
|
14702
|
+
return { overrideIdentifier: scope.languageId };
|
|
14703
|
+
}
|
|
14704
|
+
if (isWorkspaceFolder(scope)) {
|
|
14705
|
+
return { resource: scope.uri };
|
|
14706
|
+
}
|
|
14707
|
+
if (scope === null) {
|
|
14708
|
+
return { resource: null };
|
|
14709
|
+
}
|
|
14710
|
+
return undefined;
|
|
14711
|
+
}
|
|
14712
|
+
class ExtHostConfigProvider {
|
|
14713
|
+
constructor(proxy, extHostWorkspace, data, logService) {
|
|
14714
|
+
this._onDidChangeConfiguration = new Emitter();
|
|
14715
|
+
this._proxy = proxy;
|
|
14716
|
+
this._logService = logService;
|
|
14717
|
+
this._extHostWorkspace = extHostWorkspace;
|
|
14718
|
+
this._configuration = Configuration.parse(data);
|
|
14719
|
+
this._configurationScopes = this._toMap(data.configurationScopes);
|
|
14720
|
+
}
|
|
14721
|
+
get onDidChangeConfiguration() {
|
|
14722
|
+
return this._onDidChangeConfiguration && this._onDidChangeConfiguration.event;
|
|
14723
|
+
}
|
|
14724
|
+
$acceptConfigurationChanged(data, change) {
|
|
14725
|
+
const previous = { data: this._configuration.toData(), workspace: this._extHostWorkspace.workspace };
|
|
14726
|
+
this._configuration = Configuration.parse(data);
|
|
14727
|
+
this._configurationScopes = this._toMap(data.configurationScopes);
|
|
14728
|
+
this._onDidChangeConfiguration.fire(this._toConfigurationChangeEvent(change, previous));
|
|
14729
|
+
}
|
|
14730
|
+
getConfiguration(section, scope, extensionDescription) {
|
|
14731
|
+
const overrides = scopeToOverrides(scope) || {};
|
|
14732
|
+
const config = this._toReadonlyValue(section
|
|
14733
|
+
? lookUp(this._configuration.getValue(undefined, overrides, this._extHostWorkspace.workspace), section)
|
|
14734
|
+
: this._configuration.getValue(undefined, overrides, this._extHostWorkspace.workspace));
|
|
14735
|
+
if (section) {
|
|
14736
|
+
this._validateConfigurationAccess(section, overrides, extensionDescription?.identifier);
|
|
14737
|
+
}
|
|
14738
|
+
function parseConfigurationTarget(arg) {
|
|
14739
|
+
if (arg === undefined || arg === null) {
|
|
14740
|
+
return null;
|
|
14741
|
+
}
|
|
14742
|
+
if (typeof arg === 'boolean') {
|
|
14743
|
+
return arg ? 1 : 4 ;
|
|
14744
|
+
}
|
|
14745
|
+
switch (arg) {
|
|
14746
|
+
case ConfigurationTarget$1.Global: return 1 ;
|
|
14747
|
+
case ConfigurationTarget$1.Workspace: return 4 ;
|
|
14748
|
+
case ConfigurationTarget$1.WorkspaceFolder: return 5 ;
|
|
14749
|
+
}
|
|
14750
|
+
}
|
|
14751
|
+
const result = {
|
|
14752
|
+
has(key) {
|
|
14753
|
+
return typeof lookUp(config, key) !== 'undefined';
|
|
14754
|
+
},
|
|
14755
|
+
get: (key, defaultValue) => {
|
|
14756
|
+
this._validateConfigurationAccess(section ? `${section}.${key}` : key, overrides, extensionDescription?.identifier);
|
|
14757
|
+
let result = lookUp(config, key);
|
|
14758
|
+
if (typeof result === 'undefined') {
|
|
14759
|
+
result = defaultValue;
|
|
14760
|
+
}
|
|
14761
|
+
else {
|
|
14762
|
+
let clonedConfig = undefined;
|
|
14763
|
+
const cloneOnWriteProxy = (target, accessor) => {
|
|
14764
|
+
let clonedTarget = undefined;
|
|
14765
|
+
const cloneTarget = () => {
|
|
14766
|
+
clonedConfig = clonedConfig ? clonedConfig : deepClone(config);
|
|
14767
|
+
clonedTarget = clonedTarget ? clonedTarget : lookUp(clonedConfig, accessor);
|
|
14768
|
+
};
|
|
14769
|
+
return isObject(target) ?
|
|
14770
|
+
new Proxy(target, {
|
|
14771
|
+
get: (target, property) => {
|
|
14772
|
+
if (typeof property === 'string' && property.toLowerCase() === 'tojson') {
|
|
14773
|
+
cloneTarget();
|
|
14774
|
+
return () => clonedTarget;
|
|
14775
|
+
}
|
|
14776
|
+
if (clonedConfig) {
|
|
14777
|
+
clonedTarget = clonedTarget ? clonedTarget : lookUp(clonedConfig, accessor);
|
|
14778
|
+
return clonedTarget[property];
|
|
14779
|
+
}
|
|
14780
|
+
const result = target[property];
|
|
14781
|
+
if (typeof property === 'string') {
|
|
14782
|
+
return cloneOnWriteProxy(result, `${accessor}.${property}`);
|
|
14783
|
+
}
|
|
14784
|
+
return result;
|
|
14785
|
+
},
|
|
14786
|
+
set: (_target, property, value) => {
|
|
14787
|
+
cloneTarget();
|
|
14788
|
+
if (clonedTarget) {
|
|
14789
|
+
clonedTarget[property] = value;
|
|
14790
|
+
}
|
|
14791
|
+
return true;
|
|
14792
|
+
},
|
|
14793
|
+
deleteProperty: (_target, property) => {
|
|
14794
|
+
cloneTarget();
|
|
14795
|
+
if (clonedTarget) {
|
|
14796
|
+
delete clonedTarget[property];
|
|
14797
|
+
}
|
|
14798
|
+
return true;
|
|
14799
|
+
},
|
|
14800
|
+
defineProperty: (_target, property, descriptor) => {
|
|
14801
|
+
cloneTarget();
|
|
14802
|
+
if (clonedTarget) {
|
|
14803
|
+
Object.defineProperty(clonedTarget, property, descriptor);
|
|
14804
|
+
}
|
|
14805
|
+
return true;
|
|
14806
|
+
}
|
|
14807
|
+
}) : target;
|
|
14808
|
+
};
|
|
14809
|
+
result = cloneOnWriteProxy(result, key);
|
|
14810
|
+
}
|
|
14811
|
+
return result;
|
|
14812
|
+
},
|
|
14813
|
+
update: (key, value, extHostConfigurationTarget, scopeToLanguage) => {
|
|
14814
|
+
key = section ? `${section}.${key}` : key;
|
|
14815
|
+
const target = parseConfigurationTarget(extHostConfigurationTarget);
|
|
14816
|
+
if (value !== undefined) {
|
|
14817
|
+
return this._proxy.$updateConfigurationOption(target, key, value, overrides, scopeToLanguage);
|
|
14818
|
+
}
|
|
14819
|
+
else {
|
|
14820
|
+
return this._proxy.$removeConfigurationOption(target, key, overrides, scopeToLanguage);
|
|
14821
|
+
}
|
|
14822
|
+
},
|
|
14823
|
+
inspect: (key) => {
|
|
14824
|
+
key = section ? `${section}.${key}` : key;
|
|
14825
|
+
const config = deepClone(this._configuration.inspect(key, overrides, this._extHostWorkspace.workspace));
|
|
14826
|
+
if (config) {
|
|
14827
|
+
return {
|
|
14828
|
+
key,
|
|
14829
|
+
defaultValue: config.default?.value,
|
|
14830
|
+
globalValue: config.user?.value,
|
|
14831
|
+
workspaceValue: config.workspace?.value,
|
|
14832
|
+
workspaceFolderValue: config.workspaceFolder?.value,
|
|
14833
|
+
defaultLanguageValue: config.default?.override,
|
|
14834
|
+
globalLanguageValue: config.user?.override,
|
|
14835
|
+
workspaceLanguageValue: config.workspace?.override,
|
|
14836
|
+
workspaceFolderLanguageValue: config.workspaceFolder?.override,
|
|
14837
|
+
languageIds: config.overrideIdentifiers
|
|
14838
|
+
};
|
|
14839
|
+
}
|
|
14840
|
+
return undefined;
|
|
14841
|
+
}
|
|
14842
|
+
};
|
|
14843
|
+
if (typeof config === 'object') {
|
|
14844
|
+
mixin(result, config, false);
|
|
14845
|
+
}
|
|
14846
|
+
return (
|
|
14847
|
+
Object.freeze(result)
|
|
14848
|
+
);
|
|
14849
|
+
}
|
|
14850
|
+
_toReadonlyValue(result) {
|
|
14851
|
+
const readonlyProxy = (target) => {
|
|
14852
|
+
return isObject(target) ?
|
|
14853
|
+
new Proxy(target, {
|
|
14854
|
+
get: (target, property) => readonlyProxy(target[property]),
|
|
14855
|
+
set: (_target, property, _value) => { throw new Error(`TypeError: Cannot assign to read only property '${String(property)}' of object`); },
|
|
14856
|
+
deleteProperty: (_target, property) => { throw new Error(`TypeError: Cannot delete read only property '${String(property)}' of object`); },
|
|
14857
|
+
defineProperty: (_target, property) => { throw new Error(`TypeError: Cannot define property '${String(property)}' for a readonly object`); },
|
|
14858
|
+
setPrototypeOf: (_target) => { throw new Error(`TypeError: Cannot set prototype for a readonly object`); },
|
|
14859
|
+
isExtensible: () => false,
|
|
14860
|
+
preventExtensions: () => true
|
|
14861
|
+
}) : target;
|
|
14862
|
+
};
|
|
14863
|
+
return readonlyProxy(result);
|
|
14864
|
+
}
|
|
14865
|
+
_validateConfigurationAccess(key, overrides, extensionId) {
|
|
14866
|
+
const scope = OVERRIDE_PROPERTY_REGEX$1.test(key) ? 4 : this._configurationScopes.get(key);
|
|
14867
|
+
const extensionIdText = extensionId ? `[${extensionId.value}] ` : '';
|
|
14868
|
+
if (4 === scope) {
|
|
14869
|
+
if (typeof overrides?.resource === 'undefined') {
|
|
14870
|
+
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.`);
|
|
14871
|
+
}
|
|
14872
|
+
return;
|
|
14873
|
+
}
|
|
14874
|
+
if (3 === scope) {
|
|
14875
|
+
if (overrides?.resource) {
|
|
14876
|
+
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'.`);
|
|
14877
|
+
}
|
|
14878
|
+
return;
|
|
14879
|
+
}
|
|
14880
|
+
}
|
|
14881
|
+
_toConfigurationChangeEvent(change, previous) {
|
|
14882
|
+
const event = new ConfigurationChangeEvent(change, previous, this._configuration, this._extHostWorkspace.workspace);
|
|
14883
|
+
return (
|
|
14884
|
+
Object.freeze({
|
|
14885
|
+
affectsConfiguration: (section, scope) => event.affectsConfiguration(section, scopeToOverrides(scope))
|
|
14886
|
+
})
|
|
14887
|
+
);
|
|
14888
|
+
}
|
|
14889
|
+
_toMap(scopes) {
|
|
14890
|
+
return scopes.reduce((result, scope) => { result.set(scope[0], scope[1]); return result; }, new Map());
|
|
14891
|
+
}
|
|
14892
|
+
}
|
|
14893
|
+
let MainThreadConfiguration = class MainThreadConfiguration {
|
|
14894
|
+
constructor(extHostContext, _workspaceContextService, configurationService, _environmentService) {
|
|
14895
|
+
this._workspaceContextService = _workspaceContextService;
|
|
14896
|
+
this.configurationService = configurationService;
|
|
14897
|
+
this._environmentService = _environmentService;
|
|
14898
|
+
const proxy = extHostContext.getProxy(ExtHostContext.ExtHostConfiguration);
|
|
14899
|
+
proxy.$initializeConfiguration(this._getConfigurationData());
|
|
14900
|
+
this._configurationListener = configurationService.onDidChangeConfiguration(e => {
|
|
14901
|
+
proxy.$acceptConfigurationChanged(this._getConfigurationData(), e.change);
|
|
14902
|
+
});
|
|
14903
|
+
}
|
|
14904
|
+
_getConfigurationData() {
|
|
14905
|
+
const configurationData = { ...(this.configurationService.getConfigurationData()), configurationScopes: [] };
|
|
14906
|
+
if (!this._environmentService.isBuilt || this._environmentService.isExtensionDevelopment) {
|
|
14907
|
+
configurationData.configurationScopes = getScopes();
|
|
14908
|
+
}
|
|
14909
|
+
return configurationData;
|
|
14910
|
+
}
|
|
14911
|
+
dispose() {
|
|
14912
|
+
this._configurationListener.dispose();
|
|
14913
|
+
}
|
|
14914
|
+
$updateConfigurationOption(target, key, value, overrides, scopeToLanguage) {
|
|
14915
|
+
overrides = { resource: overrides?.resource ? URI.revive(overrides.resource) : undefined, overrideIdentifier: overrides?.overrideIdentifier };
|
|
14916
|
+
return this.writeConfiguration(target, key, value, overrides, scopeToLanguage);
|
|
14917
|
+
}
|
|
14918
|
+
$removeConfigurationOption(target, key, overrides, scopeToLanguage) {
|
|
14919
|
+
overrides = { resource: overrides?.resource ? URI.revive(overrides.resource) : undefined, overrideIdentifier: overrides?.overrideIdentifier };
|
|
14920
|
+
return this.writeConfiguration(target, key, undefined, overrides, scopeToLanguage);
|
|
14921
|
+
}
|
|
14922
|
+
writeConfiguration(target, key, value, overrides, scopeToLanguage) {
|
|
14923
|
+
target = target !== null && target !== undefined ? target : this.deriveConfigurationTarget(key, overrides);
|
|
14924
|
+
const configurationValue = this.configurationService.inspect(key, overrides);
|
|
14925
|
+
switch (target) {
|
|
14926
|
+
case 7 :
|
|
14927
|
+
return this._updateValue(key, value, target, configurationValue?.memory?.override, overrides, scopeToLanguage);
|
|
14928
|
+
case 5 :
|
|
14929
|
+
return this._updateValue(key, value, target, configurationValue?.workspaceFolder?.override, overrides, scopeToLanguage);
|
|
14930
|
+
case 4 :
|
|
14931
|
+
return this._updateValue(key, value, target, configurationValue?.workspace?.override, overrides, scopeToLanguage);
|
|
14932
|
+
case 3 :
|
|
14933
|
+
return this._updateValue(key, value, target, configurationValue?.userRemote?.override, overrides, scopeToLanguage);
|
|
14934
|
+
default:
|
|
14935
|
+
return this._updateValue(key, value, target, configurationValue?.userLocal?.override, overrides, scopeToLanguage);
|
|
14936
|
+
}
|
|
14937
|
+
}
|
|
14938
|
+
_updateValue(key, value, configurationTarget, overriddenValue, overrides, scopeToLanguage) {
|
|
14939
|
+
overrides = scopeToLanguage === true ? overrides
|
|
14940
|
+
: scopeToLanguage === false ? { resource: overrides.resource }
|
|
14941
|
+
: overrides.overrideIdentifier && overriddenValue !== undefined ? overrides
|
|
14942
|
+
: { resource: overrides.resource };
|
|
14943
|
+
return this.configurationService.updateValue(key, value, overrides, configurationTarget, true);
|
|
14944
|
+
}
|
|
14945
|
+
deriveConfigurationTarget(key, overrides) {
|
|
14946
|
+
if (overrides.resource && this._workspaceContextService.getWorkbenchState() === 3 ) {
|
|
14947
|
+
const configurationProperties = Registry.as(Extensions$1.Configuration).getConfigurationProperties();
|
|
14948
|
+
if (configurationProperties[key] && ((configurationProperties[key].scope === 4 || configurationProperties[key].scope === 5) )) {
|
|
14949
|
+
return 5 ;
|
|
14950
|
+
}
|
|
14951
|
+
}
|
|
14952
|
+
return 4 ;
|
|
14953
|
+
}
|
|
14954
|
+
};
|
|
14955
|
+
MainThreadConfiguration = __decorate([
|
|
14956
|
+
extHostNamedCustomer(MainContext.MainThreadConfiguration),
|
|
14957
|
+
__param(1, IWorkspaceContextService),
|
|
14958
|
+
__param(2, IConfigurationService),
|
|
14959
|
+
__param(3, IEnvironmentService)
|
|
14960
|
+
], MainThreadConfiguration);
|
|
13866
14961
|
const DEFAULT_EXTENSION = {
|
|
13867
14962
|
identifier: new ExtensionIdentifier('monaco'),
|
|
13868
14963
|
isBuiltin: true,
|
|
@@ -13917,6 +15012,28 @@ class MainThreadMessageServiceWithoutSource extends MainThreadMessageService {
|
|
|
13917
15012
|
};
|
|
13918
15013
|
}
|
|
13919
15014
|
}
|
|
15015
|
+
let SyncExtHostConfiguration = class SyncExtHostConfiguration {
|
|
15016
|
+
constructor(extHostRpc, extHostWorkspace, logService) {
|
|
15017
|
+
this._proxy = extHostRpc.getProxy(MainContext.MainThreadConfiguration);
|
|
15018
|
+
this._extHostWorkspace = extHostWorkspace;
|
|
15019
|
+
this._logService = logService;
|
|
15020
|
+
this._actual = null;
|
|
15021
|
+
}
|
|
15022
|
+
getConfigProvider() {
|
|
15023
|
+
return this._actual;
|
|
15024
|
+
}
|
|
15025
|
+
$initializeConfiguration(data) {
|
|
15026
|
+
this._actual = new ExtHostConfigProvider(this._proxy, this._extHostWorkspace, data, this._logService);
|
|
15027
|
+
}
|
|
15028
|
+
$acceptConfigurationChanged(data, change) {
|
|
15029
|
+
this.getConfigProvider().$acceptConfigurationChanged(data, change);
|
|
15030
|
+
}
|
|
15031
|
+
};
|
|
15032
|
+
SyncExtHostConfiguration = __decorate([
|
|
15033
|
+
__param(0, IExtHostRpcService),
|
|
15034
|
+
__param(1, IExtHostWorkspace),
|
|
15035
|
+
__param(2, ILogService)
|
|
15036
|
+
], SyncExtHostConfiguration);
|
|
13920
15037
|
function createExtHostServices() {
|
|
13921
15038
|
const commandsService = StandaloneServices.get(ICommandService);
|
|
13922
15039
|
const notificationService = StandaloneServices.get(INotificationService);
|
|
@@ -13948,6 +15065,7 @@ function createExtHostServices() {
|
|
|
13948
15065
|
const languageConfigurationService = StandaloneServices.get(ILanguageConfigurationService);
|
|
13949
15066
|
const languageFeaturesService = StandaloneServices.get(ILanguageFeaturesService);
|
|
13950
15067
|
const configurationService = StandaloneServices.get(IConfigurationService);
|
|
15068
|
+
const workspaceContextService = StandaloneServices.get(IWorkspaceContextService);
|
|
13951
15069
|
const imessagePassingProtocol = new SimpleMessagePassingProtocol();
|
|
13952
15070
|
const rpcProtocol = new RPCProtocol(imessagePassingProtocol);
|
|
13953
15071
|
const extHostFileSystemInfo = new ExtHostFileSystemInfo();
|
|
@@ -13968,6 +15086,26 @@ function createExtHostServices() {
|
|
|
13968
15086
|
return rpcProtocol.drain();
|
|
13969
15087
|
}
|
|
13970
15088
|
};
|
|
15089
|
+
const initData = {
|
|
15090
|
+
_serviceBrand: undefined,
|
|
15091
|
+
version: '1.0.0',
|
|
15092
|
+
parentPid: 0,
|
|
15093
|
+
get environment() { return unsupported$1(); },
|
|
15094
|
+
resolvedExtensions: [],
|
|
15095
|
+
hostExtensions: [],
|
|
15096
|
+
extensions: [Services.get().extension ?? DEFAULT_EXTENSION],
|
|
15097
|
+
get telemetryInfo() { return unsupported$1(); },
|
|
15098
|
+
logLevel: LogLevel$1.Trace,
|
|
15099
|
+
get logsLocation() { return unsupported$1(); },
|
|
15100
|
+
get logFile() { return unsupported$1(); },
|
|
15101
|
+
autoStart: false,
|
|
15102
|
+
remote: {
|
|
15103
|
+
isRemote: false,
|
|
15104
|
+
authority: undefined,
|
|
15105
|
+
connectionData: null
|
|
15106
|
+
},
|
|
15107
|
+
uiKind: UIKind$1.Web
|
|
15108
|
+
};
|
|
13971
15109
|
const extHostLogService = new LogService(new ConsoleMainLogger());
|
|
13972
15110
|
const extensionService = new NullExtensionService();
|
|
13973
15111
|
const extHostApiDeprecationService = new ExtHostApiDeprecationService(mainContext, extHostLogService);
|
|
@@ -13987,6 +15125,8 @@ function createExtHostServices() {
|
|
|
13987
15125
|
const extHostEditors = rpcProtocol.set(ExtHostContext.ExtHostEditors, new ExtHostEditors(mainContext, extHostDocumentsAndEditors));
|
|
13988
15126
|
const extHostClipboard = new ExtHostClipboard(mainContext);
|
|
13989
15127
|
const extHostLanguageFeatures = rpcProtocol.set(ExtHostContext.ExtHostLanguageFeatures, new ExtHostLanguageFeatures(rpcProtocol, uriTransformerService, extHostDocuments, extHostCommands, extHostDiagnostics, extHostLogService, extHostApiDeprecationService));
|
|
15128
|
+
const extHostWorkspace = rpcProtocol.set(ExtHostContext.ExtHostWorkspace, new ExtHostWorkspace(mainContext, initData, extHostFileSystemInfo, extHostLogService));
|
|
15129
|
+
const extHostConfiguration = rpcProtocol.set(ExtHostContext.ExtHostConfiguration, new SyncExtHostConfiguration(mainContext, extHostWorkspace, extHostLogService));
|
|
13990
15130
|
rpcProtocol.set(ExtHostContext.ExtHostTelemetry, new ExtHostTelemetry());
|
|
13991
15131
|
rpcProtocol.set(MainContext.MainThreadMessageService, new MainThreadMessageServiceWithoutSource(mainContext, notificationService, commandsService, dialogService));
|
|
13992
15132
|
rpcProtocol.set(MainContext.MainThreadDiagnostics, new MonacoMainThreadDiagnostics(mainContext, markerService, uriIdentityService));
|
|
@@ -13998,6 +15138,7 @@ function createExtHostServices() {
|
|
|
13998
15138
|
rpcProtocol.set(MainContext.MainThreadLanguages, new MainThreadLanguages(mainContext, languageService, modelService, textModelService, languageStatusService));
|
|
13999
15139
|
rpcProtocol.set(MainContext.MainThreadClipboard, new MainThreadClipboard(mainContext, clipboardService));
|
|
14000
15140
|
rpcProtocol.set(MainContext.MainThreadLanguageFeatures, new MainThreadLanguageFeatures(mainContext, languageService, languageConfigurationService, languageFeaturesService));
|
|
15141
|
+
rpcProtocol.set(MainContext.MainThreadConfiguration, new MainThreadConfiguration(mainContext, workspaceContextService, configurationService, workbenchEnvironmentService));
|
|
14001
15142
|
new MainThreadDocumentsAndEditors(mainContext, modelService, textFileService, editorService, codeEditorService, fileService, textModelService, editorGroupsService, bulkEditService, paneCompositePartService, workbenchEnvironmentService, workingCopyFileService, uriIdentityService, clipboardService, pathService);
|
|
14002
15143
|
const extHostBulkEdits = new ExtHostBulkEdits(mainContext, extHostDocumentsAndEditors);
|
|
14003
15144
|
return {
|
|
@@ -14016,7 +15157,9 @@ function createExtHostServices() {
|
|
|
14016
15157
|
extHostLanguages,
|
|
14017
15158
|
extHostWindow,
|
|
14018
15159
|
extHostClipboard,
|
|
14019
|
-
extHostLanguageFeatures
|
|
15160
|
+
extHostLanguageFeatures,
|
|
15161
|
+
extHostWorkspace,
|
|
15162
|
+
extHostConfiguration
|
|
14020
15163
|
};
|
|
14021
15164
|
}
|
|
14022
15165
|
let extHostServices;
|
|
@@ -14298,24 +15441,14 @@ const workspace$1 = {
|
|
|
14298
15441
|
return extHostBulkEdits.applyWorkspaceEdit(edit);
|
|
14299
15442
|
},
|
|
14300
15443
|
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
|
-
};
|
|
15444
|
+
const { extHostConfiguration } = getExtHostServices();
|
|
15445
|
+
const configProvider = extHostConfiguration.getConfigProvider();
|
|
15446
|
+
return configProvider.getConfiguration(section, scope, Services.get().extension ?? DEFAULT_EXTENSION);
|
|
14315
15447
|
},
|
|
14316
|
-
|
|
14317
|
-
const {
|
|
14318
|
-
|
|
15448
|
+
onDidChangeConfiguration(listener, thisArgs, disposables) {
|
|
15449
|
+
const { extHostConfiguration } = getExtHostServices();
|
|
15450
|
+
const configProvider = extHostConfiguration.getConfigProvider();
|
|
15451
|
+
return configProvider.onDidChangeConfiguration(listener, thisArgs, disposables);
|
|
14319
15452
|
},
|
|
14320
15453
|
get rootPath() {
|
|
14321
15454
|
const { workspace } = Services.get();
|
|
@@ -14442,6 +15575,31 @@ const workspace$1 = {
|
|
|
14442
15575
|
onDidChangeNotebookDocument: unsupported$1,
|
|
14443
15576
|
onDidSaveNotebookDocument: unsupported$1
|
|
14444
15577
|
};
|
|
15578
|
+
class TextTabInput {
|
|
15579
|
+
constructor(uri) {
|
|
15580
|
+
this.uri = uri;
|
|
15581
|
+
}
|
|
15582
|
+
}
|
|
15583
|
+
function getTabFromModel(model, tabGroup) {
|
|
15584
|
+
return {
|
|
15585
|
+
label: model.uri.fsPath,
|
|
15586
|
+
group: tabGroup,
|
|
15587
|
+
get isActive() { return model.isAttachedToEditor(); },
|
|
15588
|
+
isDirty: false,
|
|
15589
|
+
isPinned: false,
|
|
15590
|
+
isPreview: false,
|
|
15591
|
+
input: new TextTabInput(model.uri)
|
|
15592
|
+
};
|
|
15593
|
+
}
|
|
15594
|
+
const tabGroup = {
|
|
15595
|
+
isActive: true,
|
|
15596
|
+
activeTab: undefined,
|
|
15597
|
+
viewColumn: ViewColumn$2.One,
|
|
15598
|
+
get tabs() {
|
|
15599
|
+
const modelService = StandaloneServices.get(IModelService);
|
|
15600
|
+
return modelService.getModels().map(model => getTabFromModel(model, tabGroup));
|
|
15601
|
+
}
|
|
15602
|
+
};
|
|
14445
15603
|
const window$2 = {
|
|
14446
15604
|
showInformationMessage(message, ...rest) {
|
|
14447
15605
|
const { extHostMessageService } = getExtHostServices();
|
|
@@ -14569,8 +15727,32 @@ const window$2 = {
|
|
|
14569
15727
|
registerFileDecorationProvider: unsupported$1,
|
|
14570
15728
|
registerTerminalProfileProvider: unsupported$1,
|
|
14571
15729
|
onDidChangeTerminalState: Event.None,
|
|
14572
|
-
|
|
14573
|
-
|
|
15730
|
+
tabGroups: {
|
|
15731
|
+
get all() {
|
|
15732
|
+
return [tabGroup];
|
|
15733
|
+
},
|
|
15734
|
+
activeTabGroup: tabGroup,
|
|
15735
|
+
onDidChangeTabGroups: Event.None,
|
|
15736
|
+
onDidChangeTabs(listener) {
|
|
15737
|
+
const modelService = StandaloneServices.get(IModelService);
|
|
15738
|
+
const store = new DisposableStore();
|
|
15739
|
+
store.add(modelService.onModelAdded((model) => {
|
|
15740
|
+
listener({
|
|
15741
|
+
opened: [getTabFromModel(model, tabGroup)],
|
|
15742
|
+
closed: [],
|
|
15743
|
+
changed: []
|
|
15744
|
+
});
|
|
15745
|
+
}));
|
|
15746
|
+
store.add(modelService.onModelRemoved((model) => {
|
|
15747
|
+
listener({
|
|
15748
|
+
opened: [],
|
|
15749
|
+
closed: [getTabFromModel(model, tabGroup)],
|
|
15750
|
+
changed: []
|
|
15751
|
+
});
|
|
15752
|
+
}));
|
|
15753
|
+
return store;
|
|
15754
|
+
},
|
|
15755
|
+
close: unsupported$1
|
|
14574
15756
|
}
|
|
14575
15757
|
};
|
|
14576
15758
|
const env$1 = {
|
|
@@ -14695,7 +15877,7 @@ const api = {
|
|
|
14695
15877
|
MarkdownString: MarkdownString$2,
|
|
14696
15878
|
OverviewRulerLane: OverviewRulerLane$1,
|
|
14697
15879
|
ParameterInformation: ParameterInformation$2,
|
|
14698
|
-
Position: Position$
|
|
15880
|
+
Position: Position$2,
|
|
14699
15881
|
ProcessExecution: ProcessExecution$1,
|
|
14700
15882
|
ProgressLocation: ProgressLocation$2,
|
|
14701
15883
|
QuickInputButtons: QuickInputButtons$1,
|
|
@@ -14764,7 +15946,7 @@ const api = {
|
|
|
14764
15946
|
DataTransferItem: unsupported,
|
|
14765
15947
|
LanguageStatusSeverity: LanguageStatusSeverity$1,
|
|
14766
15948
|
QuickPickItemKind: QuickPickItemKind$1,
|
|
14767
|
-
TabInputText:
|
|
15949
|
+
TabInputText: TextTabInput,
|
|
14768
15950
|
TabInputTextDiff: unsupported,
|
|
14769
15951
|
TabInputCustom: unsupported,
|
|
14770
15952
|
TabInputNotebook: unsupported,
|