@codingame/monaco-vscode-api 1.69.15 → 1.69.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configuration.d.ts +3 -2
- package/dist/configuration.js +36 -9
- package/dist/extHost.js +18 -15
- package/dist/files.js +2 -2
- package/dist/keybindings.js +1 -1
- package/dist/languageConfiguration.js +1 -1
- package/dist/missing-services.js +324 -52
- package/dist/polyfill.js +91 -1
- package/dist/snippets.js +2 -2
- package/dist/theme.js +1 -1
- package/package.json +9 -9
package/dist/configuration.d.ts
CHANGED
|
@@ -481,8 +481,9 @@ interface IColorCustomizations {
|
|
|
481
481
|
[colorIdOrThemeScope: string]: IThemeScopedColorCustomizations | string;
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
-
declare function updateUserConfiguration(configurationJson: string): void
|
|
484
|
+
declare function updateUserConfiguration(configurationJson: string): Promise<void>;
|
|
485
|
+
declare function getUserConfiguration(): Promise<string>;
|
|
485
486
|
declare const configurationRegistry: IConfigurationRegistry;
|
|
486
487
|
declare function getServiceOverride(): IEditorOverrideServices;
|
|
487
488
|
|
|
488
|
-
export { ConfigurationScope, IColorCustomizations, IConfigurationDefaults, IConfigurationNode, IThemeScopedColorCustomizations, configurationRegistry, getServiceOverride as default, updateUserConfiguration };
|
|
489
|
+
export { ConfigurationScope, IColorCustomizations, IConfigurationDefaults, IConfigurationNode, IThemeScopedColorCustomizations, configurationRegistry, getServiceOverride as default, getUserConfiguration, updateUserConfiguration };
|
package/dist/configuration.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { E as Emitter, _ as __decorate, a as __param } from './workspace.js';
|
|
2
2
|
import { U as UserSettings } from './polyfill.js';
|
|
3
|
-
import { e as IPolicyService, N as NullPolicyService } from './missing-services.js';
|
|
3
|
+
import { e as IPolicyService, N as NullPolicyService, s as setProperty } from './missing-services.js';
|
|
4
4
|
import { b as isEmptyObject } from './types.js';
|
|
5
5
|
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
6
|
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
@@ -15,8 +15,8 @@ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
|
15
15
|
import { isArray } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
16
16
|
import { extUriBiasedIgnorePathCase } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
17
17
|
import { RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
18
|
-
import { bf as Position$2, bg as configurationDefaultsSchemaId } from './extHost.js';
|
|
19
|
-
export {
|
|
18
|
+
import { bf as Position$2, bg as keyFromOverrideIdentifiers, bh as configurationDefaultsSchemaId } from './extHost.js';
|
|
19
|
+
export { bi as ConfigurationScope } from './extHost.js';
|
|
20
20
|
import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
|
|
21
21
|
import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
|
|
22
22
|
import { q as IUserDataProfilesService, i as IFileService, j as IWorkbenchEnvironmentService } from './services2.js';
|
|
@@ -31,6 +31,7 @@ import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/comm
|
|
|
31
31
|
import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
|
|
32
32
|
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
33
33
|
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
34
|
+
import { createTextBuffer, TextModel } from 'monaco-editor/esm/vs/editor/common/model/textModel.js';
|
|
34
35
|
function isConfigurationOverrides(thing) {
|
|
35
36
|
return thing
|
|
36
37
|
&& typeof thing === 'object'
|
|
@@ -540,25 +541,51 @@ RegisterConfigurationSchemasContribution = ( (__decorate([
|
|
|
540
541
|
( (__param(1, IWorkbenchEnvironmentService))),
|
|
541
542
|
( (__param(2, IWorkspaceTrustManagementService)))
|
|
542
543
|
], RegisterConfigurationSchemasContribution)));
|
|
543
|
-
function updateUserConfiguration(configurationJson) {
|
|
544
|
+
async function updateUserConfiguration(configurationJson) {
|
|
544
545
|
const userDataProfilesService = StandaloneServices.get(IUserDataProfilesService);
|
|
545
|
-
|
|
546
|
+
await StandaloneServices.get(IFileService).writeFile(userDataProfilesService.defaultProfile.settingsResource, VSBuffer.fromString(configurationJson));
|
|
547
|
+
}
|
|
548
|
+
async function getUserConfiguration() {
|
|
549
|
+
const userDataProfilesService = StandaloneServices.get(IUserDataProfilesService);
|
|
550
|
+
return ( (await StandaloneServices.get(IFileService).readFile(userDataProfilesService.defaultProfile.settingsResource)).value.toString());
|
|
546
551
|
}
|
|
547
552
|
const configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
553
|
+
function updateJsonValue(jsonValue, jsonPath, value, configFileUrl) {
|
|
554
|
+
const creationOptions = StandaloneServices.get(IModelService).getCreationOptions('json', configFileUrl, true);
|
|
555
|
+
const { textBuffer, disposable: bufferDisposable } = createTextBuffer(jsonValue, creationOptions.defaultEOL);
|
|
556
|
+
try {
|
|
557
|
+
const options = TextModel.resolveOptions(textBuffer, creationOptions);
|
|
558
|
+
const edits = setProperty(jsonValue, jsonPath, value, options);
|
|
559
|
+
return edits.reduce((config, edit) => {
|
|
560
|
+
return `${config.slice(0, edit.offset)}${edit.content}${config.slice(edit.offset + edit.length)}`;
|
|
561
|
+
}, jsonValue);
|
|
562
|
+
}
|
|
563
|
+
finally {
|
|
564
|
+
bufferDisposable.dispose();
|
|
565
|
+
}
|
|
566
|
+
}
|
|
548
567
|
let InjectedConfigurationService = class InjectedConfigurationService extends ConfigurationService {
|
|
549
568
|
constructor(userDataProfilesService, fileService, policyService, logService) {
|
|
550
569
|
super(userDataProfilesService.defaultProfile.settingsResource, fileService, policyService, logService);
|
|
570
|
+
this.userDataProfilesService = userDataProfilesService;
|
|
551
571
|
this.initialize().catch(error => {
|
|
552
572
|
logService.error(error);
|
|
553
573
|
});
|
|
554
574
|
}
|
|
555
|
-
updateValue(key, value, arg3, arg4) {
|
|
575
|
+
async updateValue(key, value, arg3, arg4) {
|
|
556
576
|
const overrides = isConfigurationUpdateOverrides(arg3)
|
|
557
577
|
? arg3
|
|
558
578
|
: isConfigurationOverrides(arg3) ? { resource: arg3.resource, overrideIdentifiers: arg3.overrideIdentifier != null ? [arg3.overrideIdentifier] : undefined } : undefined;
|
|
559
|
-
const target = overrides != null ? arg4 : arg3;
|
|
579
|
+
const target = (overrides != null ? arg4 : arg3) ?? 2 ;
|
|
560
580
|
if (target === 8 ) {
|
|
561
|
-
return
|
|
581
|
+
return this['configuration'].updateValue(key, value, overrides);
|
|
582
|
+
}
|
|
583
|
+
if (target === 2 ) {
|
|
584
|
+
const userConfiguration = await getUserConfiguration();
|
|
585
|
+
const jsonPath = overrides?.overrideIdentifiers != null && overrides.overrideIdentifiers.length > 0 ? [keyFromOverrideIdentifiers(overrides.overrideIdentifiers), key] : [key];
|
|
586
|
+
const newConfiguration = updateJsonValue(userConfiguration, jsonPath, value, this.userDataProfilesService.defaultProfile.settingsResource);
|
|
587
|
+
await updateUserConfiguration(newConfiguration);
|
|
588
|
+
return;
|
|
562
589
|
}
|
|
563
590
|
return Promise.reject(new Error('not supported'));
|
|
564
591
|
}
|
|
@@ -581,4 +608,4 @@ function getServiceOverride() {
|
|
|
581
608
|
[( ITextResourceConfigurationService.toString())]: new SyncDescriptor(TextResourceConfigurationService)
|
|
582
609
|
};
|
|
583
610
|
}
|
|
584
|
-
export { configurationRegistry, getServiceOverride as default, updateUserConfiguration };
|
|
611
|
+
export { configurationRegistry, getServiceOverride as default, getUserConfiguration, updateUserConfiguration };
|
package/dist/extHost.js
CHANGED
|
@@ -613,6 +613,9 @@ function overrideIdentifiersFromKey(key) {
|
|
|
613
613
|
}
|
|
614
614
|
return distinct(identifiers);
|
|
615
615
|
}
|
|
616
|
+
function keyFromOverrideIdentifiers(overrideIdentifiers) {
|
|
617
|
+
return overrideIdentifiers.reduce((result, overrideIdentifier) => `${result}[${overrideIdentifier}]`, '');
|
|
618
|
+
}
|
|
616
619
|
function getDefaultValue(type) {
|
|
617
620
|
const t = Array.isArray(type) ? type[0] : type;
|
|
618
621
|
switch (t) {
|
|
@@ -3242,7 +3245,7 @@ let NotebookRange$1 = class NotebookRange {
|
|
|
3242
3245
|
}
|
|
3243
3246
|
}
|
|
3244
3247
|
static isNotebookRange(thing) {
|
|
3245
|
-
if (thing instanceof NotebookRange
|
|
3248
|
+
if (thing instanceof NotebookRange) {
|
|
3246
3249
|
return true;
|
|
3247
3250
|
}
|
|
3248
3251
|
if (!thing) {
|
|
@@ -3273,7 +3276,7 @@ let NotebookRange$1 = class NotebookRange {
|
|
|
3273
3276
|
return this;
|
|
3274
3277
|
}
|
|
3275
3278
|
return (
|
|
3276
|
-
(new NotebookRange
|
|
3279
|
+
(new NotebookRange(start, end))
|
|
3277
3280
|
);
|
|
3278
3281
|
}
|
|
3279
3282
|
};
|
|
@@ -3286,7 +3289,7 @@ let NotebookCellData$1 = class NotebookCellData {
|
|
|
3286
3289
|
this.outputs = outputs ?? [];
|
|
3287
3290
|
this.metadata = metadata;
|
|
3288
3291
|
this.executionSummary = executionSummary;
|
|
3289
|
-
NotebookCellData
|
|
3292
|
+
NotebookCellData.validate(this);
|
|
3290
3293
|
}
|
|
3291
3294
|
static validate(data) {
|
|
3292
3295
|
if (typeof data.kind !== 'number') {
|
|
@@ -3300,7 +3303,7 @@ let NotebookCellData$1 = class NotebookCellData {
|
|
|
3300
3303
|
}
|
|
3301
3304
|
}
|
|
3302
3305
|
static isNotebookCellDataArray(value) {
|
|
3303
|
-
return Array.isArray(value) && value.every(elem => NotebookCellData
|
|
3306
|
+
return Array.isArray(value) && value.every(elem => NotebookCellData.isNotebookCellData(elem));
|
|
3304
3307
|
}
|
|
3305
3308
|
static isNotebookCellData(value) {
|
|
3306
3309
|
return true;
|
|
@@ -3322,7 +3325,7 @@ let NotebookCellOutputItem$1 = class NotebookCellOutputItem {
|
|
|
3322
3325
|
this.mime = mimeNormalized;
|
|
3323
3326
|
}
|
|
3324
3327
|
static isNotebookCellOutputItem(obj) {
|
|
3325
|
-
if (obj instanceof NotebookCellOutputItem
|
|
3328
|
+
if (obj instanceof NotebookCellOutputItem) {
|
|
3326
3329
|
return true;
|
|
3327
3330
|
}
|
|
3328
3331
|
if (!obj) {
|
|
@@ -3337,35 +3340,35 @@ let NotebookCellOutputItem$1 = class NotebookCellOutputItem {
|
|
|
3337
3340
|
message: err.message,
|
|
3338
3341
|
stack: err.stack
|
|
3339
3342
|
};
|
|
3340
|
-
return NotebookCellOutputItem
|
|
3343
|
+
return NotebookCellOutputItem.json(obj, 'application/vnd.code.notebook.error');
|
|
3341
3344
|
}
|
|
3342
3345
|
static stdout(value) {
|
|
3343
|
-
return NotebookCellOutputItem
|
|
3346
|
+
return NotebookCellOutputItem.text(value, 'application/vnd.code.notebook.stdout');
|
|
3344
3347
|
}
|
|
3345
3348
|
static stderr(value) {
|
|
3346
|
-
return NotebookCellOutputItem
|
|
3349
|
+
return NotebookCellOutputItem.text(value, 'application/vnd.code.notebook.stderr');
|
|
3347
3350
|
}
|
|
3348
3351
|
static bytes(value, mime = 'application/octet-stream') {
|
|
3349
3352
|
return (
|
|
3350
|
-
(new NotebookCellOutputItem
|
|
3353
|
+
(new NotebookCellOutputItem(value, mime))
|
|
3351
3354
|
);
|
|
3352
3355
|
}
|
|
3353
3356
|
static text(value, mime = Mimes.text) {
|
|
3354
|
-
const bytes = __classPrivateFieldGet(NotebookCellOutputItem
|
|
3357
|
+
const bytes = __classPrivateFieldGet(NotebookCellOutputItem, _a$1, "f", _NotebookCellOutputItem_encoder).encode(String(value));
|
|
3355
3358
|
return (
|
|
3356
|
-
(new NotebookCellOutputItem
|
|
3359
|
+
(new NotebookCellOutputItem(bytes, mime))
|
|
3357
3360
|
);
|
|
3358
3361
|
}
|
|
3359
3362
|
static json(value, mime = 'text/x-json') {
|
|
3360
3363
|
const rawStr = JSON.stringify(value, undefined, '\t');
|
|
3361
|
-
return NotebookCellOutputItem
|
|
3364
|
+
return NotebookCellOutputItem.text(rawStr, mime);
|
|
3362
3365
|
}
|
|
3363
3366
|
};
|
|
3364
3367
|
_a$1 = NotebookCellOutputItem$1;
|
|
3365
3368
|
_NotebookCellOutputItem_encoder = { value: ( (new TextEncoder())) };
|
|
3366
3369
|
let NotebookCellOutput$1 = class NotebookCellOutput {
|
|
3367
3370
|
constructor(items, idOrMetadata, metadata) {
|
|
3368
|
-
this.items = NotebookCellOutput
|
|
3371
|
+
this.items = NotebookCellOutput.ensureUniqueMimeTypes(items, true);
|
|
3369
3372
|
if (typeof idOrMetadata === 'string') {
|
|
3370
3373
|
this.id = idOrMetadata;
|
|
3371
3374
|
this.metadata = metadata;
|
|
@@ -3376,7 +3379,7 @@ let NotebookCellOutput$1 = class NotebookCellOutput {
|
|
|
3376
3379
|
}
|
|
3377
3380
|
}
|
|
3378
3381
|
static isNotebookCellOutput(candidate) {
|
|
3379
|
-
if (candidate instanceof NotebookCellOutput
|
|
3382
|
+
if (candidate instanceof NotebookCellOutput) {
|
|
3380
3383
|
return true;
|
|
3381
3384
|
}
|
|
3382
3385
|
if (!candidate || typeof candidate !== 'object') {
|
|
@@ -14778,4 +14781,4 @@ function getExtHostServices() {
|
|
|
14778
14781
|
}
|
|
14779
14782
|
return extHostServices;
|
|
14780
14783
|
}
|
|
14781
|
-
export { Position$1 as $, DiagnosticTag$1 as A, Breakpoint as B, CallHierarchyIncomingCall as C, DebugAdapterExecutable as D, Disposable as E, DocumentHighlight$1 as F, DocumentHighlightKind as G, DocumentLink$1 as H, DocumentSymbol$1 as I, EndOfLine$1 as J, EnvironmentVariableMutatorType as K, EvaluatableExpression$1 as L, InlineValueText as M, InlineValueVariableLookup as N, InlineValueEvaluatableExpression as O, ExtensionKind as P, ExtensionMode as Q, FileChangeType as R, FileDecoration as S, FileSystemError as T, FoldingRange$1 as U, FoldingRangeKind$1 as V, FunctionBreakpoint as W, Hover$1 as X, Location as Y, MarkdownString$1 as Z, ParameterInformation$1 as _, CallHierarchyItem$1 as a, QuickPickItemKind as a$, ProcessExecution as a0, ProgressLocation$1 as a1, QuickInputButtons as a2, Range$1 as a3, RelativePattern as a4, Selection$2 as a5, SelectionRange$1 as a6, SemanticTokens as a7, SemanticTokensBuilder as a8, SemanticTokensEdit as a9, TextDocumentChangeReason as aA, ThemeColor as aB, ThemeIcon as aC, TreeItem as aD, TreeItemCollapsibleState as aE, TypeHierarchyItem$1 as aF, UIKind as aG, ViewColumn$1 as aH, WorkspaceEdit$1 as aI, InlayHint as aJ, InlayHintLabelPart as aK, InlayHintKind$1 as aL, NotebookRange$1 as aM, NotebookCellKind$1 as aN, NotebookCellData$1 as aO, NotebookData as aP, NotebookCellStatusBarAlignment as aQ, NotebookCellOutput$1 as aR, NotebookCellOutputItem$1 as aS, NotebookCellStatusBarItem as aT, NotebookControllerAffinity as aU, LinkedEditingRanges as aV, TestRunRequest as aW, TestMessage as aX, TestTag as aY, TestRunProfileKind as aZ, LanguageStatusSeverity as a_, SemanticTokensEdits as aa, SemanticTokensLegend as ab, ShellExecution as ac, ShellQuoting as ad, SignatureHelp$1 as ae, SignatureHelpTriggerKind as af, SignatureInformation$1 as ag, SnippetString as ah, SourceBreakpoint as ai, StatusBarAlignment as aj, SymbolInformation as ak, SymbolKind$1 as al, SymbolTag$1 as am, Task as an, TaskGroup as ao, TaskPanelKind as ap, TaskRevealKind as aq, TaskScope as ar, TerminalLink as as, TerminalLocation as at, TerminalProfile as au, TextDocumentSaveReason as av, TextEdit$1 as aw, TextEditorLineNumbersStyle$1 as ax, TextEditorRevealType$1 as ay, TextEditorSelectionChangeKind as az, CallHierarchyOutgoingCall as b, TextDiffTabInput as b0, CustomEditorTabInput as b1, NotebookEditorTabInput as b2, NotebookDiffEditorTabInput as b3, WebviewEditorTabInput as b4, TerminalEditorTabInput as b5, InputBoxValidationSeverity as b6, InlineSuggestionList as b7, InlineCompletionTriggerKind as b8, InlineSuggestion as b9, DocumentDropEdit as ba, NotebookEditorRevealType as bb, getExtHostServices as bc, DEFAULT_EXTENSION as bd, LanguageSelector as be, Position$2 as bf,
|
|
14784
|
+
export { Position$1 as $, DiagnosticTag$1 as A, Breakpoint as B, CallHierarchyIncomingCall as C, DebugAdapterExecutable as D, Disposable as E, DocumentHighlight$1 as F, DocumentHighlightKind as G, DocumentLink$1 as H, DocumentSymbol$1 as I, EndOfLine$1 as J, EnvironmentVariableMutatorType as K, EvaluatableExpression$1 as L, InlineValueText as M, InlineValueVariableLookup as N, InlineValueEvaluatableExpression as O, ExtensionKind as P, ExtensionMode as Q, FileChangeType as R, FileDecoration as S, FileSystemError as T, FoldingRange$1 as U, FoldingRangeKind$1 as V, FunctionBreakpoint as W, Hover$1 as X, Location as Y, MarkdownString$1 as Z, ParameterInformation$1 as _, CallHierarchyItem$1 as a, QuickPickItemKind as a$, ProcessExecution as a0, ProgressLocation$1 as a1, QuickInputButtons as a2, Range$1 as a3, RelativePattern as a4, Selection$2 as a5, SelectionRange$1 as a6, SemanticTokens as a7, SemanticTokensBuilder as a8, SemanticTokensEdit as a9, TextDocumentChangeReason as aA, ThemeColor as aB, ThemeIcon as aC, TreeItem as aD, TreeItemCollapsibleState as aE, TypeHierarchyItem$1 as aF, UIKind as aG, ViewColumn$1 as aH, WorkspaceEdit$1 as aI, InlayHint as aJ, InlayHintLabelPart as aK, InlayHintKind$1 as aL, NotebookRange$1 as aM, NotebookCellKind$1 as aN, NotebookCellData$1 as aO, NotebookData as aP, NotebookCellStatusBarAlignment as aQ, NotebookCellOutput$1 as aR, NotebookCellOutputItem$1 as aS, NotebookCellStatusBarItem as aT, NotebookControllerAffinity as aU, LinkedEditingRanges as aV, TestRunRequest as aW, TestMessage as aX, TestTag as aY, TestRunProfileKind as aZ, LanguageStatusSeverity as a_, SemanticTokensEdits as aa, SemanticTokensLegend as ab, ShellExecution as ac, ShellQuoting as ad, SignatureHelp$1 as ae, SignatureHelpTriggerKind as af, SignatureInformation$1 as ag, SnippetString as ah, SourceBreakpoint as ai, StatusBarAlignment as aj, SymbolInformation as ak, SymbolKind$1 as al, SymbolTag$1 as am, Task as an, TaskGroup as ao, TaskPanelKind as ap, TaskRevealKind as aq, TaskScope as ar, TerminalLink as as, TerminalLocation as at, TerminalProfile as au, TextDocumentSaveReason as av, TextEdit$1 as aw, TextEditorLineNumbersStyle$1 as ax, TextEditorRevealType$1 as ay, TextEditorSelectionChangeKind as az, CallHierarchyOutgoingCall as b, TextDiffTabInput as b0, CustomEditorTabInput as b1, NotebookEditorTabInput as b2, NotebookDiffEditorTabInput as b3, WebviewEditorTabInput as b4, TerminalEditorTabInput as b5, InputBoxValidationSeverity as b6, InlineSuggestionList as b7, InlineCompletionTriggerKind as b8, InlineSuggestion as b9, DocumentDropEdit as ba, NotebookEditorRevealType as bb, getExtHostServices as bc, DEFAULT_EXTENSION as bd, LanguageSelector as be, Position$2 as bf, keyFromOverrideIdentifiers as bg, configurationDefaultsSchemaId as bh, ConfigurationScope as bi, supportsTelemetry as bj, getTelemetryLevel as bk, Range$2 as bl, CodeAction as c, CodeActionKind as d, CodeActionTriggerKind$1 as e, CodeLens as f, Color$1 as g, ColorInformation as h, ColorPresentation$1 as i, CommentMode as j, CommentThreadCollapsibleState as k, CompletionItem as l, CompletionItemKind$1 as m, CompletionItemTag$1 as n, CompletionList as o, CompletionTriggerKind$1 as p, ConfigurationTarget as q, CustomExecution as r, DebugAdapterInlineImplementation as s, DebugAdapterNamedPipeServer as t, DebugAdapterServer as u, DebugConsoleMode as v, DecorationRangeBehavior$1 as w, Diagnostic$1 as x, DiagnosticRelatedInformation$1 as y, DiagnosticSeverity$1 as z };
|
package/dist/files.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as __decorate, a as __param, E as Emitter } from './workspace.js';
|
|
2
|
-
import { i as isReadableStream,
|
|
2
|
+
import { i as isReadableStream, a as peekStream, b as peekReadable, e as bufferToReadable, s as streamToBuffer, g as consumeStream, t as transform, h as isReadableBufferedStream, l as listenStream, j as bufferedStreamToBuffer, k as readableToBuffer, n as newWriteableBufferStream, m as newWriteableStream } from './polyfill.js';
|
|
3
3
|
import { f as format2, g as getServiceMachineId, R as ResourceQueue, u as unsupported } from './missing-services.js';
|
|
4
4
|
import { i as IFileService, c as IProductService, S as Services, w as FileSystemProviderError, d as FileSystemProviderErrorCode, x as FileChangesEvent, y as FileOperationError, z as hasOpenReadWriteCloseCapability, B as hasReadWriteCapability, D as hasFileReadStreamCapability, E as toFileSystemProviderErrorCode, G as ensureFileSystemProviderError, F as FileType, a as FilePermission, H as etag, J as FileOperationEvent, K as toFileOperationResult, L as ETAG_DISABLED, M as hasFileAtomicReadCapability, N as NotModifiedSinceFileOperationError, O as hasFileFolderCopyCapability, Q as hasFileCloneCapability, R as createFileSystemProviderError, C as CancellationTokenSource } from './services2.js';
|
|
5
5
|
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
@@ -16,7 +16,7 @@ import { CancellationToken } from 'monaco-editor/esm/vs/base/common/cancellation
|
|
|
16
16
|
import { RemoteAuthorities, Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
17
17
|
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
18
18
|
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
19
|
-
import {
|
|
19
|
+
import { bj as supportsTelemetry, bk as getTelemetryLevel, bd as DEFAULT_EXTENSION, E as Disposable$1 } from './extHost.js';
|
|
20
20
|
import { createDecorator } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
21
21
|
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
22
22
|
import { isWeb } from 'monaco-editor/esm/vs/base/common/platform.js';
|
package/dist/keybindings.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h as index, _ as __decorate, a as __param, E as Emitter, j as flatten } from './workspace.js';
|
|
2
|
-
import {
|
|
2
|
+
import { o as parse, q as getNodeType } from './polyfill.js';
|
|
3
3
|
import { i as isProposedApiEnabled, E as ExtensionsRegistry, h as ExtensionMessageCollector, j as IKeyboardLayoutService, I as IExtensionService, k as IPreferencesService, l as getKeyboardLayoutId, m as IUserDataProfileService, M as MacLinuxFallbackKeyboardMapper } from './missing-services.js';
|
|
4
4
|
import { KeyCodeUtils, IMMUTABLE_CODE_TO_KEY_CODE, NATIVE_WINDOWS_KEY_CODE_TO_KEY_CODE, IMMUTABLE_KEY_CODE_TO_CODE } from 'monaco-editor/esm/vs/base/common/keyCodes.js';
|
|
5
5
|
import { SimpleKeybinding, ScanCodeBinding, ChordKeybinding } from 'monaco-editor/esm/vs/base/common/keybindings.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as parse, q as getNodeType } from './polyfill.js';
|
|
2
2
|
import { n as ITextMateService, I as IExtensionService } from './missing-services.js';
|
|
3
3
|
import { _ as __decorate, a as __param } from './workspace.js';
|
|
4
4
|
import { g as getParseErrorMessage } from './jsonErrorMessages.js';
|
package/dist/missing-services.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
|
6
6
|
import { ExtensionIdentifier } from 'monaco-editor/esm/vs/platform/extensions/common/extensions.js';
|
|
7
7
|
import { USLayoutResolvedKeybinding } from 'monaco-editor/esm/vs/platform/keybinding/common/usLayoutResolvedKeybinding.js';
|
|
8
8
|
import { SimpleKeybinding } from 'monaco-editor/esm/vs/base/common/keybindings.js';
|
|
9
|
-
import './polyfill.js';
|
|
9
|
+
import { p as parseTree, f as findNodeAtLocation, c as createScanner } from './polyfill.js';
|
|
10
10
|
import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
|
|
11
11
|
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
12
12
|
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
@@ -315,56 +315,6 @@ const _UUIDPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{
|
|
|
315
315
|
function isUUID(value) {
|
|
316
316
|
return _UUIDPattern.test(value);
|
|
317
317
|
}
|
|
318
|
-
((function () {
|
|
319
|
-
if (typeof crypto === 'object' && typeof crypto.randomUUID === 'function') {
|
|
320
|
-
return crypto.randomUUID.bind(crypto);
|
|
321
|
-
}
|
|
322
|
-
let getRandomValues;
|
|
323
|
-
if (typeof crypto === 'object' && typeof crypto.getRandomValues === 'function') {
|
|
324
|
-
getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
325
|
-
}
|
|
326
|
-
else {
|
|
327
|
-
getRandomValues = function (bucket) {
|
|
328
|
-
for (let i = 0; i < bucket.length; i++) {
|
|
329
|
-
bucket[i] = Math.floor(Math.random() * 256);
|
|
330
|
-
}
|
|
331
|
-
return bucket;
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
const _data = ( (new Uint8Array(16)));
|
|
335
|
-
const _hex = [];
|
|
336
|
-
for (let i = 0; i < 256; i++) {
|
|
337
|
-
_hex.push(( (i.toString(16))).padStart(2, '0'));
|
|
338
|
-
}
|
|
339
|
-
return function generateUuid() {
|
|
340
|
-
getRandomValues(_data);
|
|
341
|
-
_data[6] = (_data[6] & 0x0f) | 0x40;
|
|
342
|
-
_data[8] = (_data[8] & 0x3f) | 0x80;
|
|
343
|
-
let i = 0;
|
|
344
|
-
let result = '';
|
|
345
|
-
result += _hex[_data[i++]];
|
|
346
|
-
result += _hex[_data[i++]];
|
|
347
|
-
result += _hex[_data[i++]];
|
|
348
|
-
result += _hex[_data[i++]];
|
|
349
|
-
result += '-';
|
|
350
|
-
result += _hex[_data[i++]];
|
|
351
|
-
result += _hex[_data[i++]];
|
|
352
|
-
result += '-';
|
|
353
|
-
result += _hex[_data[i++]];
|
|
354
|
-
result += _hex[_data[i++]];
|
|
355
|
-
result += '-';
|
|
356
|
-
result += _hex[_data[i++]];
|
|
357
|
-
result += _hex[_data[i++]];
|
|
358
|
-
result += '-';
|
|
359
|
-
result += _hex[_data[i++]];
|
|
360
|
-
result += _hex[_data[i++]];
|
|
361
|
-
result += _hex[_data[i++]];
|
|
362
|
-
result += _hex[_data[i++]];
|
|
363
|
-
result += _hex[_data[i++]];
|
|
364
|
-
result += _hex[_data[i++]];
|
|
365
|
-
return result;
|
|
366
|
-
};
|
|
367
|
-
}))();
|
|
368
318
|
const IPolicyService = ( (createDecorator('policy')));
|
|
369
319
|
class NullPolicyService {
|
|
370
320
|
constructor() {
|
|
@@ -494,6 +444,328 @@ async function getServiceMachineId(environmentService, fileService, storageServi
|
|
|
494
444
|
storageService?.store('storage.serviceMachineId', uuid, -1 , 1 );
|
|
495
445
|
return uuid;
|
|
496
446
|
}
|
|
447
|
+
function format(documentText, range, options) {
|
|
448
|
+
let initialIndentLevel;
|
|
449
|
+
let formatText;
|
|
450
|
+
let formatTextStart;
|
|
451
|
+
let rangeStart;
|
|
452
|
+
let rangeEnd;
|
|
453
|
+
if (range) {
|
|
454
|
+
rangeStart = range.offset;
|
|
455
|
+
rangeEnd = rangeStart + range.length;
|
|
456
|
+
formatTextStart = rangeStart;
|
|
457
|
+
while (formatTextStart > 0 && !isEOL(documentText, formatTextStart - 1)) {
|
|
458
|
+
formatTextStart--;
|
|
459
|
+
}
|
|
460
|
+
let endOffset = rangeEnd;
|
|
461
|
+
while (endOffset < documentText.length && !isEOL(documentText, endOffset)) {
|
|
462
|
+
endOffset++;
|
|
463
|
+
}
|
|
464
|
+
formatText = documentText.substring(formatTextStart, endOffset);
|
|
465
|
+
initialIndentLevel = computeIndentLevel(formatText, options);
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
formatText = documentText;
|
|
469
|
+
initialIndentLevel = 0;
|
|
470
|
+
formatTextStart = 0;
|
|
471
|
+
rangeStart = 0;
|
|
472
|
+
rangeEnd = documentText.length;
|
|
473
|
+
}
|
|
474
|
+
const eol = getEOL(options, documentText);
|
|
475
|
+
let lineBreak = false;
|
|
476
|
+
let indentLevel = 0;
|
|
477
|
+
let indentValue;
|
|
478
|
+
if (options.insertSpaces) {
|
|
479
|
+
indentValue = repeat(' ', options.tabSize || 4);
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
indentValue = '\t';
|
|
483
|
+
}
|
|
484
|
+
const scanner = createScanner(formatText, false);
|
|
485
|
+
let hasError = false;
|
|
486
|
+
function newLineAndIndent() {
|
|
487
|
+
return eol + repeat(indentValue, initialIndentLevel + indentLevel);
|
|
488
|
+
}
|
|
489
|
+
function scanNext() {
|
|
490
|
+
let token = scanner.scan();
|
|
491
|
+
lineBreak = false;
|
|
492
|
+
while (token === 15 || token === 14 ) {
|
|
493
|
+
lineBreak = lineBreak || ((token === 14) );
|
|
494
|
+
token = scanner.scan();
|
|
495
|
+
}
|
|
496
|
+
hasError = token === 16 || scanner.getTokenError() !== 0 ;
|
|
497
|
+
return token;
|
|
498
|
+
}
|
|
499
|
+
const editOperations = [];
|
|
500
|
+
function addEdit(text, startOffset, endOffset) {
|
|
501
|
+
if (!hasError && startOffset < rangeEnd && endOffset > rangeStart && documentText.substring(startOffset, endOffset) !== text) {
|
|
502
|
+
editOperations.push({ offset: startOffset, length: endOffset - startOffset, content: text });
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
let firstToken = scanNext();
|
|
506
|
+
if (firstToken !== 17 ) {
|
|
507
|
+
const firstTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
508
|
+
const initialIndent = repeat(indentValue, initialIndentLevel);
|
|
509
|
+
addEdit(initialIndent, formatTextStart, firstTokenStart);
|
|
510
|
+
}
|
|
511
|
+
while (firstToken !== 17 ) {
|
|
512
|
+
let firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
513
|
+
let secondToken = scanNext();
|
|
514
|
+
let replaceContent = '';
|
|
515
|
+
while (!lineBreak && ((secondToken === 12 || secondToken === 13) )) {
|
|
516
|
+
const commentTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
517
|
+
addEdit(' ', firstTokenEnd, commentTokenStart);
|
|
518
|
+
firstTokenEnd = scanner.getTokenOffset() + scanner.getTokenLength() + formatTextStart;
|
|
519
|
+
replaceContent = secondToken === 12 ? newLineAndIndent() : '';
|
|
520
|
+
secondToken = scanNext();
|
|
521
|
+
}
|
|
522
|
+
if (secondToken === 2 ) {
|
|
523
|
+
if (firstToken !== 1 ) {
|
|
524
|
+
indentLevel--;
|
|
525
|
+
replaceContent = newLineAndIndent();
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
else if (secondToken === 4 ) {
|
|
529
|
+
if (firstToken !== 3 ) {
|
|
530
|
+
indentLevel--;
|
|
531
|
+
replaceContent = newLineAndIndent();
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
switch (firstToken) {
|
|
536
|
+
case 3 :
|
|
537
|
+
case 1 :
|
|
538
|
+
indentLevel++;
|
|
539
|
+
replaceContent = newLineAndIndent();
|
|
540
|
+
break;
|
|
541
|
+
case 5 :
|
|
542
|
+
case 12 :
|
|
543
|
+
replaceContent = newLineAndIndent();
|
|
544
|
+
break;
|
|
545
|
+
case 13 :
|
|
546
|
+
if (lineBreak) {
|
|
547
|
+
replaceContent = newLineAndIndent();
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
replaceContent = ' ';
|
|
551
|
+
}
|
|
552
|
+
break;
|
|
553
|
+
case 6 :
|
|
554
|
+
replaceContent = ' ';
|
|
555
|
+
break;
|
|
556
|
+
case 10 :
|
|
557
|
+
if (secondToken === 6 ) {
|
|
558
|
+
replaceContent = '';
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
case 7 :
|
|
562
|
+
case 8 :
|
|
563
|
+
case 9 :
|
|
564
|
+
case 11 :
|
|
565
|
+
case 2 :
|
|
566
|
+
case 4 :
|
|
567
|
+
if (secondToken === 12 || secondToken === 13 ) {
|
|
568
|
+
replaceContent = ' ';
|
|
569
|
+
}
|
|
570
|
+
else if (secondToken !== 5 && secondToken !== 17 ) {
|
|
571
|
+
hasError = true;
|
|
572
|
+
}
|
|
573
|
+
break;
|
|
574
|
+
case 16 :
|
|
575
|
+
hasError = true;
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
if (lineBreak && ((secondToken === 12 || secondToken === 13) )) {
|
|
579
|
+
replaceContent = newLineAndIndent();
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
const secondTokenStart = scanner.getTokenOffset() + formatTextStart;
|
|
583
|
+
addEdit(replaceContent, firstTokenEnd, secondTokenStart);
|
|
584
|
+
firstToken = secondToken;
|
|
585
|
+
}
|
|
586
|
+
return editOperations;
|
|
587
|
+
}
|
|
588
|
+
function repeat(s, count) {
|
|
589
|
+
let result = '';
|
|
590
|
+
for (let i = 0; i < count; i++) {
|
|
591
|
+
result += s;
|
|
592
|
+
}
|
|
593
|
+
return result;
|
|
594
|
+
}
|
|
595
|
+
function computeIndentLevel(content, options) {
|
|
596
|
+
let i = 0;
|
|
597
|
+
let nChars = 0;
|
|
598
|
+
const tabSize = options.tabSize || 4;
|
|
599
|
+
while (i < content.length) {
|
|
600
|
+
const ch = content.charAt(i);
|
|
601
|
+
if (ch === ' ') {
|
|
602
|
+
nChars++;
|
|
603
|
+
}
|
|
604
|
+
else if (ch === '\t') {
|
|
605
|
+
nChars += tabSize;
|
|
606
|
+
}
|
|
607
|
+
else {
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
i++;
|
|
611
|
+
}
|
|
612
|
+
return Math.floor(nChars / tabSize);
|
|
613
|
+
}
|
|
614
|
+
function getEOL(options, text) {
|
|
615
|
+
for (let i = 0; i < text.length; i++) {
|
|
616
|
+
const ch = text.charAt(i);
|
|
617
|
+
if (ch === '\r') {
|
|
618
|
+
if (i + 1 < text.length && text.charAt(i + 1) === '\n') {
|
|
619
|
+
return '\r\n';
|
|
620
|
+
}
|
|
621
|
+
return '\r';
|
|
622
|
+
}
|
|
623
|
+
else if (ch === '\n') {
|
|
624
|
+
return '\n';
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
return (options && options.eol) || '\n';
|
|
628
|
+
}
|
|
629
|
+
function isEOL(text, offset) {
|
|
630
|
+
return '\r\n'.indexOf(text.charAt(offset)) !== -1;
|
|
631
|
+
}
|
|
632
|
+
function setProperty(text, originalPath, value, formattingOptions, getInsertionIndex) {
|
|
633
|
+
const path = originalPath.slice();
|
|
634
|
+
const errors = [];
|
|
635
|
+
const root = parseTree(text, errors);
|
|
636
|
+
let parent = undefined;
|
|
637
|
+
let lastSegment = undefined;
|
|
638
|
+
while (path.length > 0) {
|
|
639
|
+
lastSegment = path.pop();
|
|
640
|
+
parent = findNodeAtLocation(root, path);
|
|
641
|
+
if (parent === undefined && value !== undefined) {
|
|
642
|
+
if (typeof lastSegment === 'string') {
|
|
643
|
+
value = { [lastSegment]: value };
|
|
644
|
+
}
|
|
645
|
+
else {
|
|
646
|
+
value = [value];
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
break;
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
if (!parent) {
|
|
654
|
+
if (value === undefined) {
|
|
655
|
+
throw new Error('Can not delete in empty document');
|
|
656
|
+
}
|
|
657
|
+
return withFormatting(text, { offset: root ? root.offset : 0, length: root ? root.length : 0, content: JSON.stringify(value) }, formattingOptions);
|
|
658
|
+
}
|
|
659
|
+
else if (parent.type === 'object' && typeof lastSegment === 'string' && Array.isArray(parent.children)) {
|
|
660
|
+
const existing = findNodeAtLocation(parent, [lastSegment]);
|
|
661
|
+
if (existing !== undefined) {
|
|
662
|
+
if (value === undefined) {
|
|
663
|
+
if (!existing.parent) {
|
|
664
|
+
throw new Error('Malformed AST');
|
|
665
|
+
}
|
|
666
|
+
const propertyIndex = parent.children.indexOf(existing.parent);
|
|
667
|
+
let removeBegin;
|
|
668
|
+
let removeEnd = existing.parent.offset + existing.parent.length;
|
|
669
|
+
if (propertyIndex > 0) {
|
|
670
|
+
const previous = parent.children[propertyIndex - 1];
|
|
671
|
+
removeBegin = previous.offset + previous.length;
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
removeBegin = parent.offset + 1;
|
|
675
|
+
if (parent.children.length > 1) {
|
|
676
|
+
const next = parent.children[1];
|
|
677
|
+
removeEnd = next.offset;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
return withFormatting(text, { offset: removeBegin, length: removeEnd - removeBegin, content: '' }, formattingOptions);
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
return withFormatting(text, { offset: existing.offset, length: existing.length, content: JSON.stringify(value) }, formattingOptions);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
if (value === undefined) {
|
|
688
|
+
return [];
|
|
689
|
+
}
|
|
690
|
+
const newProperty = `${JSON.stringify(lastSegment)}: ${JSON.stringify(value)}`;
|
|
691
|
+
const index = getInsertionIndex ? getInsertionIndex(parent.children.map(p => p.children[0].value)) : parent.children.length;
|
|
692
|
+
let edit;
|
|
693
|
+
if (index > 0) {
|
|
694
|
+
const previous = parent.children[index - 1];
|
|
695
|
+
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
|
|
696
|
+
}
|
|
697
|
+
else if (parent.children.length === 0) {
|
|
698
|
+
edit = { offset: parent.offset + 1, length: 0, content: newProperty };
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
edit = { offset: parent.offset + 1, length: 0, content: newProperty + ',' };
|
|
702
|
+
}
|
|
703
|
+
return withFormatting(text, edit, formattingOptions);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
else if (parent.type === 'array' && typeof lastSegment === 'number' && Array.isArray(parent.children)) {
|
|
707
|
+
if (value !== undefined) {
|
|
708
|
+
const newProperty = `${JSON.stringify(value)}`;
|
|
709
|
+
let edit;
|
|
710
|
+
if (parent.children.length === 0 || lastSegment === 0) {
|
|
711
|
+
edit = { offset: parent.offset + 1, length: 0, content: parent.children.length === 0 ? newProperty : newProperty + ',' };
|
|
712
|
+
}
|
|
713
|
+
else {
|
|
714
|
+
const index = lastSegment === -1 || lastSegment > parent.children.length ? parent.children.length : lastSegment;
|
|
715
|
+
const previous = parent.children[index - 1];
|
|
716
|
+
edit = { offset: previous.offset + previous.length, length: 0, content: ',' + newProperty };
|
|
717
|
+
}
|
|
718
|
+
return withFormatting(text, edit, formattingOptions);
|
|
719
|
+
}
|
|
720
|
+
else {
|
|
721
|
+
const removalIndex = lastSegment;
|
|
722
|
+
const toRemove = parent.children[removalIndex];
|
|
723
|
+
let edit;
|
|
724
|
+
if (parent.children.length === 1) {
|
|
725
|
+
edit = { offset: parent.offset + 1, length: parent.length - 2, content: '' };
|
|
726
|
+
}
|
|
727
|
+
else if (parent.children.length - 1 === removalIndex) {
|
|
728
|
+
const previous = parent.children[removalIndex - 1];
|
|
729
|
+
const offset = previous.offset + previous.length;
|
|
730
|
+
const parentEndOffset = parent.offset + parent.length;
|
|
731
|
+
edit = { offset, length: parentEndOffset - 2 - offset, content: '' };
|
|
732
|
+
}
|
|
733
|
+
else {
|
|
734
|
+
edit = { offset: toRemove.offset, length: parent.children[removalIndex + 1].offset - toRemove.offset, content: '' };
|
|
735
|
+
}
|
|
736
|
+
return withFormatting(text, edit, formattingOptions);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
else {
|
|
740
|
+
throw new Error(`Can not add ${typeof lastSegment !== 'number' ? 'index' : 'property'} to parent of type ${parent.type}`);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
function withFormatting(text, edit, formattingOptions) {
|
|
744
|
+
let newText = applyEdit(text, edit);
|
|
745
|
+
let begin = edit.offset;
|
|
746
|
+
let end = edit.offset + edit.content.length;
|
|
747
|
+
if (edit.length === 0 || edit.content.length === 0) {
|
|
748
|
+
while (begin > 0 && !isEOL(newText, begin - 1)) {
|
|
749
|
+
begin--;
|
|
750
|
+
}
|
|
751
|
+
while (end < newText.length && !isEOL(newText, end)) {
|
|
752
|
+
end++;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
const edits = format(newText, { offset: begin, length: end - begin }, formattingOptions);
|
|
756
|
+
for (let i = edits.length - 1; i >= 0; i--) {
|
|
757
|
+
const curr = edits[i];
|
|
758
|
+
newText = applyEdit(newText, curr);
|
|
759
|
+
begin = Math.min(begin, curr.offset);
|
|
760
|
+
end = Math.max(end, curr.offset + curr.length);
|
|
761
|
+
end += curr.content.length - curr.length;
|
|
762
|
+
}
|
|
763
|
+
const editLength = text.length - (newText.length - end) - begin;
|
|
764
|
+
return [{ offset: begin, length: editLength, content: newText.substring(begin, end) }];
|
|
765
|
+
}
|
|
766
|
+
function applyEdit(text, edit) {
|
|
767
|
+
return text.substring(0, edit.offset) + edit.content + text.substring(edit.offset + edit.length);
|
|
768
|
+
}
|
|
497
769
|
const IBrowserWorkbenchEnvironmentService = refineServiceDecorator(IEnvironmentService);
|
|
498
770
|
const allApiProposals = ( (Object.freeze({
|
|
499
771
|
authSession: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.authSession.d.ts',
|
|
@@ -1887,4 +2159,4 @@ registerSingleton(ISnippetsService, class SnippetsService {
|
|
|
1887
2159
|
this.getSnippetsSync = unsupported;
|
|
1888
2160
|
}
|
|
1889
2161
|
});
|
|
1890
|
-
export { Barrier as B, ExtensionsRegistry as E, IExtensionService as I, MacLinuxFallbackKeyboardMapper as M, NullPolicyService as N, ResourceQueue as R, Sequencer as S, IntervalCounter as a, ILifecycleService as b, checkProposedApiEnabled as c, ILanguageDetectionService as d, IPolicyService as e, format2 as f, getServiceMachineId as g, ExtensionMessageCollector as h, isProposedApiEnabled as i, IKeyboardLayoutService as j, IPreferencesService as k, getKeyboardLayoutId as l, IUserDataProfileService as m, ITextMateService as n, IBrowserWorkbenchEnvironmentService as o, IHostColorSchemeService as p, IUserDataInitializationService as q, raceCancellationError as r, unsupported as u };
|
|
2162
|
+
export { Barrier as B, ExtensionsRegistry as E, IExtensionService as I, MacLinuxFallbackKeyboardMapper as M, NullPolicyService as N, ResourceQueue as R, Sequencer as S, IntervalCounter as a, ILifecycleService as b, checkProposedApiEnabled as c, ILanguageDetectionService as d, IPolicyService as e, format2 as f, getServiceMachineId as g, ExtensionMessageCollector as h, isProposedApiEnabled as i, IKeyboardLayoutService as j, IPreferencesService as k, getKeyboardLayoutId as l, IUserDataProfileService as m, ITextMateService as n, IBrowserWorkbenchEnvironmentService as o, IHostColorSchemeService as p, IUserDataInitializationService as q, raceCancellationError as r, setProperty as s, unsupported as u };
|
package/dist/polyfill.js
CHANGED
|
@@ -1306,6 +1306,96 @@ function parse(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
1306
1306
|
visit(text, visitor, options);
|
|
1307
1307
|
return currentParent[0];
|
|
1308
1308
|
}
|
|
1309
|
+
function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
1310
|
+
let currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: undefined };
|
|
1311
|
+
function ensurePropertyComplete(endOffset) {
|
|
1312
|
+
if (currentParent.type === 'property') {
|
|
1313
|
+
currentParent.length = endOffset - currentParent.offset;
|
|
1314
|
+
currentParent = currentParent.parent;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
function onValue(valueNode) {
|
|
1318
|
+
currentParent.children.push(valueNode);
|
|
1319
|
+
return valueNode;
|
|
1320
|
+
}
|
|
1321
|
+
const visitor = {
|
|
1322
|
+
onObjectBegin: (offset) => {
|
|
1323
|
+
currentParent = onValue({ type: 'object', offset, length: -1, parent: currentParent, children: [] });
|
|
1324
|
+
},
|
|
1325
|
+
onObjectProperty: (name, offset, length) => {
|
|
1326
|
+
currentParent = onValue({ type: 'property', offset, length: -1, parent: currentParent, children: [] });
|
|
1327
|
+
currentParent.children.push({ type: 'string', value: name, offset, length, parent: currentParent });
|
|
1328
|
+
},
|
|
1329
|
+
onObjectEnd: (offset, length) => {
|
|
1330
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
1331
|
+
currentParent = currentParent.parent;
|
|
1332
|
+
ensurePropertyComplete(offset + length);
|
|
1333
|
+
},
|
|
1334
|
+
onArrayBegin: (offset, length) => {
|
|
1335
|
+
currentParent = onValue({ type: 'array', offset, length: -1, parent: currentParent, children: [] });
|
|
1336
|
+
},
|
|
1337
|
+
onArrayEnd: (offset, length) => {
|
|
1338
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
1339
|
+
currentParent = currentParent.parent;
|
|
1340
|
+
ensurePropertyComplete(offset + length);
|
|
1341
|
+
},
|
|
1342
|
+
onLiteralValue: (value, offset, length) => {
|
|
1343
|
+
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
1344
|
+
ensurePropertyComplete(offset + length);
|
|
1345
|
+
},
|
|
1346
|
+
onSeparator: (sep, offset, length) => {
|
|
1347
|
+
if (currentParent.type === 'property') {
|
|
1348
|
+
if (sep === ':') {
|
|
1349
|
+
currentParent.colonOffset = offset;
|
|
1350
|
+
}
|
|
1351
|
+
else if (sep === ',') {
|
|
1352
|
+
ensurePropertyComplete(offset);
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
},
|
|
1356
|
+
onError: (error, offset, length) => {
|
|
1357
|
+
errors.push({ error, offset, length });
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
visit(text, visitor, options);
|
|
1361
|
+
const result = currentParent.children[0];
|
|
1362
|
+
if (result) {
|
|
1363
|
+
delete result.parent;
|
|
1364
|
+
}
|
|
1365
|
+
return result;
|
|
1366
|
+
}
|
|
1367
|
+
function findNodeAtLocation(root, path) {
|
|
1368
|
+
if (!root) {
|
|
1369
|
+
return undefined;
|
|
1370
|
+
}
|
|
1371
|
+
let node = root;
|
|
1372
|
+
for (const segment of path) {
|
|
1373
|
+
if (typeof segment === 'string') {
|
|
1374
|
+
if (node.type !== 'object' || !Array.isArray(node.children)) {
|
|
1375
|
+
return undefined;
|
|
1376
|
+
}
|
|
1377
|
+
let found = false;
|
|
1378
|
+
for (const propertyNode of node.children) {
|
|
1379
|
+
if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment) {
|
|
1380
|
+
node = propertyNode.children[1];
|
|
1381
|
+
found = true;
|
|
1382
|
+
break;
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
if (!found) {
|
|
1386
|
+
return undefined;
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
else {
|
|
1390
|
+
const index = segment;
|
|
1391
|
+
if (node.type !== 'array' || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
|
|
1392
|
+
return undefined;
|
|
1393
|
+
}
|
|
1394
|
+
node = node.children[index];
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
return node;
|
|
1398
|
+
}
|
|
1309
1399
|
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
1310
1400
|
const _scanner = createScanner(text, false);
|
|
1311
1401
|
function toNoArgVisit(visitFunction) {
|
|
@@ -5467,4 +5557,4 @@ function toVSCodeColor(value) {
|
|
|
5467
5557
|
return value;
|
|
5468
5558
|
}
|
|
5469
5559
|
polyfillPrototype(Color$1.prototype, Color.prototype, toMonacoColor, toVSCodeColor);
|
|
5470
|
-
export { ConsoleMainLogger as C, NotImplementedError as N, ResourceSet as R, UserSettings as U,
|
|
5560
|
+
export { ConsoleMainLogger as C, NotImplementedError as N, ResourceSet as R, UserSettings as U, peekStream as a, peekReadable as b, createScanner as c, disposed as d, bufferToReadable as e, findNodeAtLocation as f, consumeStream as g, isReadableBufferedStream as h, isReadableStream as i, bufferedStreamToBuffer as j, readableToBuffer as k, listenStream as l, newWriteableStream as m, newWriteableBufferStream as n, parse as o, parseTree as p, getNodeType as q, readonly as r, streamToBuffer as s, transform as t };
|
package/dist/snippets.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as parse, q as getNodeType } from './polyfill.js';
|
|
2
2
|
import { h as ExtensionMessageCollector, m as IUserDataProfileService, b as ILifecycleService, E as ExtensionsRegistry } from './missing-services.js';
|
|
3
3
|
import { r as ISnippetsService, S as Services, i as IFileService, h as ITextFileService } from './services2.js';
|
|
4
4
|
import { _ as __decorate, a as __param } from './workspace.js';
|
|
@@ -13,7 +13,7 @@ import { SnippetParser, Placeholder, Variable, Text } from 'monaco-editor/esm/vs
|
|
|
13
13
|
import { tail, insertInto } from 'monaco-editor/esm/vs/base/common/arrays.js';
|
|
14
14
|
import { KnownSnippetVariableNames } from 'monaco-editor/esm/vs/editor/contrib/snippet/browser/snippetVariables.js';
|
|
15
15
|
import { l as languagesExtPoint } from './languageService.js';
|
|
16
|
-
import { bd as DEFAULT_EXTENSION,
|
|
16
|
+
import { bd as DEFAULT_EXTENSION, bl as Range$2 } from './extHost.js';
|
|
17
17
|
import { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
18
18
|
import { getWordAtText } from 'monaco-editor/esm/vs/editor/common/core/wordHelper.js';
|
|
19
19
|
import { isPatternInWord } from 'monaco-editor/esm/vs/base/common/filters.js';
|
package/dist/theme.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as parse$1, q as getNodeType } from './polyfill.js';
|
|
2
2
|
import { E as ExtensionsRegistry, h as ExtensionMessageCollector, S as Sequencer, I as IExtensionService, o as IBrowserWorkbenchEnvironmentService, p as IHostColorSchemeService, q as IUserDataInitializationService } from './missing-services.js';
|
|
3
3
|
import { E as Emitter, _ as __decorate, a as __param } from './workspace.js';
|
|
4
4
|
import { T as ThemeSettings, E as ExtensionData, V as VS_DARK_THEME, a as VS_LIGHT_THEME, b as VS_HC_THEME, c as VS_HC_LIGHT_THEME, d as THEME_SCOPE_OPEN_PAREN, e as THEME_SCOPE_CLOSE_PAREN, f as THEME_SCOPE_WILDCARD, t as themeScopeRegex } from './workbenchThemeService.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-api",
|
|
3
|
-
"version": "1.69.
|
|
3
|
+
"version": "1.69.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "VSCode public API plugged on the monaco editor",
|
|
6
6
|
"keywords": [],
|
|
@@ -143,12 +143,12 @@
|
|
|
143
143
|
"devDependencies": {
|
|
144
144
|
"@babel/core": "^7.20.12",
|
|
145
145
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
146
|
-
"@babel/plugin-proposal-decorators": "^7.20.
|
|
146
|
+
"@babel/plugin-proposal-decorators": "^7.20.13",
|
|
147
147
|
"@babel/preset-env": "^7.20.2",
|
|
148
148
|
"@babel/preset-typescript": "^7.18.6",
|
|
149
149
|
"@codingame/eslint-config": "^1.1.6",
|
|
150
150
|
"@codingame/tsconfig": "^1.1.1",
|
|
151
|
-
"@octokit/rest": "^19.0.
|
|
151
|
+
"@octokit/rest": "^19.0.7",
|
|
152
152
|
"@rollup/plugin-dynamic-import-vars": "^2.0.3",
|
|
153
153
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
154
154
|
"@rollup/plugin-replace": "^5.0.2",
|
|
@@ -156,9 +156,9 @@
|
|
|
156
156
|
"@types/babel__core": "^7.20.0",
|
|
157
157
|
"@types/semver": "^7.3.13",
|
|
158
158
|
"@types/vscode": "~1.69.1",
|
|
159
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
160
|
-
"@typescript-eslint/parser": "^5.
|
|
161
|
-
"eslint": "^8.
|
|
159
|
+
"@typescript-eslint/eslint-plugin": "^5.50.0",
|
|
160
|
+
"@typescript-eslint/parser": "^5.50.0",
|
|
161
|
+
"eslint": "^8.33.0",
|
|
162
162
|
"eslint-config-standard": "^17.0.0",
|
|
163
163
|
"eslint-plugin-import": "^2.27.5",
|
|
164
164
|
"eslint-plugin-n": "^15.6.1",
|
|
@@ -166,12 +166,12 @@
|
|
|
166
166
|
"eslint-plugin-unused-imports": "^2.0.0",
|
|
167
167
|
"js-cleanup": "^1.2.0",
|
|
168
168
|
"recast": "^0.22.0",
|
|
169
|
-
"rollup": "^3.
|
|
169
|
+
"rollup": "^3.12.1",
|
|
170
170
|
"rollup-plugin-dts": "^5.1.1",
|
|
171
171
|
"rollup-plugin-styles": "^4.0.0",
|
|
172
172
|
"semver": "^7.3.8",
|
|
173
173
|
"ts-node": "^10.9.1",
|
|
174
|
-
"typescript": "^4.9.
|
|
174
|
+
"typescript": "^4.9.5",
|
|
175
175
|
"zx": "^7.1.1"
|
|
176
176
|
},
|
|
177
177
|
"dependencies": {},
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
},
|
|
183
183
|
"overrides": {
|
|
184
184
|
"rollup-plugin-styles": {
|
|
185
|
-
"rollup": "3.
|
|
185
|
+
"rollup": "3.12.1"
|
|
186
186
|
}
|
|
187
187
|
},
|
|
188
188
|
"volta": {
|