Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 562b77a

Browse files
committed
Add keymaps customization support
1 parent cdd5cfd commit 562b77a

File tree

9 files changed

+1071
-881
lines changed

9 files changed

+1071
-881
lines changed

‎arduino-ide-extension/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@theia/editor": "next",
2424
"@theia/filesystem": "next",
2525
"@theia/git": "next",
26+
"@theia/keymaps": "next",
2627
"@theia/markers": "next",
2728
"@theia/monaco": "next",
2829
"@theia/navigator": "next",

‎arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { ProblemContribution as TheiaProblemContribution } from '@theia/markers/
2424
import { ProblemContribution } from './theia/markers/problem-contribution';
2525
import { FileNavigatorContribution } from './theia/navigator/navigator-contribution';
2626
import { FileNavigatorContribution as TheiaFileNavigatorContribution } from '@theia/navigator/lib/browser/navigator-contribution';
27+
import { KeymapsFrontendContribution } from './theia/keymaps/keymaps-frontend-contribution';
28+
import { KeymapsFrontendContribution as TheiaKeymapsFrontendContribution } from '@theia/keymaps/lib/browser/keymaps-frontend-contribution';
2729
import { ArduinoToolbarContribution } from './toolbar/arduino-toolbar-contribution';
2830
import { EditorContribution as TheiaEditorContribution } from '@theia/editor/lib/browser/editor-contribution';
2931
import { EditorContribution } from './theia/editor/editor-contribution';
@@ -279,6 +281,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
279281
rebind(TheiaOutlineViewContribution).to(OutlineViewContribution).inSingletonScope();
280282
rebind(TheiaProblemContribution).to(ProblemContribution).inSingletonScope();
281283
rebind(TheiaFileNavigatorContribution).to(FileNavigatorContribution).inSingletonScope();
284+
rebind(TheiaKeymapsFrontendContribution).to(KeymapsFrontendContribution).inSingletonScope();
282285
rebind(TheiaEditorContribution).to(EditorContribution).inSingletonScope();
283286
rebind(TheiaMonacoStatusBarContribution).to(MonacoStatusBarContribution).inSingletonScope();
284287
rebind(TheiaApplicationShell).to(ApplicationShell).inSingletonScope();

‎arduino-ide-extension/src/browser/contributions/settings.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ export class Settings extends SketchContribution {
3333
}
3434

3535
registerMenus(registry: MenuModelRegistry): void {
36-
registry.registerMenuAction(ArduinoMenus.FILE__SETTINGS_GROUP, {
36+
registry.registerMenuAction(ArduinoMenus.FILE__PREFERENCES_GROUP, {
3737
commandId: Settings.Commands.OPEN.id,
3838
label: 'Preferences...',
3939
order: '0'
4040
});
41+
registry.registerSubmenu(ArduinoMenus.FILE__ADVANCED_SUBMENU, 'Advanced');
4142
}
4243

4344
registerKeybindings(registry: KeybindingRegistry): void {

‎arduino-ide-extension/src/browser/menu/arduino-menus.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ export namespace ArduinoMenus {
88
// -- File
99
export const FILE__SKETCH_GROUP = [...CommonMenus.FILE, '0_sketch'];
1010
export const FILE__PRINT_GROUP = [...CommonMenus.FILE, '1_print'];
11-
// XXX: on macOS, the settings group is not under `File`
12-
export const FILE__SETTINGS_GROUP = [...(isOSX ? MAIN_MENU_BAR : CommonMenus.FILE), '2_settings'];
11+
// XXX: on macOS, the "Preferences" and "Advanced" group is not under `File`
12+
// The empty path ensures no top level menu is created for the preferences, even if they contains sub menus
13+
export const FILE__PREFERENCES_GROUP = [...(isOSX ? [''] : CommonMenus.FILE), '2_preferences'];
14+
export const FILE__ADVANCED_GROUP = [...(isOSX ? [''] : CommonMenus.FILE), '3_advanced'];
15+
export const FILE__ADVANCED_SUBMENU = [...FILE__ADVANCED_GROUP, '0_advanced_sub'];
16+
1317
export const FILE__QUIT_GROUP = [...CommonMenus.FILE, '3_quit'];
1418

1519
// -- File / Open Recent
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { injectable } from 'inversify';
2+
import { MenuModelRegistry } from '@theia/core';
3+
import { KeymapsFrontendContribution as TheiaKeymapsFrontendContribution, KeymapsCommands } from '@theia/keymaps/lib/browser/keymaps-frontend-contribution';
4+
import { ArduinoMenus } from '../../menu/arduino-menus';
5+
6+
@injectable()
7+
export class KeymapsFrontendContribution extends TheiaKeymapsFrontendContribution {
8+
9+
registerMenus(menus: MenuModelRegistry): void {
10+
menus.registerMenuAction(ArduinoMenus.FILE__ADVANCED_SUBMENU, {
11+
commandId: KeymapsCommands.OPEN_KEYMAPS.id,
12+
label: 'Keyboard Shortcuts',
13+
order: '1'
14+
});
15+
}
16+
}

‎arduino-ide-extension/src/electron-browser/theia/core/electron-main-menu-factory.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
2626
const { submenu } = super.createOSXMenu();
2727
const label = 'Arduino IDE';
2828
if (!!submenu && !(submenu instanceof remote.Menu)) {
29-
const [/* about */, /* settings */, ...rest] = submenu;
29+
const [/* about */, /* preferences */, ...rest] = submenu;
3030
const about = this.fillMenuTemplate([], this.menuProvider.getMenu(ArduinoMenus.HELP__ABOUT_GROUP));
31-
const settings = this.fillMenuTemplate([], this.menuProvider.getMenu(ArduinoMenus.FILE__SETTINGS_GROUP));
31+
const preferences = this.fillMenuTemplate([], this.menuProvider.getMenu(ArduinoMenus.FILE__PREFERENCES_GROUP));
32+
const advanced = this.fillMenuTemplate([], this.menuProvider.getMenu(ArduinoMenus.FILE__ADVANCED_GROUP));
3233
return {
3334
label,
3435
submenu: [
3536
...about,
3637
{ type: 'separator' },
37-
...settings,
38+
...preferences,
39+
...advanced,
3840
{ type: 'separator' },
3941
...rest
4042
]

‎browser-app/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"@theia/editor": "next",
1010
"@theia/file-search": "next",
1111
"@theia/filesystem": "next",
12+
"@theia/keymaps": "next",
1213
"@theia/messages": "next",
1314
"@theia/monaco": "next",
1415
"@theia/navigator": "next",

‎electron-app/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"@theia/electron": "next",
1212
"@theia/file-search": "next",
1313
"@theia/filesystem": "next",
14+
"@theia/keymaps": "next",
1415
"@theia/messages": "next",
1516
"@theia/monaco": "next",
1617
"@theia/navigator": "next",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /