@@ -58,49 +58,44 @@ export function isISubmenuItem(item: IMenuItem | ISubmenuItem): item is ISubmenu
5858 return ( item as ISubmenuItem ) . submenu !== undefined ;
5959}
6060
61- export class MenuId {
62-
63- private static ID = 1 ;
64-
65- static readonly EditorTitle = new MenuId ( ) ;
66- static readonly EditorTitleContext = new MenuId ( ) ;
67- static readonly EditorContext = new MenuId ( ) ;
68- static readonly EmptyEditorGroupContext = new MenuId ( ) ;
69- static readonly ExplorerContext = new MenuId ( ) ;
70- static readonly OpenEditorsContext = new MenuId ( ) ;
71- static readonly ProblemsPanelContext = new MenuId ( ) ;
72- static readonly DebugVariablesContext = new MenuId ( ) ;
73- static readonly DebugWatchContext = new MenuId ( ) ;
74- static readonly DebugCallStackContext = new MenuId ( ) ;
75- static readonly DebugBreakpointsContext = new MenuId ( ) ;
76- static readonly DebugConsoleContext = new MenuId ( ) ;
77- static readonly SCMTitle = new MenuId ( ) ;
78- static readonly SCMSourceControl = new MenuId ( ) ;
79- static readonly SCMResourceGroupContext = new MenuId ( ) ;
80- static readonly SCMResourceContext = new MenuId ( ) ;
81- static readonly SCMChangeContext = new MenuId ( ) ;
82- static readonly CommandPalette = new MenuId ( ) ;
83- static readonly ViewTitle = new MenuId ( ) ;
84- static readonly ViewItemContext = new MenuId ( ) ;
85- static readonly TouchBarContext = new MenuId ( ) ;
86- static readonly SearchContext = new MenuId ( ) ;
87- static readonly MenubarFileMenu = new MenuId ( ) ;
88- static readonly MenubarEditMenu = new MenuId ( ) ;
89- static readonly MenubarRecentMenu = new MenuId ( ) ;
90- static readonly MenubarSelectionMenu = new MenuId ( ) ;
91- static readonly MenubarViewMenu = new MenuId ( ) ;
92- static readonly MenubarAppearanceMenu = new MenuId ( ) ;
93- static readonly MenubarLayoutMenu = new MenuId ( ) ;
94- static readonly MenubarGoMenu = new MenuId ( ) ;
95- static readonly MenubarSwitchEditorMenu = new MenuId ( ) ;
96- static readonly MenubarSwitchGroupMenu = new MenuId ( ) ;
97- static readonly MenubarDebugMenu = new MenuId ( ) ;
98- static readonly MenubarNewBreakpointMenu = new MenuId ( ) ;
99- static readonly MenubarPreferencesMenu = new MenuId ( ) ;
100- static readonly MenubarHelpMenu = new MenuId ( ) ;
101- static readonly MenubarTerminalMenu = new MenuId ( ) ;
102-
103- readonly id : string = String ( MenuId . ID ++ ) ;
61+ export const enum MenuId {
62+ EditorTitle ,
63+ EditorTitleContext ,
64+ EditorContext ,
65+ EmptyEditorGroupContext ,
66+ ExplorerContext ,
67+ OpenEditorsContext ,
68+ ProblemsPanelContext ,
69+ DebugVariablesContext ,
70+ DebugWatchContext ,
71+ DebugCallStackContext ,
72+ DebugBreakpointsContext ,
73+ DebugConsoleContext ,
74+ SCMTitle ,
75+ SCMSourceControl ,
76+ SCMResourceGroupContext ,
77+ SCMResourceContext ,
78+ SCMChangeContext ,
79+ CommandPalette ,
80+ ViewTitle ,
81+ ViewItemContext ,
82+ TouchBarContext ,
83+ SearchContext ,
84+ MenubarFileMenu ,
85+ MenubarEditMenu ,
86+ MenubarRecentMenu ,
87+ MenubarSelectionMenu ,
88+ MenubarViewMenu ,
89+ MenubarAppearanceMenu ,
90+ MenubarLayoutMenu ,
91+ MenubarGoMenu ,
92+ MenubarSwitchEditorMenu ,
93+ MenubarSwitchGroupMenu ,
94+ MenubarDebugMenu ,
95+ MenubarNewBreakpointMenu ,
96+ MenubarPreferencesMenu ,
97+ MenubarHelpMenu ,
98+ MenubarTerminalMenu ,
10499}
105100
106101export interface IMenuActionOptions {
@@ -162,9 +157,9 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
162157 }
163158
164159 appendMenuItem ( id : MenuId , item : IMenuItem | ISubmenuItem ) : IDisposable {
165- let array = this . _menuItems [ id . id ] ;
160+ let array = this . _menuItems [ id ] ;
166161 if ( ! array ) {
167- this . _menuItems [ id . id ] = array = [ item ] ;
162+ this . _menuItems [ id ] = array = [ item ] ;
168163 } else {
169164 array . push ( item ) ;
170165 }
@@ -180,10 +175,10 @@ export const MenuRegistry: IMenuRegistry = new class implements IMenuRegistry {
180175 } ;
181176 }
182177
183- getMenuItems ( { id } : MenuId ) : ( IMenuItem | ISubmenuItem ) [ ] {
178+ getMenuItems ( id : MenuId ) : ( IMenuItem | ISubmenuItem ) [ ] {
184179 const result = this . _menuItems [ id ] || [ ] ;
185180
186- if ( id === MenuId . CommandPalette . id ) {
181+ if ( id === MenuId . CommandPalette ) {
187182 // CommandPalette is special because it shows
188183 // all commands by default
189184 this . _appendImplicitItems ( result ) ;
0 commit comments