Skip to content

Commit 0738ae2

Browse files
committed
menu: move debug menu registration to debug.contribution
1 parent e90faf1 commit 0738ae2

5 files changed

Lines changed: 190 additions & 191 deletions

File tree

src/vs/workbench/browser/parts/menubar/menubar.contribution.ts

Lines changed: 0 additions & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import * as nls from 'vs/nls';
77
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
88
import { isMacintosh } from 'vs/base/common/platform';
9-
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
109

1110
recentMenuRegistration();
1211
fileMenuRegistration();
@@ -16,7 +15,6 @@ viewMenuRegistration();
1615
appearanceMenuRegistration();
1716
layoutMenuRegistration();
1817
goMenuRegistration();
19-
debugMenuRegistration();
2018
tasksMenuRegistration();
2119

2220
if (isMacintosh) {
@@ -1052,184 +1050,6 @@ function goMenuRegistration() {
10521050
});
10531051
}
10541052

1055-
function debugMenuRegistration() {
1056-
// Start/Stop Debug
1057-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1058-
group: '1_debug',
1059-
command: {
1060-
id: 'workbench.action.debug.start',
1061-
title: nls.localize({ key: 'miStartDebugging', comment: ['&& denotes a mnemonic'] }, "&&Start Debugging"),
1062-
precondition: ContextKeyExpr.not('inDebugMode')
1063-
},
1064-
order: 1
1065-
});
1066-
1067-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1068-
group: '1_debug',
1069-
command: {
1070-
id: 'workbench.action.debug.run',
1071-
title: nls.localize({ key: 'miStartWithoutDebugging', comment: ['&& denotes a mnemonic'] }, "Start &&Without Debugging"),
1072-
precondition: ContextKeyExpr.not('inDebugMode')
1073-
},
1074-
order: 2
1075-
});
1076-
1077-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1078-
group: '1_debug',
1079-
command: {
1080-
id: 'workbench.action.debug.stop',
1081-
title: nls.localize({ key: 'miStopDebugging', comment: ['&& denotes a mnemonic'] }, "&&Stop Debugging"),
1082-
precondition: ContextKeyExpr.has('inDebugMode')
1083-
},
1084-
order: 3
1085-
});
1086-
1087-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1088-
group: '1_debug',
1089-
command: {
1090-
id: 'workbench.action.debug.restart',
1091-
title: nls.localize({ key: 'miRestart Debugging', comment: ['&& denotes a mnemonic'] }, "&&Restart Debugging"),
1092-
precondition: ContextKeyExpr.has('inDebugMode')
1093-
},
1094-
order: 4
1095-
});
1096-
1097-
// Configuration
1098-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1099-
group: '2_configuration',
1100-
command: {
1101-
id: 'workbench.action.debug.configure',
1102-
title: nls.localize({ key: 'miOpenConfigurations', comment: ['&& denotes a mnemonic'] }, "Open &&Configurations")
1103-
},
1104-
order: 1
1105-
});
1106-
1107-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1108-
group: '2_configuration',
1109-
command: {
1110-
id: 'debug.addConfiguration',
1111-
title: nls.localize({ key: 'miAddConfiguration', comment: ['&& denotes a mnemonic'] }, "Add Configuration...")
1112-
},
1113-
order: 2
1114-
});
1115-
1116-
// Step Commands
1117-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1118-
group: '3_step',
1119-
command: {
1120-
id: 'workbench.action.debug.stepOver',
1121-
title: nls.localize({ key: 'miStepOver', comment: ['&& denotes a mnemonic'] }, "Step &&Over"),
1122-
precondition: ContextKeyExpr.has('inDebugMode')
1123-
},
1124-
order: 1
1125-
});
1126-
1127-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1128-
group: '3_step',
1129-
command: {
1130-
id: 'workbench.action.debug.stepInto',
1131-
title: nls.localize({ key: 'miStepInto', comment: ['&& denotes a mnemonic'] }, "Step &&Into"),
1132-
precondition: ContextKeyExpr.has('inDebugMode')
1133-
},
1134-
order: 2
1135-
});
1136-
1137-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1138-
group: '3_step',
1139-
command: {
1140-
id: 'workbench.action.debug.stepOut',
1141-
title: nls.localize({ key: 'miStepOut', comment: ['&& denotes a mnemonic'] }, "Step O&&ut"),
1142-
precondition: ContextKeyExpr.has('inDebugMode')
1143-
},
1144-
order: 3
1145-
});
1146-
1147-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1148-
group: '3_step',
1149-
command: {
1150-
id: 'workbench.action.debug.continue',
1151-
title: nls.localize({ key: 'miContinue', comment: ['&& denotes a mnemonic'] }, "&&Continue"),
1152-
precondition: ContextKeyExpr.has('inDebugMode')
1153-
},
1154-
order: 4
1155-
});
1156-
1157-
// New Breakpoints
1158-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1159-
group: '4_new_breakpoint',
1160-
command: {
1161-
id: 'editor.debug.action.toggleBreakpoint',
1162-
title: nls.localize({ key: 'miToggleBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Breakpoint")
1163-
},
1164-
order: 1
1165-
});
1166-
1167-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1168-
group: '4_new_breakpoint',
1169-
command: {
1170-
id: 'editor.debug.action.conditionalBreakpoint',
1171-
title: nls.localize({ key: 'miConditionalBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Conditional Breakpoint...")
1172-
},
1173-
order: 2
1174-
});
1175-
1176-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1177-
group: '4_new_breakpoint',
1178-
command: {
1179-
id: 'editor.debug.action.toggleInlineBreakpoint',
1180-
title: nls.localize({ key: 'miInlineBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle Inline Breakp&&oint")
1181-
},
1182-
order: 3
1183-
});
1184-
1185-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1186-
group: '4_new_breakpoint',
1187-
command: {
1188-
id: 'workbench.debug.viewlet.action.addFunctionBreakpointAction',
1189-
title: nls.localize({ key: 'miFunctionBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Function Breakpoint...")
1190-
},
1191-
order: 4
1192-
});
1193-
1194-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1195-
group: '4_new_breakpoint',
1196-
command: {
1197-
id: 'editor.debug.action.toggleLogPoint',
1198-
title: nls.localize({ key: 'miLogPoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Logpoint...")
1199-
},
1200-
order: 5
1201-
});
1202-
1203-
// Modify Breakpoints
1204-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1205-
group: '5_breakpoints',
1206-
command: {
1207-
id: 'workbench.debug.viewlet.action.enableAllBreakpoints',
1208-
title: nls.localize({ key: 'miEnableAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Enable All Breakpoints")
1209-
},
1210-
order: 1
1211-
});
1212-
1213-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1214-
group: '5_breakpoints',
1215-
command: {
1216-
id: 'workbench.debug.viewlet.action.disableAllBreakpoints',
1217-
title: nls.localize({ key: 'miDisableAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Disable A&&ll Breakpoints")
1218-
},
1219-
order: 2
1220-
});
1221-
1222-
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
1223-
group: '5_breakpoints',
1224-
command: {
1225-
id: 'workbench.debug.viewlet.action.removeAllBreakpoints',
1226-
title: nls.localize({ key: 'miRemoveAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Remove &&All Breakpoints")
1227-
},
1228-
order: 3
1229-
});
1230-
1231-
}
1232-
12331053
function tasksMenuRegistration() {
12341054
// Run Tasks
12351055
MenuRegistry.appendMenuItem(MenuId.MenubarTasksMenu, {

src/vs/workbench/parts/debug/browser/debugCommands.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
2525
import { InputFocusedContext } from 'vs/platform/workbench/common/contextkeys';
2626
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
2727

28+
export const ADD_CONFIGURATION_ID = 'debug.addConfiguration';
29+
export const TOGGLE_INLINE_BREAKPOINT_ID = 'editor.debug.action.toggleInlineBreakpoint';
30+
2831
export function registerCommands(): void {
2932

3033
KeybindingsRegistry.registerCommandAndKeybindingRule({
@@ -171,7 +174,7 @@ export function registerCommands(): void {
171174
});
172175

173176
KeybindingsRegistry.registerCommandAndKeybindingRule({
174-
id: 'debug.addConfiguration',
177+
id: ADD_CONFIGURATION_ID,
175178
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
176179
when: undefined,
177180
primary: undefined,
@@ -196,7 +199,6 @@ export function registerCommands(): void {
196199
}
197200
});
198201

199-
const INLINE_BREAKPOINT_COMMAND_ID = 'editor.debug.action.toggleInlineBreakpoint';
200202
const inlineBreakpointHandler = (accessor: ServicesAccessor) => {
201203
const debugService = accessor.get(IDebugService);
202204
const editorService = accessor.get(IEditorService);
@@ -221,20 +223,20 @@ export function registerCommands(): void {
221223
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
222224
primary: KeyMod.Shift | KeyCode.F9,
223225
when: EditorContextKeys.editorTextFocus,
224-
id: INLINE_BREAKPOINT_COMMAND_ID,
226+
id: TOGGLE_INLINE_BREAKPOINT_ID,
225227
handler: inlineBreakpointHandler
226228
});
227229

228230
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
229231
command: {
230-
id: INLINE_BREAKPOINT_COMMAND_ID,
232+
id: TOGGLE_INLINE_BREAKPOINT_ID,
231233
title: nls.localize('inlineBreakpoint', "Inline Breakpoint"),
232234
category: nls.localize('debug', "Debug")
233235
}
234236
});
235237
MenuRegistry.appendMenuItem(MenuId.EditorContext, {
236238
command: {
237-
id: INLINE_BREAKPOINT_COMMAND_ID,
239+
id: TOGGLE_INLINE_BREAKPOINT_ID,
238240
title: nls.localize('addInlineBreakpoint', "Add Inline Breakpoint")
239241
},
240242
when: ContextKeyExpr.and(CONTEXT_IN_DEBUG_MODE, CONTEXT_NOT_IN_DEBUG_REPL, EditorContextKeys.writable),

src/vs/workbench/parts/debug/browser/debugEditorActions.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
1717
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
1818
import { openBreakpointSource } from 'vs/workbench/parts/debug/browser/breakpointsView';
1919

20+
export const TOGGLE_BREAKPOINT_ID = 'editor.debug.action.toggleBreakpoint';
2021
class ToggleBreakpointAction extends EditorAction {
2122
constructor() {
2223
super({
23-
id: 'editor.debug.action.toggleBreakpoint',
24+
id: TOGGLE_BREAKPOINT_ID,
2425
label: nls.localize('toggleBreakpointAction', "Debug: Toggle Breakpoint"),
2526
alias: 'Debug: Toggle Breakpoint',
2627
precondition: null,
@@ -49,11 +50,12 @@ class ToggleBreakpointAction extends EditorAction {
4950
}
5051
}
5152

53+
export const TOGGLE_CONDITIONAL_BREAKPOINT_ID = 'editor.debug.action.conditionalBreakpoint';
5254
class ConditionalBreakpointAction extends EditorAction {
5355

5456
constructor() {
5557
super({
56-
id: 'editor.debug.action.conditionalBreakpoint',
58+
id: TOGGLE_CONDITIONAL_BREAKPOINT_ID,
5759
label: nls.localize('conditionalBreakpointEditorAction', "Debug: Add Conditional Breakpoint..."),
5860
alias: 'Debug: Add Conditional Breakpoint...',
5961
precondition: null
@@ -70,11 +72,12 @@ class ConditionalBreakpointAction extends EditorAction {
7072
}
7173
}
7274

75+
export const TOGGLE_LOG_POINT_ID = 'editor.debug.action.toggleLogPoint';
7376
class LogPointAction extends EditorAction {
7477

7578
constructor() {
7679
super({
77-
id: 'editor.debug.action.toggleLogPoint',
80+
id: TOGGLE_LOG_POINT_ID,
7881
label: nls.localize('logPointEditorAction', "Debug: Add Logpoint..."),
7982
alias: 'Debug: Add Logpoint...',
8083
precondition: null

0 commit comments

Comments
 (0)