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 ecff615

Browse files
committed
Add keymaps customization support
1 parent 1e0f52b commit ecff615

File tree

9 files changed

+1026
-853
lines changed

9 files changed

+1026
-853
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';
@@ -278,6 +280,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
278280
rebind(TheiaOutlineViewContribution).to(OutlineViewContribution).inSingletonScope();
279281
rebind(TheiaProblemContribution).to(ProblemContribution).inSingletonScope();
280282
rebind(TheiaFileNavigatorContribution).to(FileNavigatorContribution).inSingletonScope();
283+
rebind(TheiaKeymapsFrontendContribution).to(KeymapsFrontendContribution).inSingletonScope();
281284
rebind(TheiaEditorContribution).to(EditorContribution).inSingletonScope();
282285
rebind(TheiaMonacoStatusBarContribution).to(MonacoStatusBarContribution).inSingletonScope();
283286
rebind(TheiaApplicationShell).to(ApplicationShell).inSingletonScope();

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ export class Settings extends SketchContribution {
3333
}
3434

3535
registerMenus(registry: MenuModelRegistry): void {
36-
registry.registerMenuAction(ArduinoMenus.FILE__SETTINGS_GROUP, {
36+
registry.registerSubmenu(ArduinoMenus.FILE__PREFERENCES_SUBMENU, 'Preferences');
37+
registry.registerMenuAction(ArduinoMenus.FILE__PREFERENCES_SUBMENU, {
3738
commandId: Settings.Commands.OPEN.id,
38-
label: 'Preferences...',
39-
order: '0'
39+
label: 'Settings',
40+
order: 'a10'
4041
});
4142
}
4243

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ 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 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__PREFERENCES_SUBMENU = [...FILE__PREFERENCES_GROUP, '0_preferences_sub'];
15+
1316
export const FILE__QUIT_GROUP = [...CommonMenus.FILE, '3_quit'];
1417

1518
// -- File / Open Recent
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
7+
@injectable()
8+
export class KeymapsFrontendContribution extends TheiaKeymapsFrontendContribution {
9+
10+
constructor() {
11+
super();
12+
}
13+
14+
registerMenus(menus: MenuModelRegistry): void {
15+
16+
menus.registerMenuAction(ArduinoMenus.FILE__PREFERENCES_SUBMENU, {
17+
commandId: KeymapsCommands.OPEN_KEYMAPS.id,
18+
label: 'Keyboard Shortcuts',
19+
order: 'a20'
20+
});
21+
}
22+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
2828
if (!!submenu && !(submenu instanceof remote.Menu)) {
2929
const [/* about */, /* settings */, ...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 settings = this.fillMenuTemplate([], this.menuProvider.getMenu(ArduinoMenus.FILE__PREFERENCES_GROUP));
3232
return {
3333
label,
3434
submenu: [

‎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 によって変換されたページ (->オリジナル) /