Skip to content

Commit 8f24368

Browse files
committed
call accessibility notification service on format on paste, format on save
1 parent 272653c commit 8f24368

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/vs/editor/contrib/format/browser/format.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ export async function formatDocumentRangesWithProvider(
128128
): Promise<boolean> {
129129
const workerService = accessor.get(IEditorWorkerService);
130130
const logService = accessor.get(ILogService);
131+
const accessibleNotificationService = accessor.get(IAccessibleNotificationService);
131132

132133
let model: ITextModel;
133134
let cts: CancellationTokenSource;
@@ -271,7 +272,7 @@ export async function formatDocumentRangesWithProvider(
271272
return null;
272273
});
273274
}
274-
275+
accessibleNotificationService.notify(AccessibleNotificationEvent.Format);
275276
return true;
276277
}
277278

src/vs/editor/contrib/format/browser/formatActions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeat
2121
import { formatDocumentRangesWithSelectedProvider, formatDocumentWithSelectedProvider, FormattingMode, getOnTypeFormattingEdits } from 'vs/editor/contrib/format/browser/format';
2222
import { FormattingEdit } from 'vs/editor/contrib/format/browser/formattingEdit';
2323
import * as nls from 'vs/nls';
24+
import { AccessibleNotificationEvent, IAccessibleNotificationService } from 'vs/platform/accessibility/common/accessibility';
2425
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
2526
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
2627
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -38,7 +39,8 @@ export class FormatOnType implements IEditorContribution {
3839
constructor(
3940
private readonly _editor: ICodeEditor,
4041
@ILanguageFeaturesService private readonly _languageFeaturesService: ILanguageFeaturesService,
41-
@IEditorWorkerService private readonly _workerService: IEditorWorkerService
42+
@IEditorWorkerService private readonly _workerService: IEditorWorkerService,
43+
@IAccessibleNotificationService private readonly _accessibleNotificationService: IAccessibleNotificationService
4244
) {
4345
this._disposables.add(_languageFeaturesService.onTypeFormattingEditProvider.onDidChange(this._update, this));
4446
this._disposables.add(_editor.onDidChangeModel(() => this._update()));
@@ -141,6 +143,7 @@ export class FormatOnType implements IEditorContribution {
141143
return;
142144
}
143145
if (isNonEmptyArray(edits)) {
146+
this._accessibleNotificationService.notify(AccessibleNotificationEvent.Format);
144147
FormattingEdit.execute(this._editor, edits, true);
145148
}
146149
}).finally(() => {

0 commit comments

Comments
 (0)