File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/
6
6
import { KeybindingsRegistry } from 'monaco-editor/esm/vs/platform/keybinding/common/keybindingsRegistry' ;
7
7
import { ServicesAccessor } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation' ;
8
8
import { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands' ;
9
+ import {
10
+ MenuRegistry ,
11
+ MenuId ,
12
+ } from 'monaco-editor/esm/vs/platform/actions/common/actions' ;
9
13
10
14
export enum KeybindingWeight {
11
15
EditorCore = 0 ,
@@ -36,6 +40,31 @@ export function registerAction2(ctor: { new (): Action2 }): IDisposable {
36
40
} )
37
41
) ;
38
42
43
+ // menu
44
+ if ( Array . isArray ( menu ) ) {
45
+ disposables . add (
46
+ MenuRegistry . appendMenuItems (
47
+ menu . map ( ( item ) => ( {
48
+ id : item . id ,
49
+ item : { command, ...item } ,
50
+ } ) )
51
+ )
52
+ ) ;
53
+ } else if ( menu ) {
54
+ disposables . add (
55
+ MenuRegistry . appendMenuItem ( menu . id , { command, ...menu } )
56
+ ) ;
57
+ }
58
+ if ( f1 ) {
59
+ disposables . add (
60
+ MenuRegistry . appendMenuItem ( MenuId . CommandPalette , {
61
+ command,
62
+ when : command . precondition ,
63
+ } )
64
+ ) ;
65
+ disposables . add ( MenuRegistry . addCommand ( command ) ) ;
66
+ }
67
+
39
68
// keybinding
40
69
if ( Array . isArray ( keybinding ) ) {
41
70
for ( const item of keybinding ) {
You can’t perform that action at this time.
0 commit comments