-
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(menubar): add menu bar methods to service and support shortcut k…
…eys (#298) * feat: menu bar add new file function * feat: add encapsulated event state automata * feat: add menu bar action to menu bar controller * feat: define menu function and export operation id * feat: register view shortcut * feat: add key code string constant * feat: register the view method in the editor service * feat: register select all keyboard listener class * feat: register copy line up keyboard listener class * refactor: register undo and redo to keybinding * perf: extract function to keybinding * feat: add new file to keybinding * feat: use monaco service to get menu functions * feat: register menubar onSelect to subscribers * refactor: update the MenuBarService (#292) * refactor: remove addRootMenu method, and rename initMenu to initMenus * docs: add comments for the IMenuBarService interface * perf: move create file or folder function in service * feat: add new file to keybinding * feat: register menubar onSelect to subscribers * fix: increase call rigor * feat: add story of open any file on disk * feat: support file highlighting * feat: register the view method in the editor service * perf: extract function to keybinding * feat: add new file to keybinding * perf: better type description Co-authored-by: Ziv <[email protected]>
- Loading branch information
1 parent
fa5bae6
commit 3370b0f
Showing
13 changed files
with
378 additions
and
75 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
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,40 @@ | ||
import 'reflect-metadata'; | ||
import { localize } from 'mo/i18n/localize'; | ||
import { KeyMod, KeyCode } from 'mo/monaco'; | ||
import { EditorService, IEditorService } from 'mo/services'; | ||
import { container } from 'tsyringe'; | ||
import { Action2, KeybindingWeight } from './common'; | ||
import { ACTION_QUICK_COPY_LINE_UP } from 'mo/model/keybinding'; | ||
|
||
export class QuickCopyLineUp extends Action2 { | ||
static readonly ID = ACTION_QUICK_COPY_LINE_UP; | ||
static readonly LABEL = localize('menu.copyLineUp', 'Copy Line Up'); | ||
static readonly DESC = 'Copy Line Up'; | ||
private readonly editorService: IEditorService; | ||
|
||
constructor() { | ||
super({ | ||
id: QuickCopyLineUp.ID, | ||
title: { | ||
value: QuickCopyLineUp.LABEL, | ||
original: QuickCopyLineUp.DESC, | ||
}, | ||
label: QuickCopyLineUp.LABEL, | ||
alias: QuickCopyLineUp.DESC, | ||
f1: true, | ||
keybinding: { | ||
when: undefined, | ||
weight: KeybindingWeight.WorkbenchContrib, | ||
// eslint-disable-next-line new-cap | ||
primary: KeyMod.Alt | KeyMod.Shift | KeyCode.PageUp, | ||
}, | ||
}); | ||
this.editorService = container.resolve(EditorService); | ||
} | ||
|
||
run() { | ||
this.editorService.editorInstance | ||
?.getAction(ACTION_QUICK_COPY_LINE_UP) | ||
.run(); | ||
} | ||
} |
Oops, something went wrong.