monaco-editor-core 0.55.0-dev-20251107 → 0.55.0-rc
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/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +1 -1
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/editor/common/config/editorOptions.js +1 -1
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/contrib/format/browser/format.js +3 -7
- package/esm/vs/editor/contrib/format/browser/format.js.map +1 -1
- package/package.json +2 -2
- package/version.txt +1 -1
|
@@ -314,15 +314,11 @@ export function getOnTypeFormattingEdits(workerService, languageFeaturesService,
|
|
|
314
314
|
return workerService.computeMoreMinimalEdits(model.uri, edits);
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
|
|
318
|
-
const candidate = obj;
|
|
319
|
-
return !!candidate && typeof candidate === 'object' && typeof candidate.tabSize === 'number' && typeof candidate.insertSpaces === 'boolean';
|
|
320
|
-
}
|
|
317
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
321
318
|
CommandsRegistry.registerCommand('_executeFormatRangeProvider', async function (accessor, ...args) {
|
|
322
319
|
const [resource, range, options] = args;
|
|
323
320
|
assertType(URI.isUri(resource));
|
|
324
321
|
assertType(Range.isIRange(range));
|
|
325
|
-
assertType(isFormattingOptions(options));
|
|
326
322
|
const resolverService = accessor.get(ITextModelService);
|
|
327
323
|
const workerService = accessor.get(IEditorWorkerService);
|
|
328
324
|
const languageFeaturesService = accessor.get(ILanguageFeaturesService);
|
|
@@ -334,10 +330,10 @@ CommandsRegistry.registerCommand('_executeFormatRangeProvider', async function (
|
|
|
334
330
|
reference.dispose();
|
|
335
331
|
}
|
|
336
332
|
});
|
|
333
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
337
334
|
CommandsRegistry.registerCommand('_executeFormatDocumentProvider', async function (accessor, ...args) {
|
|
338
335
|
const [resource, options] = args;
|
|
339
336
|
assertType(URI.isUri(resource));
|
|
340
|
-
assertType(isFormattingOptions(options));
|
|
341
337
|
const resolverService = accessor.get(ITextModelService);
|
|
342
338
|
const workerService = accessor.get(IEditorWorkerService);
|
|
343
339
|
const languageFeaturesService = accessor.get(ILanguageFeaturesService);
|
|
@@ -349,12 +345,12 @@ CommandsRegistry.registerCommand('_executeFormatDocumentProvider', async functio
|
|
|
349
345
|
reference.dispose();
|
|
350
346
|
}
|
|
351
347
|
});
|
|
348
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
352
349
|
CommandsRegistry.registerCommand('_executeFormatOnTypeProvider', async function (accessor, ...args) {
|
|
353
350
|
const [resource, position, ch, options] = args;
|
|
354
351
|
assertType(URI.isUri(resource));
|
|
355
352
|
assertType(Position.isIPosition(position));
|
|
356
353
|
assertType(typeof ch === 'string');
|
|
357
|
-
assertType(isFormattingOptions(options));
|
|
358
354
|
const resolverService = accessor.get(ITextModelService);
|
|
359
355
|
const workerService = accessor.get(IEditorWorkerService);
|
|
360
356
|
const languageFeaturesService = accessor.get(ILanguageFeaturesService);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/format/browser/format.ts","vs/editor/contrib/format/browser/format.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,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C;YAAS,CAAC;QACV,SAAS,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACF,CAAC,CAAC,CAAC","file":"format.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { asArray, isNonEmptyArray } from '../../../../base/common/arrays.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../../base/common/cancellation.js';\nimport { onUnexpectedExternalError } from '../../../../base/common/errors.js';\nimport { Iterable } from '../../../../base/common/iterator.js';\nimport { IDisposable } from '../../../../base/common/lifecycle.js';\nimport { LinkedList } from '../../../../base/common/linkedList.js';\nimport { assertType } from '../../../../base/common/types.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { CodeEditorStateFlag, EditorStateCancellationTokenSource, TextModelCancellationTokenSource } from '../../editorState/browser/editorState.js';\nimport { IActiveCodeEditor, isCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ServicesAccessor } from '../../../browser/editorExtensions.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { Selection } from '../../../common/core/selection.js';\nimport { ScrollType } from '../../../common/editorCommon.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { DocumentFormattingEditProvider, DocumentRangeFormattingEditProvider, FormattingOptions, TextEdit } from '../../../common/languages.js';\nimport { IEditorWorkerService } from '../../../common/services/editorWorker.js';\nimport { ITextModelService } from '../../../common/services/resolverService.js';\nimport { FormattingEdit } from './formattingEdit.js';\nimport { CommandsRegistry } from '../../../../platform/commands/common/commands.js';\nimport { ExtensionIdentifierSet } from '../../../../platform/extensions/common/extensions.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IProgress } from '../../../../platform/progress/common/progress.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { LanguageFeatureRegistry } from '../../../common/languageFeatureRegistry.js';\nimport { ILogService } from '../../../../platform/log/common/log.js';\nimport { AccessibilitySignal, IAccessibilitySignalService } from '../../../../platform/accessibilitySignal/browser/accessibilitySignalService.js';\n\nexport function getRealAndSyntheticDocumentFormattersOrdered(\n\tdocumentFormattingEditProvider: LanguageFeatureRegistry<DocumentFormattingEditProvider>,\n\tdocumentRangeFormattingEditProvider: LanguageFeatureRegistry<DocumentRangeFormattingEditProvider>,\n\tmodel: ITextModel\n): DocumentFormattingEditProvider[] {\n\tconst result: DocumentFormattingEditProvider[] = [];\n\tconst seen = new ExtensionIdentifierSet();\n\n\t// (1) add all document formatter\n\tconst docFormatter = documentFormattingEditProvider.ordered(model);\n\tfor (const formatter of docFormatter) {\n\t\tresult.push(formatter);\n\t\tif (formatter.extensionId) {\n\t\t\tseen.add(formatter.extensionId);\n\t\t}\n\t}\n\n\t// (2) add all range formatter as document formatter (unless the same extension already did that)\n\tconst rangeFormatter = documentRangeFormattingEditProvider.ordered(model);\n\tfor (const formatter of rangeFormatter) {\n\t\tif (formatter.extensionId) {\n\t\t\tif (seen.has(formatter.extensionId)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseen.add(formatter.extensionId);\n\t\t}\n\t\tresult.push({\n\t\t\tdisplayName: formatter.displayName,\n\t\t\textensionId: formatter.extensionId,\n\t\t\tprovideDocumentFormattingEdits(model, options, token) {\n\t\t\t\treturn formatter.provideDocumentRangeFormattingEdits(model, model.getFullModelRange(), options, token);\n\t\t\t}\n\t\t});\n\t}\n\treturn result;\n}\n\nexport const enum FormattingKind {\n\tFile = 1,\n\tSelection = 2\n}\n\nexport const enum FormattingMode {\n\tExplicit = 1,\n\tSilent = 2\n}\n\nexport interface IFormattingEditProviderSelector {\n\t<T extends (DocumentFormattingEditProvider | DocumentRangeFormattingEditProvider)>(formatter: T[], document: ITextModel, mode: FormattingMode, kind: FormattingKind): Promise<T | undefined>;\n}\n\nexport abstract class FormattingConflicts {\n\n\tprivate static readonly _selectors = new LinkedList<IFormattingEditProviderSelector>();\n\n\tstatic setFormatterSelector(selector: IFormattingEditProviderSelector): IDisposable {\n\t\tconst remove = FormattingConflicts._selectors.unshift(selector);\n\t\treturn { dispose: remove };\n\t}\n\n\tstatic async select<T extends (DocumentFormattingEditProvider | DocumentRangeFormattingEditProvider)>(formatter: T[], document: ITextModel, mode: FormattingMode, kind: FormattingKind): Promise<T | undefined> {\n\t\tif (formatter.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst selector = Iterable.first(FormattingConflicts._selectors);\n\t\tif (selector) {\n\t\t\treturn await selector(formatter, document, mode, kind);\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\nexport async function formatDocumentRangesWithSelectedProvider(\n\taccessor: ServicesAccessor,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\trangeOrRanges: Range | Range[],\n\tmode: FormattingMode,\n\tprogress: IProgress<DocumentRangeFormattingEditProvider>,\n\ttoken: CancellationToken,\n\tuserGesture: boolean\n): Promise<void> {\n\n\tconst instaService = accessor.get(IInstantiationService);\n\tconst { documentRangeFormattingEditProvider: documentRangeFormattingEditProviderRegistry } = accessor.get(ILanguageFeaturesService);\n\tconst model = isCodeEditor(editorOrModel) ? editorOrModel.getModel() : editorOrModel;\n\tconst provider = documentRangeFormattingEditProviderRegistry.ordered(model);\n\tconst selected = await FormattingConflicts.select(provider, model, mode, FormattingKind.Selection);\n\tif (selected) {\n\t\tprogress.report(selected);\n\t\tawait instaService.invokeFunction(formatDocumentRangesWithProvider, selected, editorOrModel, rangeOrRanges, token, userGesture);\n\t}\n}\n\nexport async function formatDocumentRangesWithProvider(\n\taccessor: ServicesAccessor,\n\tprovider: DocumentRangeFormattingEditProvider,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\trangeOrRanges: Range | Range[],\n\ttoken: CancellationToken,\n\tuserGesture: boolean\n): Promise<boolean> {\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst logService = accessor.get(ILogService);\n\tconst accessibilitySignalService = accessor.get(IAccessibilitySignalService);\n\n\tlet model: ITextModel;\n\tlet cts: CancellationTokenSource;\n\tif (isCodeEditor(editorOrModel)) {\n\t\tmodel = editorOrModel.getModel();\n\t\tcts = new EditorStateCancellationTokenSource(editorOrModel, CodeEditorStateFlag.Value | CodeEditorStateFlag.Position, undefined, token);\n\t} else {\n\t\tmodel = editorOrModel;\n\t\tcts = new TextModelCancellationTokenSource(editorOrModel, token);\n\t}\n\n\t// make sure that ranges don't overlap nor touch each other\n\tconst ranges: Range[] = [];\n\tlet len = 0;\n\tfor (const range of asArray(rangeOrRanges).sort(Range.compareRangesUsingStarts)) {\n\t\tif (len > 0 && Range.areIntersectingOrTouching(ranges[len - 1], range)) {\n\t\t\tranges[len - 1] = Range.fromPositions(ranges[len - 1].getStartPosition(), range.getEndPosition());\n\t\t} else {\n\t\t\tlen = ranges.push(range);\n\t\t}\n\t}\n\n\tconst computeEdits = async (range: Range) => {\n\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (request)`, provider.extensionId?.value, range);\n\n\t\tconst result = (await provider.provideDocumentRangeFormattingEdits(\n\t\t\tmodel,\n\t\t\trange,\n\t\t\tmodel.getFormattingOptions(),\n\t\t\tcts.token\n\t\t)) || [];\n\n\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (response)`, provider.extensionId?.value, result);\n\n\t\treturn result;\n\t};\n\n\tconst hasIntersectingEdit = (a: TextEdit[], b: TextEdit[]) => {\n\t\tif (!a.length || !b.length) {\n\t\t\treturn false;\n\t\t}\n\t\t// quick exit if the list of ranges are completely unrelated [O(n)]\n\t\tconst mergedA = a.reduce((acc, val) => { return Range.plusRange(acc, val.range); }, a[0].range);\n\t\tif (!b.some(x => { return Range.intersectRanges(mergedA, x.range); })) {\n\t\t\treturn false;\n\t\t}\n\t\t// fallback to a complete check [O(n^2)]\n\t\tfor (const edit of a) {\n\t\t\tfor (const otherEdit of b) {\n\t\t\t\tif (Range.intersectRanges(edit.range, otherEdit.range)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t};\n\n\tconst allEdits: TextEdit[] = [];\n\tconst rawEditsList: TextEdit[][] = [];\n\ttry {\n\t\tif (typeof provider.provideDocumentRangesFormattingEdits === 'function') {\n\t\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (request)`, provider.extensionId?.value, ranges);\n\t\t\tconst result = (await provider.provideDocumentRangesFormattingEdits(\n\t\t\t\tmodel,\n\t\t\t\tranges,\n\t\t\t\tmodel.getFormattingOptions(),\n\t\t\t\tcts.token\n\t\t\t)) || [];\n\t\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (response)`, provider.extensionId?.value, result);\n\t\t\trawEditsList.push(result);\n\t\t} else {\n\n\t\t\tfor (const range of ranges) {\n\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\trawEditsList.push(await computeEdits(range));\n\t\t\t}\n\n\t\t\tfor (let i = 0; i < ranges.length; ++i) {\n\t\t\t\tfor (let j = i + 1; j < ranges.length; ++j) {\n\t\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (hasIntersectingEdit(rawEditsList[i], rawEditsList[j])) {\n\t\t\t\t\t\t// Merge ranges i and j into a single range, recompute the associated edits\n\t\t\t\t\t\tconst mergedRange = Range.plusRange(ranges[i], ranges[j]);\n\t\t\t\t\t\tconst edits = await computeEdits(mergedRange);\n\t\t\t\t\t\tranges.splice(j, 1);\n\t\t\t\t\t\tranges.splice(i, 1);\n\t\t\t\t\t\tranges.push(mergedRange);\n\t\t\t\t\t\trawEditsList.splice(j, 1);\n\t\t\t\t\t\trawEditsList.splice(i, 1);\n\t\t\t\t\t\trawEditsList.push(edits);\n\t\t\t\t\t\t// Restart scanning\n\t\t\t\t\t\ti = 0;\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const rawEdits of rawEditsList) {\n\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tconst minimalEdits = await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t\tif (minimalEdits) {\n\t\t\t\tallEdits.push(...minimalEdits);\n\t\t\t}\n\t\t}\n\n\t\tif (cts.token.isCancellationRequested) {\n\t\t\treturn true;\n\t\t}\n\t} finally {\n\t\tcts.dispose();\n\t}\n\n\tif (allEdits.length === 0) {\n\t\treturn false;\n\t}\n\n\tif (isCodeEditor(editorOrModel)) {\n\t\t// use editor to apply edits\n\t\tFormattingEdit.execute(editorOrModel, allEdits, true);\n\t\teditorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate);\n\n\t} else {\n\t\t// use model to apply edits\n\t\tconst [{ range }] = allEdits;\n\t\tconst initialSelection = new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n\t\tmodel.pushEditOperations([initialSelection], allEdits.map(edit => {\n\t\t\treturn {\n\t\t\t\ttext: edit.text,\n\t\t\t\trange: Range.lift(edit.range),\n\t\t\t\tforceMoveMarkers: true\n\t\t\t};\n\t\t}), undoEdits => {\n\t\t\tfor (const { range } of undoEdits) {\n\t\t\t\tif (Range.areIntersectingOrTouching(range, initialSelection)) {\n\t\t\t\t\treturn [new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn)];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t});\n\t}\n\taccessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture });\n\treturn true;\n}\n\nexport async function formatDocumentWithSelectedProvider(\n\taccessor: ServicesAccessor,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\tmode: FormattingMode,\n\tprogress: IProgress<DocumentFormattingEditProvider>,\n\ttoken: CancellationToken,\n\tuserGesture?: boolean\n): Promise<void> {\n\n\tconst instaService = accessor.get(IInstantiationService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst model = isCodeEditor(editorOrModel) ? editorOrModel.getModel() : editorOrModel;\n\tconst provider = getRealAndSyntheticDocumentFormattersOrdered(languageFeaturesService.documentFormattingEditProvider, languageFeaturesService.documentRangeFormattingEditProvider, model);\n\tconst selected = await FormattingConflicts.select(provider, model, mode, FormattingKind.File);\n\tif (selected) {\n\t\tprogress.report(selected);\n\t\tawait instaService.invokeFunction(formatDocumentWithProvider, selected, editorOrModel, mode, token, userGesture);\n\t}\n}\n\nexport async function formatDocumentWithProvider(\n\taccessor: ServicesAccessor,\n\tprovider: DocumentFormattingEditProvider,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\tmode: FormattingMode,\n\ttoken: CancellationToken,\n\tuserGesture?: boolean\n): Promise<boolean> {\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst accessibilitySignalService = accessor.get(IAccessibilitySignalService);\n\n\tlet model: ITextModel;\n\tlet cts: CancellationTokenSource;\n\tif (isCodeEditor(editorOrModel)) {\n\t\tmodel = editorOrModel.getModel();\n\t\tcts = new EditorStateCancellationTokenSource(editorOrModel, CodeEditorStateFlag.Value | CodeEditorStateFlag.Position, undefined, token);\n\t} else {\n\t\tmodel = editorOrModel;\n\t\tcts = new TextModelCancellationTokenSource(editorOrModel, token);\n\t}\n\n\tlet edits: TextEdit[] | undefined;\n\ttry {\n\t\tconst rawEdits = await provider.provideDocumentFormattingEdits(\n\t\t\tmodel,\n\t\t\tmodel.getFormattingOptions(),\n\t\t\tcts.token\n\t\t);\n\n\t\tedits = await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\n\t\tif (cts.token.isCancellationRequested) {\n\t\t\treturn true;\n\t\t}\n\n\t} finally {\n\t\tcts.dispose();\n\t}\n\n\tif (!edits || edits.length === 0) {\n\t\treturn false;\n\t}\n\n\tif (isCodeEditor(editorOrModel)) {\n\t\t// use editor to apply edits\n\t\tFormattingEdit.execute(editorOrModel, edits, mode !== FormattingMode.Silent);\n\n\t\tif (mode !== FormattingMode.Silent) {\n\t\t\teditorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate);\n\t\t}\n\n\t} else {\n\t\t// use model to apply edits\n\t\tconst [{ range }] = edits;\n\t\tconst initialSelection = new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n\t\tmodel.pushEditOperations([initialSelection], edits.map(edit => {\n\t\t\treturn {\n\t\t\t\ttext: edit.text,\n\t\t\t\trange: Range.lift(edit.range),\n\t\t\t\tforceMoveMarkers: true\n\t\t\t};\n\t\t}), undoEdits => {\n\t\t\tfor (const { range } of undoEdits) {\n\t\t\t\tif (Range.areIntersectingOrTouching(range, initialSelection)) {\n\t\t\t\t\treturn [new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn)];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t});\n\t}\n\taccessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture });\n\treturn true;\n}\n\nexport async function getDocumentRangeFormattingEditsUntilResult(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\trange: Range,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | undefined> {\n\n\tconst providers = languageFeaturesService.documentRangeFormattingEditProvider.ordered(model);\n\tfor (const provider of providers) {\n\t\tconst rawEdits = await Promise.resolve(provider.provideDocumentRangeFormattingEdits(model, range, options, token)).catch(onUnexpectedExternalError);\n\t\tif (isNonEmptyArray(rawEdits)) {\n\t\t\treturn await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport async function getDocumentFormattingEditsUntilResult(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | undefined> {\n\n\tconst providers = getRealAndSyntheticDocumentFormattersOrdered(languageFeaturesService.documentFormattingEditProvider, languageFeaturesService.documentRangeFormattingEditProvider, model);\n\tfor (const provider of providers) {\n\t\tconst rawEdits = await Promise.resolve(provider.provideDocumentFormattingEdits(model, options, token)).catch(onUnexpectedExternalError);\n\t\tif (isNonEmptyArray(rawEdits)) {\n\t\t\treturn await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport function getOnTypeFormattingEdits(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\tposition: Position,\n\tch: string,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | null | undefined> {\n\n\tconst providers = languageFeaturesService.onTypeFormattingEditProvider.ordered(model);\n\n\tif (providers.length === 0) {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\tif (providers[0].autoFormatTriggerCharacters.indexOf(ch) < 0) {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\treturn Promise.resolve(providers[0].provideOnTypeFormattingEdits(model, position, ch, options, token)).catch(onUnexpectedExternalError).then(edits => {\n\t\treturn workerService.computeMoreMinimalEdits(model.uri, edits);\n\t});\n}\n\nfunction isFormattingOptions(obj: unknown): obj is FormattingOptions {\n\tconst candidate = obj as FormattingOptions | undefined;\n\n\treturn !!candidate && typeof candidate === 'object' && typeof candidate.tabSize === 'number' && typeof candidate.insertSpaces === 'boolean';\n}\n\nCommandsRegistry.registerCommand('_executeFormatRangeProvider', async function (accessor, ...args) {\n\tconst [resource, range, options] = args;\n\tassertType(URI.isUri(resource));\n\tassertType(Range.isIRange(range));\n\tassertType(isFormattingOptions(options));\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getDocumentRangeFormattingEditsUntilResult(workerService, languageFeaturesService, reference.object.textEditorModel, Range.lift(range), options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n\nCommandsRegistry.registerCommand('_executeFormatDocumentProvider', async function (accessor, ...args) {\n\tconst [resource, options] = args;\n\tassertType(URI.isUri(resource));\n\tassertType(isFormattingOptions(options));\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getDocumentFormattingEditsUntilResult(workerService, languageFeaturesService, reference.object.textEditorModel, options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n\nCommandsRegistry.registerCommand('_executeFormatOnTypeProvider', async function (accessor, ...args) {\n\tconst [resource, position, ch, options] = args;\n\tassertType(URI.isUri(resource));\n\tassertType(Position.isIPosition(position));\n\tassertType(typeof ch === 'string');\n\tassertType(isFormattingOptions(options));\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getOnTypeFormattingEdits(workerService, languageFeaturesService, reference.object.textEditorModel, Position.lift(position), ch, options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { asArray, isNonEmptyArray } from '../../../../base/common/arrays.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../../base/common/cancellation.js';\nimport { onUnexpectedExternalError } from '../../../../base/common/errors.js';\nimport { Iterable } from '../../../../base/common/iterator.js';\nimport { IDisposable } from '../../../../base/common/lifecycle.js';\nimport { LinkedList } from '../../../../base/common/linkedList.js';\nimport { assertType } from '../../../../base/common/types.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { CodeEditorStateFlag, EditorStateCancellationTokenSource, TextModelCancellationTokenSource } from '../../editorState/browser/editorState.js';\nimport { IActiveCodeEditor, isCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ServicesAccessor } from '../../../browser/editorExtensions.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { Selection } from '../../../common/core/selection.js';\nimport { ScrollType } from '../../../common/editorCommon.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { DocumentFormattingEditProvider, DocumentRangeFormattingEditProvider, FormattingOptions, TextEdit } from '../../../common/languages.js';\nimport { IEditorWorkerService } from '../../../common/services/editorWorker.js';\nimport { ITextModelService } from '../../../common/services/resolverService.js';\nimport { FormattingEdit } from './formattingEdit.js';\nimport { CommandsRegistry } from '../../../../platform/commands/common/commands.js';\nimport { ExtensionIdentifierSet } from '../../../../platform/extensions/common/extensions.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IProgress } from '../../../../platform/progress/common/progress.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { LanguageFeatureRegistry } from '../../../common/languageFeatureRegistry.js';\nimport { ILogService } from '../../../../platform/log/common/log.js';\nimport { AccessibilitySignal, IAccessibilitySignalService } from '../../../../platform/accessibilitySignal/browser/accessibilitySignalService.js';\n\nexport function getRealAndSyntheticDocumentFormattersOrdered(\n\tdocumentFormattingEditProvider: LanguageFeatureRegistry<DocumentFormattingEditProvider>,\n\tdocumentRangeFormattingEditProvider: LanguageFeatureRegistry<DocumentRangeFormattingEditProvider>,\n\tmodel: ITextModel\n): DocumentFormattingEditProvider[] {\n\tconst result: DocumentFormattingEditProvider[] = [];\n\tconst seen = new ExtensionIdentifierSet();\n\n\t// (1) add all document formatter\n\tconst docFormatter = documentFormattingEditProvider.ordered(model);\n\tfor (const formatter of docFormatter) {\n\t\tresult.push(formatter);\n\t\tif (formatter.extensionId) {\n\t\t\tseen.add(formatter.extensionId);\n\t\t}\n\t}\n\n\t// (2) add all range formatter as document formatter (unless the same extension already did that)\n\tconst rangeFormatter = documentRangeFormattingEditProvider.ordered(model);\n\tfor (const formatter of rangeFormatter) {\n\t\tif (formatter.extensionId) {\n\t\t\tif (seen.has(formatter.extensionId)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseen.add(formatter.extensionId);\n\t\t}\n\t\tresult.push({\n\t\t\tdisplayName: formatter.displayName,\n\t\t\textensionId: formatter.extensionId,\n\t\t\tprovideDocumentFormattingEdits(model, options, token) {\n\t\t\t\treturn formatter.provideDocumentRangeFormattingEdits(model, model.getFullModelRange(), options, token);\n\t\t\t}\n\t\t});\n\t}\n\treturn result;\n}\n\nexport const enum FormattingKind {\n\tFile = 1,\n\tSelection = 2\n}\n\nexport const enum FormattingMode {\n\tExplicit = 1,\n\tSilent = 2\n}\n\nexport interface IFormattingEditProviderSelector {\n\t<T extends (DocumentFormattingEditProvider | DocumentRangeFormattingEditProvider)>(formatter: T[], document: ITextModel, mode: FormattingMode, kind: FormattingKind): Promise<T | undefined>;\n}\n\nexport abstract class FormattingConflicts {\n\n\tprivate static readonly _selectors = new LinkedList<IFormattingEditProviderSelector>();\n\n\tstatic setFormatterSelector(selector: IFormattingEditProviderSelector): IDisposable {\n\t\tconst remove = FormattingConflicts._selectors.unshift(selector);\n\t\treturn { dispose: remove };\n\t}\n\n\tstatic async select<T extends (DocumentFormattingEditProvider | DocumentRangeFormattingEditProvider)>(formatter: T[], document: ITextModel, mode: FormattingMode, kind: FormattingKind): Promise<T | undefined> {\n\t\tif (formatter.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst selector = Iterable.first(FormattingConflicts._selectors);\n\t\tif (selector) {\n\t\t\treturn await selector(formatter, document, mode, kind);\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\nexport async function formatDocumentRangesWithSelectedProvider(\n\taccessor: ServicesAccessor,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\trangeOrRanges: Range | Range[],\n\tmode: FormattingMode,\n\tprogress: IProgress<DocumentRangeFormattingEditProvider>,\n\ttoken: CancellationToken,\n\tuserGesture: boolean\n): Promise<void> {\n\n\tconst instaService = accessor.get(IInstantiationService);\n\tconst { documentRangeFormattingEditProvider: documentRangeFormattingEditProviderRegistry } = accessor.get(ILanguageFeaturesService);\n\tconst model = isCodeEditor(editorOrModel) ? editorOrModel.getModel() : editorOrModel;\n\tconst provider = documentRangeFormattingEditProviderRegistry.ordered(model);\n\tconst selected = await FormattingConflicts.select(provider, model, mode, FormattingKind.Selection);\n\tif (selected) {\n\t\tprogress.report(selected);\n\t\tawait instaService.invokeFunction(formatDocumentRangesWithProvider, selected, editorOrModel, rangeOrRanges, token, userGesture);\n\t}\n}\n\nexport async function formatDocumentRangesWithProvider(\n\taccessor: ServicesAccessor,\n\tprovider: DocumentRangeFormattingEditProvider,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\trangeOrRanges: Range | Range[],\n\ttoken: CancellationToken,\n\tuserGesture: boolean\n): Promise<boolean> {\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst logService = accessor.get(ILogService);\n\tconst accessibilitySignalService = accessor.get(IAccessibilitySignalService);\n\n\tlet model: ITextModel;\n\tlet cts: CancellationTokenSource;\n\tif (isCodeEditor(editorOrModel)) {\n\t\tmodel = editorOrModel.getModel();\n\t\tcts = new EditorStateCancellationTokenSource(editorOrModel, CodeEditorStateFlag.Value | CodeEditorStateFlag.Position, undefined, token);\n\t} else {\n\t\tmodel = editorOrModel;\n\t\tcts = new TextModelCancellationTokenSource(editorOrModel, token);\n\t}\n\n\t// make sure that ranges don't overlap nor touch each other\n\tconst ranges: Range[] = [];\n\tlet len = 0;\n\tfor (const range of asArray(rangeOrRanges).sort(Range.compareRangesUsingStarts)) {\n\t\tif (len > 0 && Range.areIntersectingOrTouching(ranges[len - 1], range)) {\n\t\t\tranges[len - 1] = Range.fromPositions(ranges[len - 1].getStartPosition(), range.getEndPosition());\n\t\t} else {\n\t\t\tlen = ranges.push(range);\n\t\t}\n\t}\n\n\tconst computeEdits = async (range: Range) => {\n\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (request)`, provider.extensionId?.value, range);\n\n\t\tconst result = (await provider.provideDocumentRangeFormattingEdits(\n\t\t\tmodel,\n\t\t\trange,\n\t\t\tmodel.getFormattingOptions(),\n\t\t\tcts.token\n\t\t)) || [];\n\n\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (response)`, provider.extensionId?.value, result);\n\n\t\treturn result;\n\t};\n\n\tconst hasIntersectingEdit = (a: TextEdit[], b: TextEdit[]) => {\n\t\tif (!a.length || !b.length) {\n\t\t\treturn false;\n\t\t}\n\t\t// quick exit if the list of ranges are completely unrelated [O(n)]\n\t\tconst mergedA = a.reduce((acc, val) => { return Range.plusRange(acc, val.range); }, a[0].range);\n\t\tif (!b.some(x => { return Range.intersectRanges(mergedA, x.range); })) {\n\t\t\treturn false;\n\t\t}\n\t\t// fallback to a complete check [O(n^2)]\n\t\tfor (const edit of a) {\n\t\t\tfor (const otherEdit of b) {\n\t\t\t\tif (Range.intersectRanges(edit.range, otherEdit.range)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t};\n\n\tconst allEdits: TextEdit[] = [];\n\tconst rawEditsList: TextEdit[][] = [];\n\ttry {\n\t\tif (typeof provider.provideDocumentRangesFormattingEdits === 'function') {\n\t\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (request)`, provider.extensionId?.value, ranges);\n\t\t\tconst result = (await provider.provideDocumentRangesFormattingEdits(\n\t\t\t\tmodel,\n\t\t\t\tranges,\n\t\t\t\tmodel.getFormattingOptions(),\n\t\t\t\tcts.token\n\t\t\t)) || [];\n\t\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (response)`, provider.extensionId?.value, result);\n\t\t\trawEditsList.push(result);\n\t\t} else {\n\n\t\t\tfor (const range of ranges) {\n\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\trawEditsList.push(await computeEdits(range));\n\t\t\t}\n\n\t\t\tfor (let i = 0; i < ranges.length; ++i) {\n\t\t\t\tfor (let j = i + 1; j < ranges.length; ++j) {\n\t\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (hasIntersectingEdit(rawEditsList[i], rawEditsList[j])) {\n\t\t\t\t\t\t// Merge ranges i and j into a single range, recompute the associated edits\n\t\t\t\t\t\tconst mergedRange = Range.plusRange(ranges[i], ranges[j]);\n\t\t\t\t\t\tconst edits = await computeEdits(mergedRange);\n\t\t\t\t\t\tranges.splice(j, 1);\n\t\t\t\t\t\tranges.splice(i, 1);\n\t\t\t\t\t\tranges.push(mergedRange);\n\t\t\t\t\t\trawEditsList.splice(j, 1);\n\t\t\t\t\t\trawEditsList.splice(i, 1);\n\t\t\t\t\t\trawEditsList.push(edits);\n\t\t\t\t\t\t// Restart scanning\n\t\t\t\t\t\ti = 0;\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const rawEdits of rawEditsList) {\n\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tconst minimalEdits = await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t\tif (minimalEdits) {\n\t\t\t\tallEdits.push(...minimalEdits);\n\t\t\t}\n\t\t}\n\n\t\tif (cts.token.isCancellationRequested) {\n\t\t\treturn true;\n\t\t}\n\t} finally {\n\t\tcts.dispose();\n\t}\n\n\tif (allEdits.length === 0) {\n\t\treturn false;\n\t}\n\n\tif (isCodeEditor(editorOrModel)) {\n\t\t// use editor to apply edits\n\t\tFormattingEdit.execute(editorOrModel, allEdits, true);\n\t\teditorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate);\n\n\t} else {\n\t\t// use model to apply edits\n\t\tconst [{ range }] = allEdits;\n\t\tconst initialSelection = new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n\t\tmodel.pushEditOperations([initialSelection], allEdits.map(edit => {\n\t\t\treturn {\n\t\t\t\ttext: edit.text,\n\t\t\t\trange: Range.lift(edit.range),\n\t\t\t\tforceMoveMarkers: true\n\t\t\t};\n\t\t}), undoEdits => {\n\t\t\tfor (const { range } of undoEdits) {\n\t\t\t\tif (Range.areIntersectingOrTouching(range, initialSelection)) {\n\t\t\t\t\treturn [new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn)];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t});\n\t}\n\taccessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture });\n\treturn true;\n}\n\nexport async function formatDocumentWithSelectedProvider(\n\taccessor: ServicesAccessor,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\tmode: FormattingMode,\n\tprogress: IProgress<DocumentFormattingEditProvider>,\n\ttoken: CancellationToken,\n\tuserGesture?: boolean\n): Promise<void> {\n\n\tconst instaService = accessor.get(IInstantiationService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst model = isCodeEditor(editorOrModel) ? editorOrModel.getModel() : editorOrModel;\n\tconst provider = getRealAndSyntheticDocumentFormattersOrdered(languageFeaturesService.documentFormattingEditProvider, languageFeaturesService.documentRangeFormattingEditProvider, model);\n\tconst selected = await FormattingConflicts.select(provider, model, mode, FormattingKind.File);\n\tif (selected) {\n\t\tprogress.report(selected);\n\t\tawait instaService.invokeFunction(formatDocumentWithProvider, selected, editorOrModel, mode, token, userGesture);\n\t}\n}\n\nexport async function formatDocumentWithProvider(\n\taccessor: ServicesAccessor,\n\tprovider: DocumentFormattingEditProvider,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\tmode: FormattingMode,\n\ttoken: CancellationToken,\n\tuserGesture?: boolean\n): Promise<boolean> {\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst accessibilitySignalService = accessor.get(IAccessibilitySignalService);\n\n\tlet model: ITextModel;\n\tlet cts: CancellationTokenSource;\n\tif (isCodeEditor(editorOrModel)) {\n\t\tmodel = editorOrModel.getModel();\n\t\tcts = new EditorStateCancellationTokenSource(editorOrModel, CodeEditorStateFlag.Value | CodeEditorStateFlag.Position, undefined, token);\n\t} else {\n\t\tmodel = editorOrModel;\n\t\tcts = new TextModelCancellationTokenSource(editorOrModel, token);\n\t}\n\n\tlet edits: TextEdit[] | undefined;\n\ttry {\n\t\tconst rawEdits = await provider.provideDocumentFormattingEdits(\n\t\t\tmodel,\n\t\t\tmodel.getFormattingOptions(),\n\t\t\tcts.token\n\t\t);\n\n\t\tedits = await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\n\t\tif (cts.token.isCancellationRequested) {\n\t\t\treturn true;\n\t\t}\n\n\t} finally {\n\t\tcts.dispose();\n\t}\n\n\tif (!edits || edits.length === 0) {\n\t\treturn false;\n\t}\n\n\tif (isCodeEditor(editorOrModel)) {\n\t\t// use editor to apply edits\n\t\tFormattingEdit.execute(editorOrModel, edits, mode !== FormattingMode.Silent);\n\n\t\tif (mode !== FormattingMode.Silent) {\n\t\t\teditorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate);\n\t\t}\n\n\t} else {\n\t\t// use model to apply edits\n\t\tconst [{ range }] = edits;\n\t\tconst initialSelection = new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n\t\tmodel.pushEditOperations([initialSelection], edits.map(edit => {\n\t\t\treturn {\n\t\t\t\ttext: edit.text,\n\t\t\t\trange: Range.lift(edit.range),\n\t\t\t\tforceMoveMarkers: true\n\t\t\t};\n\t\t}), undoEdits => {\n\t\t\tfor (const { range } of undoEdits) {\n\t\t\t\tif (Range.areIntersectingOrTouching(range, initialSelection)) {\n\t\t\t\t\treturn [new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn)];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t});\n\t}\n\taccessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture });\n\treturn true;\n}\n\nexport async function getDocumentRangeFormattingEditsUntilResult(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\trange: Range,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | undefined> {\n\n\tconst providers = languageFeaturesService.documentRangeFormattingEditProvider.ordered(model);\n\tfor (const provider of providers) {\n\t\tconst rawEdits = await Promise.resolve(provider.provideDocumentRangeFormattingEdits(model, range, options, token)).catch(onUnexpectedExternalError);\n\t\tif (isNonEmptyArray(rawEdits)) {\n\t\t\treturn await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport async function getDocumentFormattingEditsUntilResult(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | undefined> {\n\n\tconst providers = getRealAndSyntheticDocumentFormattersOrdered(languageFeaturesService.documentFormattingEditProvider, languageFeaturesService.documentRangeFormattingEditProvider, model);\n\tfor (const provider of providers) {\n\t\tconst rawEdits = await Promise.resolve(provider.provideDocumentFormattingEdits(model, options, token)).catch(onUnexpectedExternalError);\n\t\tif (isNonEmptyArray(rawEdits)) {\n\t\t\treturn await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport function getOnTypeFormattingEdits(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\tposition: Position,\n\tch: string,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | null | undefined> {\n\n\tconst providers = languageFeaturesService.onTypeFormattingEditProvider.ordered(model);\n\n\tif (providers.length === 0) {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\tif (providers[0].autoFormatTriggerCharacters.indexOf(ch) < 0) {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\treturn Promise.resolve(providers[0].provideOnTypeFormattingEdits(model, position, ch, options, token)).catch(onUnexpectedExternalError).then(edits => {\n\t\treturn workerService.computeMoreMinimalEdits(model.uri, edits);\n\t});\n}\n\nfunction isFormattingOptions(obj: unknown): obj is FormattingOptions {\n\tconst candidate = obj as FormattingOptions | undefined;\n\n\treturn !!candidate && typeof candidate === 'object' && typeof candidate.tabSize === 'number' && typeof candidate.insertSpaces === 'boolean';\n}\n\nCommandsRegistry.registerCommand('_executeFormatRangeProvider', async function (accessor, ...args) {\n\tconst [resource, range, options] = args;\n\tassertType(URI.isUri(resource));\n\tassertType(Range.isIRange(range));\n\tassertType(isFormattingOptions(options));\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getDocumentRangeFormattingEditsUntilResult(workerService, languageFeaturesService, reference.object.textEditorModel, Range.lift(range), options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n\nCommandsRegistry.registerCommand('_executeFormatDocumentProvider', async function (accessor, ...args) {\n\tconst [resource, options] = args;\n\tassertType(URI.isUri(resource));\n\tassertType(isFormattingOptions(options));\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getDocumentFormattingEditsUntilResult(workerService, languageFeaturesService, reference.object.textEditorModel, options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n\nCommandsRegistry.registerCommand('_executeFormatOnTypeProvider', async function (accessor, ...args) {\n\tconst [resource, position, ch, options] = args;\n\tassertType(URI.isUri(resource));\n\tassertType(Position.isIPosition(position));\n\tassertType(typeof ch === 'string');\n\tassertType(isFormattingOptions(options));\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getOnTypeFormattingEdits(workerService, languageFeaturesService, reference.object.textEditorModel, Position.lift(position), ch, options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/format/browser/format.ts","vs/editor/contrib/format/browser/format.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAA2B,MAAM,yCAAyC,CAAC;AACrG,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AACrD,OAAO,EAAuB,kCAAkC,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AACrJ,OAAO,EAAqB,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,KAAK,EA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AuB,GAAG,QAAQ,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACvE,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACvE,IAAI,CAAC;QACJ,OAAO,wBAAwB,CAAC,aAAa,EAAE,uBAAuB,EAAE,SAAS,CAAC,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzK,CAAC;YAAS,CAAC;QACV,SAAS,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACF,CAAC,CAAC,CAAC","file":"format.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { asArray, isNonEmptyArray } from '../../../../base/common/arrays.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../../base/common/cancellation.js';\nimport { onUnexpectedExternalError } from '../../../../base/common/errors.js';\nimport { Iterable } from '../../../../base/common/iterator.js';\nimport { IDisposable } from '../../../../base/common/lifecycle.js';\nimport { LinkedList } from '../../../../base/common/linkedList.js';\nimport { assertType } from '../../../../base/common/types.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { CodeEditorStateFlag, EditorStateCancellationTokenSource, TextModelCancellationTokenSource } from '../../editorState/browser/editorState.js';\nimport { IActiveCodeEditor, isCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ServicesAccessor } from '../../../browser/editorExtensions.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { Selection } from '../../../common/core/selection.js';\nimport { ScrollType } from '../../../common/editorCommon.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { DocumentFormattingEditProvider, DocumentRangeFormattingEditProvider, FormattingOptions, TextEdit } from '../../../common/languages.js';\nimport { IEditorWorkerService } from '../../../common/services/editorWorker.js';\nimport { ITextModelService } from '../../../common/services/resolverService.js';\nimport { FormattingEdit } from './formattingEdit.js';\nimport { CommandsRegistry } from '../../../../platform/commands/common/commands.js';\nimport { ExtensionIdentifierSet } from '../../../../platform/extensions/common/extensions.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IProgress } from '../../../../platform/progress/common/progress.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { LanguageFeatureRegistry } from '../../../common/languageFeatureRegistry.js';\nimport { ILogService } from '../../../../platform/log/common/log.js';\nimport { AccessibilitySignal, IAccessibilitySignalService } from '../../../../platform/accessibilitySignal/browser/accessibilitySignalService.js';\n\nexport function getRealAndSyntheticDocumentFormattersOrdered(\n\tdocumentFormattingEditProvider: LanguageFeatureRegistry<DocumentFormattingEditProvider>,\n\tdocumentRangeFormattingEditProvider: LanguageFeatureRegistry<DocumentRangeFormattingEditProvider>,\n\tmodel: ITextModel\n): DocumentFormattingEditProvider[] {\n\tconst result: DocumentFormattingEditProvider[] = [];\n\tconst seen = new ExtensionIdentifierSet();\n\n\t// (1) add all document formatter\n\tconst docFormatter = documentFormattingEditProvider.ordered(model);\n\tfor (const formatter of docFormatter) {\n\t\tresult.push(formatter);\n\t\tif (formatter.extensionId) {\n\t\t\tseen.add(formatter.extensionId);\n\t\t}\n\t}\n\n\t// (2) add all range formatter as document formatter (unless the same extension already did that)\n\tconst rangeFormatter = documentRangeFormattingEditProvider.ordered(model);\n\tfor (const formatter of rangeFormatter) {\n\t\tif (formatter.extensionId) {\n\t\t\tif (seen.has(formatter.extensionId)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseen.add(formatter.extensionId);\n\t\t}\n\t\tresult.push({\n\t\t\tdisplayName: formatter.displayName,\n\t\t\textensionId: formatter.extensionId,\n\t\t\tprovideDocumentFormattingEdits(model, options, token) {\n\t\t\t\treturn formatter.provideDocumentRangeFormattingEdits(model, model.getFullModelRange(), options, token);\n\t\t\t}\n\t\t});\n\t}\n\treturn result;\n}\n\nexport const enum FormattingKind {\n\tFile = 1,\n\tSelection = 2\n}\n\nexport const enum FormattingMode {\n\tExplicit = 1,\n\tSilent = 2\n}\n\nexport interface IFormattingEditProviderSelector {\n\t<T extends (DocumentFormattingEditProvider | DocumentRangeFormattingEditProvider)>(formatter: T[], document: ITextModel, mode: FormattingMode, kind: FormattingKind): Promise<T | undefined>;\n}\n\nexport abstract class FormattingConflicts {\n\n\tprivate static readonly _selectors = new LinkedList<IFormattingEditProviderSelector>();\n\n\tstatic setFormatterSelector(selector: IFormattingEditProviderSelector): IDisposable {\n\t\tconst remove = FormattingConflicts._selectors.unshift(selector);\n\t\treturn { dispose: remove };\n\t}\n\n\tstatic async select<T extends (DocumentFormattingEditProvider | DocumentRangeFormattingEditProvider)>(formatter: T[], document: ITextModel, mode: FormattingMode, kind: FormattingKind): Promise<T | undefined> {\n\t\tif (formatter.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst selector = Iterable.first(FormattingConflicts._selectors);\n\t\tif (selector) {\n\t\t\treturn await selector(formatter, document, mode, kind);\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\nexport async function formatDocumentRangesWithSelectedProvider(\n\taccessor: ServicesAccessor,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\trangeOrRanges: Range | Range[],\n\tmode: FormattingMode,\n\tprogress: IProgress<DocumentRangeFormattingEditProvider>,\n\ttoken: CancellationToken,\n\tuserGesture: boolean\n): Promise<void> {\n\n\tconst instaService = accessor.get(IInstantiationService);\n\tconst { documentRangeFormattingEditProvider: documentRangeFormattingEditProviderRegistry } = accessor.get(ILanguageFeaturesService);\n\tconst model = isCodeEditor(editorOrModel) ? editorOrModel.getModel() : editorOrModel;\n\tconst provider = documentRangeFormattingEditProviderRegistry.ordered(model);\n\tconst selected = await FormattingConflicts.select(provider, model, mode, FormattingKind.Selection);\n\tif (selected) {\n\t\tprogress.report(selected);\n\t\tawait instaService.invokeFunction(formatDocumentRangesWithProvider, selected, editorOrModel, rangeOrRanges, token, userGesture);\n\t}\n}\n\nexport async function formatDocumentRangesWithProvider(\n\taccessor: ServicesAccessor,\n\tprovider: DocumentRangeFormattingEditProvider,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\trangeOrRanges: Range | Range[],\n\ttoken: CancellationToken,\n\tuserGesture: boolean\n): Promise<boolean> {\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst logService = accessor.get(ILogService);\n\tconst accessibilitySignalService = accessor.get(IAccessibilitySignalService);\n\n\tlet model: ITextModel;\n\tlet cts: CancellationTokenSource;\n\tif (isCodeEditor(editorOrModel)) {\n\t\tmodel = editorOrModel.getModel();\n\t\tcts = new EditorStateCancellationTokenSource(editorOrModel, CodeEditorStateFlag.Value | CodeEditorStateFlag.Position, undefined, token);\n\t} else {\n\t\tmodel = editorOrModel;\n\t\tcts = new TextModelCancellationTokenSource(editorOrModel, token);\n\t}\n\n\t// make sure that ranges don't overlap nor touch each other\n\tconst ranges: Range[] = [];\n\tlet len = 0;\n\tfor (const range of asArray(rangeOrRanges).sort(Range.compareRangesUsingStarts)) {\n\t\tif (len > 0 && Range.areIntersectingOrTouching(ranges[len - 1], range)) {\n\t\t\tranges[len - 1] = Range.fromPositions(ranges[len - 1].getStartPosition(), range.getEndPosition());\n\t\t} else {\n\t\t\tlen = ranges.push(range);\n\t\t}\n\t}\n\n\tconst computeEdits = async (range: Range) => {\n\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (request)`, provider.extensionId?.value, range);\n\n\t\tconst result = (await provider.provideDocumentRangeFormattingEdits(\n\t\t\tmodel,\n\t\t\trange,\n\t\t\tmodel.getFormattingOptions(),\n\t\t\tcts.token\n\t\t)) || [];\n\n\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (response)`, provider.extensionId?.value, result);\n\n\t\treturn result;\n\t};\n\n\tconst hasIntersectingEdit = (a: TextEdit[], b: TextEdit[]) => {\n\t\tif (!a.length || !b.length) {\n\t\t\treturn false;\n\t\t}\n\t\t// quick exit if the list of ranges are completely unrelated [O(n)]\n\t\tconst mergedA = a.reduce((acc, val) => { return Range.plusRange(acc, val.range); }, a[0].range);\n\t\tif (!b.some(x => { return Range.intersectRanges(mergedA, x.range); })) {\n\t\t\treturn false;\n\t\t}\n\t\t// fallback to a complete check [O(n^2)]\n\t\tfor (const edit of a) {\n\t\t\tfor (const otherEdit of b) {\n\t\t\t\tif (Range.intersectRanges(edit.range, otherEdit.range)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t};\n\n\tconst allEdits: TextEdit[] = [];\n\tconst rawEditsList: TextEdit[][] = [];\n\ttry {\n\t\tif (typeof provider.provideDocumentRangesFormattingEdits === 'function') {\n\t\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (request)`, provider.extensionId?.value, ranges);\n\t\t\tconst result = (await provider.provideDocumentRangesFormattingEdits(\n\t\t\t\tmodel,\n\t\t\t\tranges,\n\t\t\t\tmodel.getFormattingOptions(),\n\t\t\t\tcts.token\n\t\t\t)) || [];\n\t\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (response)`, provider.extensionId?.value, result);\n\t\t\trawEditsList.push(result);\n\t\t} else {\n\n\t\t\tfor (const range of ranges) {\n\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\trawEditsList.push(await computeEdits(range));\n\t\t\t}\n\n\t\t\tfor (let i = 0; i < ranges.length; ++i) {\n\t\t\t\tfor (let j = i + 1; j < ranges.length; ++j) {\n\t\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (hasIntersectingEdit(rawEditsList[i], rawEditsList[j])) {\n\t\t\t\t\t\t// Merge ranges i and j into a single range, recompute the associated edits\n\t\t\t\t\t\tconst mergedRange = Range.plusRange(ranges[i], ranges[j]);\n\t\t\t\t\t\tconst edits = await computeEdits(mergedRange);\n\t\t\t\t\t\tranges.splice(j, 1);\n\t\t\t\t\t\tranges.splice(i, 1);\n\t\t\t\t\t\tranges.push(mergedRange);\n\t\t\t\t\t\trawEditsList.splice(j, 1);\n\t\t\t\t\t\trawEditsList.splice(i, 1);\n\t\t\t\t\t\trawEditsList.push(edits);\n\t\t\t\t\t\t// Restart scanning\n\t\t\t\t\t\ti = 0;\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const rawEdits of rawEditsList) {\n\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tconst minimalEdits = await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t\tif (minimalEdits) {\n\t\t\t\tallEdits.push(...minimalEdits);\n\t\t\t}\n\t\t}\n\n\t\tif (cts.token.isCancellationRequested) {\n\t\t\treturn true;\n\t\t}\n\t} finally {\n\t\tcts.dispose();\n\t}\n\n\tif (allEdits.length === 0) {\n\t\treturn false;\n\t}\n\n\tif (isCodeEditor(editorOrModel)) {\n\t\t// use editor to apply edits\n\t\tFormattingEdit.execute(editorOrModel, allEdits, true);\n\t\teditorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate);\n\n\t} else {\n\t\t// use model to apply edits\n\t\tconst [{ range }] = allEdits;\n\t\tconst initialSelection = new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n\t\tmodel.pushEditOperations([initialSelection], allEdits.map(edit => {\n\t\t\treturn {\n\t\t\t\ttext: edit.text,\n\t\t\t\trange: Range.lift(edit.range),\n\t\t\t\tforceMoveMarkers: true\n\t\t\t};\n\t\t}), undoEdits => {\n\t\t\tfor (const { range } of undoEdits) {\n\t\t\t\tif (Range.areIntersectingOrTouching(range, initialSelection)) {\n\t\t\t\t\treturn [new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn)];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t});\n\t}\n\taccessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture });\n\treturn true;\n}\n\nexport async function formatDocumentWithSelectedProvider(\n\taccessor: ServicesAccessor,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\tmode: FormattingMode,\n\tprogress: IProgress<DocumentFormattingEditProvider>,\n\ttoken: CancellationToken,\n\tuserGesture?: boolean\n): Promise<void> {\n\n\tconst instaService = accessor.get(IInstantiationService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst model = isCodeEditor(editorOrModel) ? editorOrModel.getModel() : editorOrModel;\n\tconst provider = getRealAndSyntheticDocumentFormattersOrdered(languageFeaturesService.documentFormattingEditProvider, languageFeaturesService.documentRangeFormattingEditProvider, model);\n\tconst selected = await FormattingConflicts.select(provider, model, mode, FormattingKind.File);\n\tif (selected) {\n\t\tprogress.report(selected);\n\t\tawait instaService.invokeFunction(formatDocumentWithProvider, selected, editorOrModel, mode, token, userGesture);\n\t}\n}\n\nexport async function formatDocumentWithProvider(\n\taccessor: ServicesAccessor,\n\tprovider: DocumentFormattingEditProvider,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\tmode: FormattingMode,\n\ttoken: CancellationToken,\n\tuserGesture?: boolean\n): Promise<boolean> {\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst accessibilitySignalService = accessor.get(IAccessibilitySignalService);\n\n\tlet model: ITextModel;\n\tlet cts: CancellationTokenSource;\n\tif (isCodeEditor(editorOrModel)) {\n\t\tmodel = editorOrModel.getModel();\n\t\tcts = new EditorStateCancellationTokenSource(editorOrModel, CodeEditorStateFlag.Value | CodeEditorStateFlag.Position, undefined, token);\n\t} else {\n\t\tmodel = editorOrModel;\n\t\tcts = new TextModelCancellationTokenSource(editorOrModel, token);\n\t}\n\n\tlet edits: TextEdit[] | undefined;\n\ttry {\n\t\tconst rawEdits = await provider.provideDocumentFormattingEdits(\n\t\t\tmodel,\n\t\t\tmodel.getFormattingOptions(),\n\t\t\tcts.token\n\t\t);\n\n\t\tedits = await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\n\t\tif (cts.token.isCancellationRequested) {\n\t\t\treturn true;\n\t\t}\n\n\t} finally {\n\t\tcts.dispose();\n\t}\n\n\tif (!edits || edits.length === 0) {\n\t\treturn false;\n\t}\n\n\tif (isCodeEditor(editorOrModel)) {\n\t\t// use editor to apply edits\n\t\tFormattingEdit.execute(editorOrModel, edits, mode !== FormattingMode.Silent);\n\n\t\tif (mode !== FormattingMode.Silent) {\n\t\t\teditorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate);\n\t\t}\n\n\t} else {\n\t\t// use model to apply edits\n\t\tconst [{ range }] = edits;\n\t\tconst initialSelection = new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n\t\tmodel.pushEditOperations([initialSelection], edits.map(edit => {\n\t\t\treturn {\n\t\t\t\ttext: edit.text,\n\t\t\t\trange: Range.lift(edit.range),\n\t\t\t\tforceMoveMarkers: true\n\t\t\t};\n\t\t}), undoEdits => {\n\t\t\tfor (const { range } of undoEdits) {\n\t\t\t\tif (Range.areIntersectingOrTouching(range, initialSelection)) {\n\t\t\t\t\treturn [new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn)];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t});\n\t}\n\taccessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture });\n\treturn true;\n}\n\nexport async function getDocumentRangeFormattingEditsUntilResult(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\trange: Range,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | undefined> {\n\n\tconst providers = languageFeaturesService.documentRangeFormattingEditProvider.ordered(model);\n\tfor (const provider of providers) {\n\t\tconst rawEdits = await Promise.resolve(provider.provideDocumentRangeFormattingEdits(model, range, options, token)).catch(onUnexpectedExternalError);\n\t\tif (isNonEmptyArray(rawEdits)) {\n\t\t\treturn await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport async function getDocumentFormattingEditsUntilResult(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | undefined> {\n\n\tconst providers = getRealAndSyntheticDocumentFormattersOrdered(languageFeaturesService.documentFormattingEditProvider, languageFeaturesService.documentRangeFormattingEditProvider, model);\n\tfor (const provider of providers) {\n\t\tconst rawEdits = await Promise.resolve(provider.provideDocumentFormattingEdits(model, options, token)).catch(onUnexpectedExternalError);\n\t\tif (isNonEmptyArray(rawEdits)) {\n\t\t\treturn await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport function getOnTypeFormattingEdits(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\tposition: Position,\n\tch: string,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | null | undefined> {\n\n\tconst providers = languageFeaturesService.onTypeFormattingEditProvider.ordered(model);\n\n\tif (providers.length === 0) {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\tif (providers[0].autoFormatTriggerCharacters.indexOf(ch) < 0) {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\treturn Promise.resolve(providers[0].provideOnTypeFormattingEdits(model, position, ch, options, token)).catch(onUnexpectedExternalError).then(edits => {\n\t\treturn workerService.computeMoreMinimalEdits(model.uri, edits);\n\t});\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nCommandsRegistry.registerCommand('_executeFormatRangeProvider', async function (accessor, ...args: any[]) {\n\tconst [resource, range, options] = args;\n\tassertType(URI.isUri(resource));\n\tassertType(Range.isIRange(range));\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getDocumentRangeFormattingEditsUntilResult(workerService, languageFeaturesService, reference.object.textEditorModel, Range.lift(range), options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nCommandsRegistry.registerCommand('_executeFormatDocumentProvider', async function (accessor, ...args: any[]) {\n\tconst [resource, options] = args;\n\tassertType(URI.isUri(resource));\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getDocumentFormattingEditsUntilResult(workerService, languageFeaturesService, reference.object.textEditorModel, options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nCommandsRegistry.registerCommand('_executeFormatOnTypeProvider', async function (accessor, ...args: any[]) {\n\tconst [resource, position, ch, options] = args;\n\tassertType(URI.isUri(resource));\n\tassertType(Position.isIPosition(position));\n\tassertType(typeof ch === 'string');\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getOnTypeFormattingEdits(workerService, languageFeaturesService, reference.object.textEditorModel, Position.lift(position), ch, options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { asArray, isNonEmptyArray } from '../../../../base/common/arrays.js';\nimport { CancellationToken, CancellationTokenSource } from '../../../../base/common/cancellation.js';\nimport { onUnexpectedExternalError } from '../../../../base/common/errors.js';\nimport { Iterable } from '../../../../base/common/iterator.js';\nimport { IDisposable } from '../../../../base/common/lifecycle.js';\nimport { LinkedList } from '../../../../base/common/linkedList.js';\nimport { assertType } from '../../../../base/common/types.js';\nimport { URI } from '../../../../base/common/uri.js';\nimport { CodeEditorStateFlag, EditorStateCancellationTokenSource, TextModelCancellationTokenSource } from '../../editorState/browser/editorState.js';\nimport { IActiveCodeEditor, isCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ServicesAccessor } from '../../../browser/editorExtensions.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { Selection } from '../../../common/core/selection.js';\nimport { ScrollType } from '../../../common/editorCommon.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { DocumentFormattingEditProvider, DocumentRangeFormattingEditProvider, FormattingOptions, TextEdit } from '../../../common/languages.js';\nimport { IEditorWorkerService } from '../../../common/services/editorWorker.js';\nimport { ITextModelService } from '../../../common/services/resolverService.js';\nimport { FormattingEdit } from './formattingEdit.js';\nimport { CommandsRegistry } from '../../../../platform/commands/common/commands.js';\nimport { ExtensionIdentifierSet } from '../../../../platform/extensions/common/extensions.js';\nimport { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';\nimport { IProgress } from '../../../../platform/progress/common/progress.js';\nimport { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';\nimport { LanguageFeatureRegistry } from '../../../common/languageFeatureRegistry.js';\nimport { ILogService } from '../../../../platform/log/common/log.js';\nimport { AccessibilitySignal, IAccessibilitySignalService } from '../../../../platform/accessibilitySignal/browser/accessibilitySignalService.js';\n\nexport function getRealAndSyntheticDocumentFormattersOrdered(\n\tdocumentFormattingEditProvider: LanguageFeatureRegistry<DocumentFormattingEditProvider>,\n\tdocumentRangeFormattingEditProvider: LanguageFeatureRegistry<DocumentRangeFormattingEditProvider>,\n\tmodel: ITextModel\n): DocumentFormattingEditProvider[] {\n\tconst result: DocumentFormattingEditProvider[] = [];\n\tconst seen = new ExtensionIdentifierSet();\n\n\t// (1) add all document formatter\n\tconst docFormatter = documentFormattingEditProvider.ordered(model);\n\tfor (const formatter of docFormatter) {\n\t\tresult.push(formatter);\n\t\tif (formatter.extensionId) {\n\t\t\tseen.add(formatter.extensionId);\n\t\t}\n\t}\n\n\t// (2) add all range formatter as document formatter (unless the same extension already did that)\n\tconst rangeFormatter = documentRangeFormattingEditProvider.ordered(model);\n\tfor (const formatter of rangeFormatter) {\n\t\tif (formatter.extensionId) {\n\t\t\tif (seen.has(formatter.extensionId)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseen.add(formatter.extensionId);\n\t\t}\n\t\tresult.push({\n\t\t\tdisplayName: formatter.displayName,\n\t\t\textensionId: formatter.extensionId,\n\t\t\tprovideDocumentFormattingEdits(model, options, token) {\n\t\t\t\treturn formatter.provideDocumentRangeFormattingEdits(model, model.getFullModelRange(), options, token);\n\t\t\t}\n\t\t});\n\t}\n\treturn result;\n}\n\nexport const enum FormattingKind {\n\tFile = 1,\n\tSelection = 2\n}\n\nexport const enum FormattingMode {\n\tExplicit = 1,\n\tSilent = 2\n}\n\nexport interface IFormattingEditProviderSelector {\n\t<T extends (DocumentFormattingEditProvider | DocumentRangeFormattingEditProvider)>(formatter: T[], document: ITextModel, mode: FormattingMode, kind: FormattingKind): Promise<T | undefined>;\n}\n\nexport abstract class FormattingConflicts {\n\n\tprivate static readonly _selectors = new LinkedList<IFormattingEditProviderSelector>();\n\n\tstatic setFormatterSelector(selector: IFormattingEditProviderSelector): IDisposable {\n\t\tconst remove = FormattingConflicts._selectors.unshift(selector);\n\t\treturn { dispose: remove };\n\t}\n\n\tstatic async select<T extends (DocumentFormattingEditProvider | DocumentRangeFormattingEditProvider)>(formatter: T[], document: ITextModel, mode: FormattingMode, kind: FormattingKind): Promise<T | undefined> {\n\t\tif (formatter.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst selector = Iterable.first(FormattingConflicts._selectors);\n\t\tif (selector) {\n\t\t\treturn await selector(formatter, document, mode, kind);\n\t\t}\n\t\treturn undefined;\n\t}\n}\n\nexport async function formatDocumentRangesWithSelectedProvider(\n\taccessor: ServicesAccessor,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\trangeOrRanges: Range | Range[],\n\tmode: FormattingMode,\n\tprogress: IProgress<DocumentRangeFormattingEditProvider>,\n\ttoken: CancellationToken,\n\tuserGesture: boolean\n): Promise<void> {\n\n\tconst instaService = accessor.get(IInstantiationService);\n\tconst { documentRangeFormattingEditProvider: documentRangeFormattingEditProviderRegistry } = accessor.get(ILanguageFeaturesService);\n\tconst model = isCodeEditor(editorOrModel) ? editorOrModel.getModel() : editorOrModel;\n\tconst provider = documentRangeFormattingEditProviderRegistry.ordered(model);\n\tconst selected = await FormattingConflicts.select(provider, model, mode, FormattingKind.Selection);\n\tif (selected) {\n\t\tprogress.report(selected);\n\t\tawait instaService.invokeFunction(formatDocumentRangesWithProvider, selected, editorOrModel, rangeOrRanges, token, userGesture);\n\t}\n}\n\nexport async function formatDocumentRangesWithProvider(\n\taccessor: ServicesAccessor,\n\tprovider: DocumentRangeFormattingEditProvider,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\trangeOrRanges: Range | Range[],\n\ttoken: CancellationToken,\n\tuserGesture: boolean\n): Promise<boolean> {\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst logService = accessor.get(ILogService);\n\tconst accessibilitySignalService = accessor.get(IAccessibilitySignalService);\n\n\tlet model: ITextModel;\n\tlet cts: CancellationTokenSource;\n\tif (isCodeEditor(editorOrModel)) {\n\t\tmodel = editorOrModel.getModel();\n\t\tcts = new EditorStateCancellationTokenSource(editorOrModel, CodeEditorStateFlag.Value | CodeEditorStateFlag.Position, undefined, token);\n\t} else {\n\t\tmodel = editorOrModel;\n\t\tcts = new TextModelCancellationTokenSource(editorOrModel, token);\n\t}\n\n\t// make sure that ranges don't overlap nor touch each other\n\tconst ranges: Range[] = [];\n\tlet len = 0;\n\tfor (const range of asArray(rangeOrRanges).sort(Range.compareRangesUsingStarts)) {\n\t\tif (len > 0 && Range.areIntersectingOrTouching(ranges[len - 1], range)) {\n\t\t\tranges[len - 1] = Range.fromPositions(ranges[len - 1].getStartPosition(), range.getEndPosition());\n\t\t} else {\n\t\t\tlen = ranges.push(range);\n\t\t}\n\t}\n\n\tconst computeEdits = async (range: Range) => {\n\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (request)`, provider.extensionId?.value, range);\n\n\t\tconst result = (await provider.provideDocumentRangeFormattingEdits(\n\t\t\tmodel,\n\t\t\trange,\n\t\t\tmodel.getFormattingOptions(),\n\t\t\tcts.token\n\t\t)) || [];\n\n\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (response)`, provider.extensionId?.value, result);\n\n\t\treturn result;\n\t};\n\n\tconst hasIntersectingEdit = (a: TextEdit[], b: TextEdit[]) => {\n\t\tif (!a.length || !b.length) {\n\t\t\treturn false;\n\t\t}\n\t\t// quick exit if the list of ranges are completely unrelated [O(n)]\n\t\tconst mergedA = a.reduce((acc, val) => { return Range.plusRange(acc, val.range); }, a[0].range);\n\t\tif (!b.some(x => { return Range.intersectRanges(mergedA, x.range); })) {\n\t\t\treturn false;\n\t\t}\n\t\t// fallback to a complete check [O(n^2)]\n\t\tfor (const edit of a) {\n\t\t\tfor (const otherEdit of b) {\n\t\t\t\tif (Range.intersectRanges(edit.range, otherEdit.range)) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t};\n\n\tconst allEdits: TextEdit[] = [];\n\tconst rawEditsList: TextEdit[][] = [];\n\ttry {\n\t\tif (typeof provider.provideDocumentRangesFormattingEdits === 'function') {\n\t\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (request)`, provider.extensionId?.value, ranges);\n\t\t\tconst result = (await provider.provideDocumentRangesFormattingEdits(\n\t\t\t\tmodel,\n\t\t\t\tranges,\n\t\t\t\tmodel.getFormattingOptions(),\n\t\t\t\tcts.token\n\t\t\t)) || [];\n\t\t\tlogService.trace(`[format][provideDocumentRangeFormattingEdits] (response)`, provider.extensionId?.value, result);\n\t\t\trawEditsList.push(result);\n\t\t} else {\n\n\t\t\tfor (const range of ranges) {\n\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\trawEditsList.push(await computeEdits(range));\n\t\t\t}\n\n\t\t\tfor (let i = 0; i < ranges.length; ++i) {\n\t\t\t\tfor (let j = i + 1; j < ranges.length; ++j) {\n\t\t\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif (hasIntersectingEdit(rawEditsList[i], rawEditsList[j])) {\n\t\t\t\t\t\t// Merge ranges i and j into a single range, recompute the associated edits\n\t\t\t\t\t\tconst mergedRange = Range.plusRange(ranges[i], ranges[j]);\n\t\t\t\t\t\tconst edits = await computeEdits(mergedRange);\n\t\t\t\t\t\tranges.splice(j, 1);\n\t\t\t\t\t\tranges.splice(i, 1);\n\t\t\t\t\t\tranges.push(mergedRange);\n\t\t\t\t\t\trawEditsList.splice(j, 1);\n\t\t\t\t\t\trawEditsList.splice(i, 1);\n\t\t\t\t\t\trawEditsList.push(edits);\n\t\t\t\t\t\t// Restart scanning\n\t\t\t\t\t\ti = 0;\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const rawEdits of rawEditsList) {\n\t\t\tif (cts.token.isCancellationRequested) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tconst minimalEdits = await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t\tif (minimalEdits) {\n\t\t\t\tallEdits.push(...minimalEdits);\n\t\t\t}\n\t\t}\n\n\t\tif (cts.token.isCancellationRequested) {\n\t\t\treturn true;\n\t\t}\n\t} finally {\n\t\tcts.dispose();\n\t}\n\n\tif (allEdits.length === 0) {\n\t\treturn false;\n\t}\n\n\tif (isCodeEditor(editorOrModel)) {\n\t\t// use editor to apply edits\n\t\tFormattingEdit.execute(editorOrModel, allEdits, true);\n\t\teditorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate);\n\n\t} else {\n\t\t// use model to apply edits\n\t\tconst [{ range }] = allEdits;\n\t\tconst initialSelection = new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n\t\tmodel.pushEditOperations([initialSelection], allEdits.map(edit => {\n\t\t\treturn {\n\t\t\t\ttext: edit.text,\n\t\t\t\trange: Range.lift(edit.range),\n\t\t\t\tforceMoveMarkers: true\n\t\t\t};\n\t\t}), undoEdits => {\n\t\t\tfor (const { range } of undoEdits) {\n\t\t\t\tif (Range.areIntersectingOrTouching(range, initialSelection)) {\n\t\t\t\t\treturn [new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn)];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t});\n\t}\n\taccessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture });\n\treturn true;\n}\n\nexport async function formatDocumentWithSelectedProvider(\n\taccessor: ServicesAccessor,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\tmode: FormattingMode,\n\tprogress: IProgress<DocumentFormattingEditProvider>,\n\ttoken: CancellationToken,\n\tuserGesture?: boolean\n): Promise<void> {\n\n\tconst instaService = accessor.get(IInstantiationService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst model = isCodeEditor(editorOrModel) ? editorOrModel.getModel() : editorOrModel;\n\tconst provider = getRealAndSyntheticDocumentFormattersOrdered(languageFeaturesService.documentFormattingEditProvider, languageFeaturesService.documentRangeFormattingEditProvider, model);\n\tconst selected = await FormattingConflicts.select(provider, model, mode, FormattingKind.File);\n\tif (selected) {\n\t\tprogress.report(selected);\n\t\tawait instaService.invokeFunction(formatDocumentWithProvider, selected, editorOrModel, mode, token, userGesture);\n\t}\n}\n\nexport async function formatDocumentWithProvider(\n\taccessor: ServicesAccessor,\n\tprovider: DocumentFormattingEditProvider,\n\teditorOrModel: ITextModel | IActiveCodeEditor,\n\tmode: FormattingMode,\n\ttoken: CancellationToken,\n\tuserGesture?: boolean\n): Promise<boolean> {\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst accessibilitySignalService = accessor.get(IAccessibilitySignalService);\n\n\tlet model: ITextModel;\n\tlet cts: CancellationTokenSource;\n\tif (isCodeEditor(editorOrModel)) {\n\t\tmodel = editorOrModel.getModel();\n\t\tcts = new EditorStateCancellationTokenSource(editorOrModel, CodeEditorStateFlag.Value | CodeEditorStateFlag.Position, undefined, token);\n\t} else {\n\t\tmodel = editorOrModel;\n\t\tcts = new TextModelCancellationTokenSource(editorOrModel, token);\n\t}\n\n\tlet edits: TextEdit[] | undefined;\n\ttry {\n\t\tconst rawEdits = await provider.provideDocumentFormattingEdits(\n\t\t\tmodel,\n\t\t\tmodel.getFormattingOptions(),\n\t\t\tcts.token\n\t\t);\n\n\t\tedits = await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\n\t\tif (cts.token.isCancellationRequested) {\n\t\t\treturn true;\n\t\t}\n\n\t} finally {\n\t\tcts.dispose();\n\t}\n\n\tif (!edits || edits.length === 0) {\n\t\treturn false;\n\t}\n\n\tif (isCodeEditor(editorOrModel)) {\n\t\t// use editor to apply edits\n\t\tFormattingEdit.execute(editorOrModel, edits, mode !== FormattingMode.Silent);\n\n\t\tif (mode !== FormattingMode.Silent) {\n\t\t\teditorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate);\n\t\t}\n\n\t} else {\n\t\t// use model to apply edits\n\t\tconst [{ range }] = edits;\n\t\tconst initialSelection = new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);\n\t\tmodel.pushEditOperations([initialSelection], edits.map(edit => {\n\t\t\treturn {\n\t\t\t\ttext: edit.text,\n\t\t\t\trange: Range.lift(edit.range),\n\t\t\t\tforceMoveMarkers: true\n\t\t\t};\n\t\t}), undoEdits => {\n\t\t\tfor (const { range } of undoEdits) {\n\t\t\t\tif (Range.areIntersectingOrTouching(range, initialSelection)) {\n\t\t\t\t\treturn [new Selection(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn)];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t});\n\t}\n\taccessibilitySignalService.playSignal(AccessibilitySignal.format, { userGesture });\n\treturn true;\n}\n\nexport async function getDocumentRangeFormattingEditsUntilResult(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\trange: Range,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | undefined> {\n\n\tconst providers = languageFeaturesService.documentRangeFormattingEditProvider.ordered(model);\n\tfor (const provider of providers) {\n\t\tconst rawEdits = await Promise.resolve(provider.provideDocumentRangeFormattingEdits(model, range, options, token)).catch(onUnexpectedExternalError);\n\t\tif (isNonEmptyArray(rawEdits)) {\n\t\t\treturn await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport async function getDocumentFormattingEditsUntilResult(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | undefined> {\n\n\tconst providers = getRealAndSyntheticDocumentFormattersOrdered(languageFeaturesService.documentFormattingEditProvider, languageFeaturesService.documentRangeFormattingEditProvider, model);\n\tfor (const provider of providers) {\n\t\tconst rawEdits = await Promise.resolve(provider.provideDocumentFormattingEdits(model, options, token)).catch(onUnexpectedExternalError);\n\t\tif (isNonEmptyArray(rawEdits)) {\n\t\t\treturn await workerService.computeMoreMinimalEdits(model.uri, rawEdits);\n\t\t}\n\t}\n\treturn undefined;\n}\n\nexport function getOnTypeFormattingEdits(\n\tworkerService: IEditorWorkerService,\n\tlanguageFeaturesService: ILanguageFeaturesService,\n\tmodel: ITextModel,\n\tposition: Position,\n\tch: string,\n\toptions: FormattingOptions,\n\ttoken: CancellationToken\n): Promise<TextEdit[] | null | undefined> {\n\n\tconst providers = languageFeaturesService.onTypeFormattingEditProvider.ordered(model);\n\n\tif (providers.length === 0) {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\tif (providers[0].autoFormatTriggerCharacters.indexOf(ch) < 0) {\n\t\treturn Promise.resolve(undefined);\n\t}\n\n\treturn Promise.resolve(providers[0].provideOnTypeFormattingEdits(model, position, ch, options, token)).catch(onUnexpectedExternalError).then(edits => {\n\t\treturn workerService.computeMoreMinimalEdits(model.uri, edits);\n\t});\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nCommandsRegistry.registerCommand('_executeFormatRangeProvider', async function (accessor, ...args: any[]) {\n\tconst [resource, range, options] = args;\n\tassertType(URI.isUri(resource));\n\tassertType(Range.isIRange(range));\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getDocumentRangeFormattingEditsUntilResult(workerService, languageFeaturesService, reference.object.textEditorModel, Range.lift(range), options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nCommandsRegistry.registerCommand('_executeFormatDocumentProvider', async function (accessor, ...args: any[]) {\n\tconst [resource, options] = args;\n\tassertType(URI.isUri(resource));\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getDocumentFormattingEditsUntilResult(workerService, languageFeaturesService, reference.object.textEditorModel, options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nCommandsRegistry.registerCommand('_executeFormatOnTypeProvider', async function (accessor, ...args: any[]) {\n\tconst [resource, position, ch, options] = args;\n\tassertType(URI.isUri(resource));\n\tassertType(Position.isIPosition(position));\n\tassertType(typeof ch === 'string');\n\n\tconst resolverService = accessor.get(ITextModelService);\n\tconst workerService = accessor.get(IEditorWorkerService);\n\tconst languageFeaturesService = accessor.get(ILanguageFeaturesService);\n\tconst reference = await resolverService.createModelReference(resource);\n\ttry {\n\t\treturn getOnTypeFormattingEdits(workerService, languageFeaturesService, reference.object.textEditorModel, Position.lift(position), ch, options, CancellationToken.None);\n\t} finally {\n\t\treference.dispose();\n\t}\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monaco-editor-core",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.55.0-
|
|
4
|
+
"version": "0.55.0-rc",
|
|
5
5
|
"description": "A browser based code editor",
|
|
6
6
|
"author": "Microsoft Corporation",
|
|
7
7
|
"license": "MIT",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"bugs": {
|
|
15
15
|
"url": "https://github.com/microsoft/vscode/issues"
|
|
16
16
|
},
|
|
17
|
-
"vscodeCommitId": "
|
|
17
|
+
"vscodeCommitId": "86f5a62f058e3905f74a9fa65d04b2f3b533408e",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"marked": "14.0.0",
|
|
20
20
|
"dompurify": "3.2.7"
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
monaco-editor-core: https://github.com/microsoft/vscode/tree/
|
|
1
|
+
monaco-editor-core: https://github.com/microsoft/vscode/tree/574b846ad235420d94be7f66e8f800e8b236b9fd
|