Add Auto Format item under the Edit menu (#1230)

This commit is contained in:
Francesco Spissu 2022-08-10 11:36:53 +02:00 committed by GitHub
parent 8a1cabd2bc
commit 6e3681896c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -141,6 +141,11 @@ ${value}
label: nls.localize('arduino/editor/decreaseIndent', 'Decrease Indent'), label: nls.localize('arduino/editor/decreaseIndent', 'Decrease Indent'),
order: '2', order: '2',
}); });
registry.registerMenuAction(ArduinoMenus.EDIT__CODE_CONTROL_GROUP, {
commandId: EditContributions.Commands.AUTO_FORMAT.id,
label: nls.localize('arduino/editor/autoFormat', 'Auto Format'),
order: '3',
});
registry.registerMenuAction(ArduinoMenus.EDIT__FONT_CONTROL_GROUP, { registry.registerMenuAction(ArduinoMenus.EDIT__FONT_CONTROL_GROUP, {
commandId: EditContributions.Commands.INCREASE_FONT_SIZE.id, commandId: EditContributions.Commands.INCREASE_FONT_SIZE.id,
@ -248,10 +253,13 @@ ${value}
}); });
} }
protected async current(): Promise<ICodeEditor | StandaloneCodeEditor | undefined> { protected async current(): Promise<
ICodeEditor | StandaloneCodeEditor | undefined
> {
return ( return (
this.codeEditorService.getFocusedCodeEditor() || this.codeEditorService.getFocusedCodeEditor() ||
this.codeEditorService.getActiveCodeEditor() || undefined this.codeEditorService.getActiveCodeEditor() ||
undefined
); );
} }