aligned tools and sketch menu. added auto-format

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2020-07-18 18:08:24 +02:00
parent 89faa9d45c
commit 95dfd3920c
3 changed files with 23 additions and 3 deletions

View File

@ -26,6 +26,7 @@ export class EditContributions extends Contribution {
registry.registerCommand(EditContributions.Commands.FIND_NEXT, { execute: () => this.run('actions.findWithSelection') }); registry.registerCommand(EditContributions.Commands.FIND_NEXT, { execute: () => this.run('actions.findWithSelection') });
registry.registerCommand(EditContributions.Commands.FIND_PREVIOUS, { execute: () => this.run('editor.action.nextMatchFindAction') }); registry.registerCommand(EditContributions.Commands.FIND_PREVIOUS, { execute: () => this.run('editor.action.nextMatchFindAction') });
registry.registerCommand(EditContributions.Commands.USE_FOR_FIND, { execute: () => this.run('editor.action.previousSelectionMatchFindAction') }); registry.registerCommand(EditContributions.Commands.USE_FOR_FIND, { execute: () => this.run('editor.action.previousSelectionMatchFindAction') });
/* Tools */registry.registerCommand(EditContributions.Commands.AUTO_FORMAT, { execute: () => this.run('editor.action.formatDocument') });
registry.registerCommand(EditContributions.Commands.COPY_FOR_FORUM, { registry.registerCommand(EditContributions.Commands.COPY_FOR_FORUM, {
execute: async () => { execute: async () => {
const value = await this.currentValue(); const value = await this.currentValue();
@ -117,6 +118,13 @@ ${value}
label: 'Use Selection for Find', // XXX: The Java IDE uses `Use Selection For Find`. label: 'Use Selection for Find', // XXX: The Java IDE uses `Use Selection For Find`.
order: '3' order: '3'
}); });
// `Tools`
registry.registerMenuAction(ArduinoMenus.TOOLS__MAIN_GROUP, {
commandId: EditContributions.Commands.AUTO_FORMAT.id,
label: 'Auto Format', // XXX: The Java IDE uses `Use Selection For Find`.
order: '0'
});
} }
registerKeybindings(registry: KeybindingRegistry): void { registerKeybindings(registry: KeybindingRegistry): void {
@ -162,6 +170,12 @@ ${value}
command: EditContributions.Commands.USE_FOR_FIND.id, command: EditContributions.Commands.USE_FOR_FIND.id,
keybinding: 'CtrlCmd+E' keybinding: 'CtrlCmd+E'
}); });
// `Tools`
registry.registerKeybinding({
command: EditContributions.Commands.AUTO_FORMAT.id,
keybinding: 'CtrlCmd+T'
});
} }
protected async current(): Promise<MonacoEditor | undefined> { protected async current(): Promise<MonacoEditor | undefined> {
@ -217,5 +231,9 @@ export namespace EditContributions {
export const USE_FOR_FIND: Command = { export const USE_FOR_FIND: Command = {
id: 'arduino-for-find' id: 'arduino-for-find'
}; };
// `Auto Format` does not belong here.
export const AUTO_FORMAT: Command = {
id: 'arduino-auto-format'
};
} }
} }

View File

@ -17,7 +17,7 @@ export class LibraryListWidgetFrontendContribution extends AbstractViewContribut
rank: 700 rank: 700
}, },
toggleCommandId: `${LibraryListWidget.WIDGET_ID}:toggle`, toggleCommandId: `${LibraryListWidget.WIDGET_ID}:toggle`,
toggleKeybinding: 'ctrlcmd+shift+l' toggleKeybinding: 'CtrlCmd+Shift+I'
}); });
} }
@ -29,7 +29,8 @@ export class LibraryListWidgetFrontendContribution extends AbstractViewContribut
if (this.toggleCommand) { if (this.toggleCommand) {
menus.registerMenuAction(ArduinoMenus.TOOLS, { menus.registerMenuAction(ArduinoMenus.TOOLS, {
commandId: this.toggleCommand.id, commandId: this.toggleCommand.id,
label: 'Manage Libraries...' label: 'Manage Libraries...',
order: '3'
}); });
} }
} }

View File

@ -50,7 +50,8 @@ export class MonitorViewContribution extends AbstractViewContribution<MonitorWid
if (this.toggleCommand) { if (this.toggleCommand) {
menus.registerMenuAction(ArduinoMenus.TOOLS, { menus.registerMenuAction(ArduinoMenus.TOOLS, {
commandId: this.toggleCommand.id, commandId: this.toggleCommand.id,
label: 'Serial Monitor' label: 'Serial Monitor',
order: '4'
}); });
} }
} }