diff --git a/src/vs/editor/contrib/format/browser/format.ts b/src/vs/editor/contrib/format/browser/format.ts index 6bd3ef94d3f..1f7518057ac 100644 --- a/src/vs/editor/contrib/format/browser/format.ts +++ b/src/vs/editor/contrib/format/browser/format.ts @@ -3,7 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { alert } from 'vs/base/browser/ui/aria/aria'; import { asArray, isNonEmptyArray } from 'vs/base/common/arrays'; import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation'; import { onUnexpectedExternalError } from 'vs/base/common/errors'; @@ -20,12 +19,10 @@ import { Range } from 'vs/editor/common/core/range'; import { Selection } from 'vs/editor/common/core/selection'; import { ScrollType } from 'vs/editor/common/editorCommon'; import { ITextModel } from 'vs/editor/common/model'; -import { ISingleEditOperation } from 'vs/editor/common/core/editOperation'; import { DocumentFormattingEditProvider, DocumentRangeFormattingEditProvider, FormattingOptions, TextEdit } from 'vs/editor/common/languages'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorker'; import { ITextModelService } from 'vs/editor/common/services/resolverService'; import { FormattingEdit } from 'vs/editor/contrib/format/browser/formattingEdit'; -import * as nls from 'vs/nls'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { ExtensionIdentifierSet } from 'vs/platform/extensions/common/extensions'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; @@ -35,33 +32,6 @@ import { LanguageFeatureRegistry } from 'vs/editor/common/languageFeatureRegistr import { ILogService } from 'vs/platform/log/common/log'; import { AccessibleNotificationEvent, IAccessibleNotificationService } from 'vs/platform/accessibility/common/accessibility'; -export function alertFormattingEdits(edits: ISingleEditOperation[]): void { - - edits = edits.filter(edit => edit.range); - if (!edits.length) { - return; - } - - let { range } = edits[0]; - for (let i = 1; i < edits.length; i++) { - range = Range.plusRange(range, edits[i].range); - } - const { startLineNumber, endLineNumber } = range; - if (startLineNumber === endLineNumber) { - if (edits.length === 1) { - alert(nls.localize('hint11', "Made 1 formatting edit on line {0}", startLineNumber)); - } else { - alert(nls.localize('hintn1', "Made {0} formatting edits on line {1}", edits.length, startLineNumber)); - } - } else { - if (edits.length === 1) { - alert(nls.localize('hint1n', "Made 1 formatting edit between lines {0} and {1}", startLineNumber, endLineNumber)); - } else { - alert(nls.localize('hintnn', "Made {0} formatting edits between lines {1} and {2}", edits.length, startLineNumber, endLineNumber)); - } - } -} - export function getRealAndSyntheticDocumentFormattersOrdered( documentFormattingEditProvider: LanguageFeatureRegistry, documentRangeFormattingEditProvider: LanguageFeatureRegistry, @@ -280,7 +250,6 @@ export async function formatDocumentRangesWithProvider( if (isCodeEditor(editorOrModel)) { // use editor to apply edits FormattingEdit.execute(editorOrModel, allEdits, true); - alertFormattingEdits(allEdits); editorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate); } else { @@ -374,7 +343,6 @@ export async function formatDocumentWithProvider( FormattingEdit.execute(editorOrModel, edits, mode !== FormattingMode.Silent); if (mode !== FormattingMode.Silent) { - alertFormattingEdits(edits); editorOrModel.revealPositionInCenterIfOutsideViewport(editorOrModel.getPosition(), ScrollType.Immediate); } diff --git a/src/vs/editor/contrib/format/browser/formatActions.ts b/src/vs/editor/contrib/format/browser/formatActions.ts index 3ba32683d95..733b909ae6d 100644 --- a/src/vs/editor/contrib/format/browser/formatActions.ts +++ b/src/vs/editor/contrib/format/browser/formatActions.ts @@ -18,7 +18,7 @@ import { IEditorContribution } from 'vs/editor/common/editorCommon'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { IEditorWorkerService } from 'vs/editor/common/services/editorWorker'; import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures'; -import { alertFormattingEdits, formatDocumentRangesWithSelectedProvider, formatDocumentWithSelectedProvider, FormattingMode, getOnTypeFormattingEdits } from 'vs/editor/contrib/format/browser/format'; +import { formatDocumentRangesWithSelectedProvider, formatDocumentWithSelectedProvider, FormattingMode, getOnTypeFormattingEdits } from 'vs/editor/contrib/format/browser/format'; import { FormattingEdit } from 'vs/editor/contrib/format/browser/formattingEdit'; import * as nls from 'vs/nls'; import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands'; @@ -142,7 +142,6 @@ export class FormatOnType implements IEditorContribution { } if (isNonEmptyArray(edits)) { FormattingEdit.execute(this._editor, edits, true); - alertFormattingEdits(edits); } }).finally(() => { unbind.dispose();