-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support keybinding via extensions (#198)
* feat: develop keybinding services & controller * feat: init actions via extension rather than MoleculeProvider * feat: support keybinding in the menus of activitybar * feat: support keybinding in the menus of menuBar * fix: replace context menu in activity bar * feat: improve keybinding icon in windows * refactor: improve the usage of keybinding * fix: extensionService no longer export
- Loading branch information
1 parent
a8ba3e3
commit fb3c370
Showing
20 changed files
with
282 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import type { IExtensionService } from 'mo/services'; | ||
import { IExtension } from 'mo/model'; | ||
import { SelectLocaleAction } from 'mo/i18n/selectLocaleAction'; | ||
import { QuickAccessSettings } from 'mo/monaco/quickAccessSettingsAction'; | ||
import { CommandQuickAccessViewAction } from 'mo/monaco/quickAccessViewAction'; | ||
import { SelectColorThemeAction } from 'mo/monaco/selectColorThemeAction'; | ||
|
||
export const ExtendsKeybinding: IExtension = { | ||
activate(extensionCtx: IExtensionService) { | ||
extensionCtx.registerAction(CommandQuickAccessViewAction); | ||
extensionCtx.registerAction(SelectColorThemeAction); | ||
extensionCtx.registerAction(QuickAccessSettings); | ||
extensionCtx.registerAction(SelectLocaleAction); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,69 @@ | ||
export interface IKeybinding {} | ||
import { KeyCode } from 'mo/monaco'; | ||
|
||
export const KeyCodeString: Partial<{ [key in KeyCode]: string }> = { | ||
[KeyCode.Unknown]: '', | ||
[KeyCode.Backspace]: '⌫', | ||
[KeyCode.Tab]: '⇥', | ||
[KeyCode.Enter]: '↩︎', | ||
[KeyCode.KEY_0]: '0', | ||
[KeyCode.KEY_1]: '1', | ||
[KeyCode.KEY_2]: '2', | ||
[KeyCode.KEY_3]: '3', | ||
[KeyCode.KEY_4]: '4', | ||
[KeyCode.KEY_5]: '5', | ||
[KeyCode.KEY_6]: '6', | ||
[KeyCode.KEY_7]: '7', | ||
[KeyCode.KEY_8]: '8', | ||
[KeyCode.KEY_9]: '9', | ||
[KeyCode.KEY_A]: 'A', | ||
[KeyCode.KEY_B]: 'B', | ||
[KeyCode.KEY_C]: 'C', | ||
[KeyCode.KEY_D]: 'D', | ||
[KeyCode.KEY_E]: 'E', | ||
[KeyCode.KEY_F]: 'F', | ||
[KeyCode.KEY_G]: 'G', | ||
[KeyCode.KEY_H]: 'H', | ||
[KeyCode.KEY_I]: 'I', | ||
[KeyCode.KEY_J]: 'J', | ||
[KeyCode.KEY_K]: 'K', | ||
[KeyCode.KEY_L]: 'L', | ||
[KeyCode.KEY_M]: 'M', | ||
[KeyCode.KEY_N]: 'N', | ||
[KeyCode.KEY_O]: 'O', | ||
[KeyCode.KEY_P]: 'P', | ||
[KeyCode.KEY_Q]: 'Q', | ||
[KeyCode.KEY_R]: 'R', | ||
[KeyCode.KEY_S]: 'S', | ||
[KeyCode.KEY_T]: 'T', | ||
[KeyCode.KEY_U]: 'U', | ||
[KeyCode.KEY_V]: 'V', | ||
[KeyCode.KEY_W]: 'W', | ||
[KeyCode.KEY_X]: 'X', | ||
[KeyCode.KEY_Y]: 'Y', | ||
[KeyCode.KEY_Z]: 'Z', | ||
[KeyCode.US_SEMICOLON]: ';', | ||
[KeyCode.US_EQUAL]: '+', | ||
[KeyCode.US_COMMA]: ',', | ||
[KeyCode.US_MINUS]: '-', | ||
[KeyCode.US_DOT]: '.', | ||
[KeyCode.US_SLASH]: '/', | ||
[KeyCode.US_BACKTICK]: '~', | ||
[KeyCode.US_OPEN_SQUARE_BRACKET]: '[', | ||
[KeyCode.US_BACKSLASH]: '\\', | ||
[KeyCode.US_CLOSE_SQUARE_BRACKET]: ']', | ||
[KeyCode.US_QUOTE]: '"', | ||
}; | ||
|
||
export interface ISimpleKeybinding { | ||
ctrlKey: boolean; | ||
shiftKey: boolean; | ||
altKey: boolean; | ||
metaKey: boolean; | ||
keyCode: KeyCode; | ||
} | ||
|
||
export const ACTION_QUICK_ACCESS_SETTINGS = | ||
'workbench.action.quickAccessSettings'; | ||
export const ACTION_QUICK_COMMAND = 'workbench.action.quickCommand'; | ||
export const ACTION_SELECT_THEME = 'workbench.action.selectTheme'; | ||
export const ACTION_SELECT_LOCALE = 'workbench.action.selectLocale'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.