提交 0738ae2f 编写于 作者: I isidor

menu: move debug menu registration to debug.contribution

上级 e90faf1f
......@@ -6,7 +6,6 @@
import * as nls from 'vs/nls';
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { isMacintosh } from 'vs/base/common/platform';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
recentMenuRegistration();
fileMenuRegistration();
......@@ -16,7 +15,6 @@ viewMenuRegistration();
appearanceMenuRegistration();
layoutMenuRegistration();
goMenuRegistration();
debugMenuRegistration();
tasksMenuRegistration();
if (isMacintosh) {
......@@ -1052,184 +1050,6 @@ function goMenuRegistration() {
});
}
function debugMenuRegistration() {
// Start/Stop Debug
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '1_debug',
command: {
id: 'workbench.action.debug.start',
title: nls.localize({ key: 'miStartDebugging', comment: ['&& denotes a mnemonic'] }, "&&Start Debugging"),
precondition: ContextKeyExpr.not('inDebugMode')
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '1_debug',
command: {
id: 'workbench.action.debug.run',
title: nls.localize({ key: 'miStartWithoutDebugging', comment: ['&& denotes a mnemonic'] }, "Start &&Without Debugging"),
precondition: ContextKeyExpr.not('inDebugMode')
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '1_debug',
command: {
id: 'workbench.action.debug.stop',
title: nls.localize({ key: 'miStopDebugging', comment: ['&& denotes a mnemonic'] }, "&&Stop Debugging"),
precondition: ContextKeyExpr.has('inDebugMode')
},
order: 3
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '1_debug',
command: {
id: 'workbench.action.debug.restart',
title: nls.localize({ key: 'miRestart Debugging', comment: ['&& denotes a mnemonic'] }, "&&Restart Debugging"),
precondition: ContextKeyExpr.has('inDebugMode')
},
order: 4
});
// Configuration
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '2_configuration',
command: {
id: 'workbench.action.debug.configure',
title: nls.localize({ key: 'miOpenConfigurations', comment: ['&& denotes a mnemonic'] }, "Open &&Configurations")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '2_configuration',
command: {
id: 'debug.addConfiguration',
title: nls.localize({ key: 'miAddConfiguration', comment: ['&& denotes a mnemonic'] }, "Add Configuration...")
},
order: 2
});
// Step Commands
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '3_step',
command: {
id: 'workbench.action.debug.stepOver',
title: nls.localize({ key: 'miStepOver', comment: ['&& denotes a mnemonic'] }, "Step &&Over"),
precondition: ContextKeyExpr.has('inDebugMode')
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '3_step',
command: {
id: 'workbench.action.debug.stepInto',
title: nls.localize({ key: 'miStepInto', comment: ['&& denotes a mnemonic'] }, "Step &&Into"),
precondition: ContextKeyExpr.has('inDebugMode')
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '3_step',
command: {
id: 'workbench.action.debug.stepOut',
title: nls.localize({ key: 'miStepOut', comment: ['&& denotes a mnemonic'] }, "Step O&&ut"),
precondition: ContextKeyExpr.has('inDebugMode')
},
order: 3
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '3_step',
command: {
id: 'workbench.action.debug.continue',
title: nls.localize({ key: 'miContinue', comment: ['&& denotes a mnemonic'] }, "&&Continue"),
precondition: ContextKeyExpr.has('inDebugMode')
},
order: 4
});
// New Breakpoints
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '4_new_breakpoint',
command: {
id: 'editor.debug.action.toggleBreakpoint',
title: nls.localize({ key: 'miToggleBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Breakpoint")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '4_new_breakpoint',
command: {
id: 'editor.debug.action.conditionalBreakpoint',
title: nls.localize({ key: 'miConditionalBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Conditional Breakpoint...")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '4_new_breakpoint',
command: {
id: 'editor.debug.action.toggleInlineBreakpoint',
title: nls.localize({ key: 'miInlineBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle Inline Breakp&&oint")
},
order: 3
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '4_new_breakpoint',
command: {
id: 'workbench.debug.viewlet.action.addFunctionBreakpointAction',
title: nls.localize({ key: 'miFunctionBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Function Breakpoint...")
},
order: 4
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '4_new_breakpoint',
command: {
id: 'editor.debug.action.toggleLogPoint',
title: nls.localize({ key: 'miLogPoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Logpoint...")
},
order: 5
});
// Modify Breakpoints
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '5_breakpoints',
command: {
id: 'workbench.debug.viewlet.action.enableAllBreakpoints',
title: nls.localize({ key: 'miEnableAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Enable All Breakpoints")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '5_breakpoints',
command: {
id: 'workbench.debug.viewlet.action.disableAllBreakpoints',
title: nls.localize({ key: 'miDisableAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Disable A&&ll Breakpoints")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '5_breakpoints',
command: {
id: 'workbench.debug.viewlet.action.removeAllBreakpoints',
title: nls.localize({ key: 'miRemoveAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Remove &&All Breakpoints")
},
order: 3
});
}
function tasksMenuRegistration() {
// Run Tasks
MenuRegistry.appendMenuItem(MenuId.MenubarTasksMenu, {
......
......@@ -25,6 +25,9 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { InputFocusedContext } from 'vs/platform/workbench/common/contextkeys';
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
export const ADD_CONFIGURATION_ID = 'debug.addConfiguration';
export const TOGGLE_INLINE_BREAKPOINT_ID = 'editor.debug.action.toggleInlineBreakpoint';
export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({
......@@ -171,7 +174,7 @@ export function registerCommands(): void {
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'debug.addConfiguration',
id: ADD_CONFIGURATION_ID,
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
when: undefined,
primary: undefined,
......@@ -196,7 +199,6 @@ export function registerCommands(): void {
}
});
const INLINE_BREAKPOINT_COMMAND_ID = 'editor.debug.action.toggleInlineBreakpoint';
const inlineBreakpointHandler = (accessor: ServicesAccessor) => {
const debugService = accessor.get(IDebugService);
const editorService = accessor.get(IEditorService);
......@@ -221,20 +223,20 @@ export function registerCommands(): void {
weight: KeybindingsRegistry.WEIGHT.workbenchContrib(),
primary: KeyMod.Shift | KeyCode.F9,
when: EditorContextKeys.editorTextFocus,
id: INLINE_BREAKPOINT_COMMAND_ID,
id: TOGGLE_INLINE_BREAKPOINT_ID,
handler: inlineBreakpointHandler
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: {
id: INLINE_BREAKPOINT_COMMAND_ID,
id: TOGGLE_INLINE_BREAKPOINT_ID,
title: nls.localize('inlineBreakpoint', "Inline Breakpoint"),
category: nls.localize('debug', "Debug")
}
});
MenuRegistry.appendMenuItem(MenuId.EditorContext, {
command: {
id: INLINE_BREAKPOINT_COMMAND_ID,
id: TOGGLE_INLINE_BREAKPOINT_ID,
title: nls.localize('addInlineBreakpoint', "Add Inline Breakpoint")
},
when: ContextKeyExpr.and(CONTEXT_IN_DEBUG_MODE, CONTEXT_NOT_IN_DEBUG_REPL, EditorContextKeys.writable),
......
......@@ -17,10 +17,11 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { openBreakpointSource } from 'vs/workbench/parts/debug/browser/breakpointsView';
export const TOGGLE_BREAKPOINT_ID = 'editor.debug.action.toggleBreakpoint';
class ToggleBreakpointAction extends EditorAction {
constructor() {
super({
id: 'editor.debug.action.toggleBreakpoint',
id: TOGGLE_BREAKPOINT_ID,
label: nls.localize('toggleBreakpointAction', "Debug: Toggle Breakpoint"),
alias: 'Debug: Toggle Breakpoint',
precondition: null,
......@@ -49,11 +50,12 @@ class ToggleBreakpointAction extends EditorAction {
}
}
export const TOGGLE_CONDITIONAL_BREAKPOINT_ID = 'editor.debug.action.conditionalBreakpoint';
class ConditionalBreakpointAction extends EditorAction {
constructor() {
super({
id: 'editor.debug.action.conditionalBreakpoint',
id: TOGGLE_CONDITIONAL_BREAKPOINT_ID,
label: nls.localize('conditionalBreakpointEditorAction', "Debug: Add Conditional Breakpoint..."),
alias: 'Debug: Add Conditional Breakpoint...',
precondition: null
......@@ -70,11 +72,12 @@ class ConditionalBreakpointAction extends EditorAction {
}
}
export const TOGGLE_LOG_POINT_ID = 'editor.debug.action.toggleLogPoint';
class LogPointAction extends EditorAction {
constructor() {
super({
id: 'editor.debug.action.toggleLogPoint',
id: TOGGLE_LOG_POINT_ID,
label: nls.localize('logPointEditorAction', "Debug: Add Logpoint..."),
alias: 'Debug: Add Logpoint...',
precondition: null
......
......@@ -37,7 +37,7 @@ import * as service from 'vs/workbench/parts/debug/electron-browser/debugService
import { DebugContentProvider } from 'vs/workbench/parts/debug/browser/debugContentProvider';
import 'vs/workbench/parts/debug/electron-browser/debugEditorContribution';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { registerCommands } from 'vs/workbench/parts/debug/browser/debugCommands';
import { registerCommands, ADD_CONFIGURATION_ID, TOGGLE_INLINE_BREAKPOINT_ID } from 'vs/workbench/parts/debug/browser/debugCommands';
import { IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen';
import { StatusBarColorProvider } from 'vs/workbench/parts/debug/browser/statusbarColorProvider';
import { ViewsRegistry } from 'vs/workbench/common/views';
......@@ -52,6 +52,7 @@ import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { launchSchemaId } from 'vs/workbench/services/configuration/common/configuration';
import { IEditorGroupsService } from 'vs/workbench/services/group/common/editorGroupsService';
import { LoadedScriptsView } from 'vs/workbench/parts/debug/browser/loadedScriptsView';
import { TOGGLE_LOG_POINT_ID, TOGGLE_CONDITIONAL_BREAKPOINT_ID, TOGGLE_BREAKPOINT_ID } from 'vs/workbench/parts/debug/browser/debugEditorActions';
class OpenDebugViewletAction extends ToggleViewletAction {
public static readonly ID = VIEWLET_ID;
......@@ -227,6 +228,180 @@ registerCommands();
const statusBar = Registry.as<IStatusbarRegistry>(StatusExtensions.Statusbar);
statusBar.registerStatusbarItem(new StatusbarItemDescriptor(DebugStatus, StatusbarAlignment.LEFT, 30 /* Low Priority */));
// Register debug menu
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '1_debug',
command: {
id: StartAction.ID,
title: nls.localize({ key: 'miStartDebugging', comment: ['&& denotes a mnemonic'] }, "&&Start Debugging")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '1_debug',
command: {
id: RunAction.ID,
title: nls.localize({ key: 'miStartWithoutDebugging', comment: ['&& denotes a mnemonic'] }, "Start &&Without Debugging")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '1_debug',
command: {
id: StopAction.ID,
title: nls.localize({ key: 'miStopDebugging', comment: ['&& denotes a mnemonic'] }, "&&Stop Debugging"),
precondition: CONTEXT_IN_DEBUG_MODE
},
order: 3
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '1_debug',
command: {
id: RestartAction.ID,
title: nls.localize({ key: 'miRestart Debugging', comment: ['&& denotes a mnemonic'] }, "&&Restart Debugging"),
precondition: CONTEXT_IN_DEBUG_MODE
},
order: 4
});
// Configuration
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '2_configuration',
command: {
id: ConfigureAction.ID,
title: nls.localize({ key: 'miOpenConfigurations', comment: ['&& denotes a mnemonic'] }, "Open &&Configurations")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '2_configuration',
command: {
id: ADD_CONFIGURATION_ID,
title: nls.localize({ key: 'miAddConfiguration', comment: ['&& denotes a mnemonic'] }, "Add Configuration...")
},
order: 2
});
// Step Commands
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '3_step',
command: {
id: StepOverAction.ID,
title: nls.localize({ key: 'miStepOver', comment: ['&& denotes a mnemonic'] }, "Step &&Over"),
precondition: CONTEXT_DEBUG_STATE.isEqualTo('stopped')
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '3_step',
command: {
id: StepIntoAction.ID,
title: nls.localize({ key: 'miStepInto', comment: ['&& denotes a mnemonic'] }, "Step &&Into"),
precondition: CONTEXT_DEBUG_STATE.isEqualTo('stopped')
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '3_step',
command: {
id: StepOutAction.ID,
title: nls.localize({ key: 'miStepOut', comment: ['&& denotes a mnemonic'] }, "Step O&&ut"),
precondition: CONTEXT_DEBUG_STATE.isEqualTo('stopped')
},
order: 3
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '3_step',
command: {
id: ContinueAction.ID,
title: nls.localize({ key: 'miContinue', comment: ['&& denotes a mnemonic'] }, "&&Continue"),
precondition: CONTEXT_DEBUG_STATE.isEqualTo('stopped')
},
order: 4
});
// New Breakpoints
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '4_new_breakpoint',
command: {
id: TOGGLE_BREAKPOINT_ID,
title: nls.localize({ key: 'miToggleBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Breakpoint")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '4_new_breakpoint',
command: {
id: TOGGLE_CONDITIONAL_BREAKPOINT_ID,
title: nls.localize({ key: 'miConditionalBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Conditional Breakpoint...")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '4_new_breakpoint',
command: {
id: TOGGLE_INLINE_BREAKPOINT_ID,
title: nls.localize({ key: 'miInlineBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle Inline Breakp&&oint")
},
order: 3
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '4_new_breakpoint',
command: {
id: AddFunctionBreakpointAction.ID,
title: nls.localize({ key: 'miFunctionBreakpoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Function Breakpoint...")
},
order: 4
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '4_new_breakpoint',
command: {
id: TOGGLE_LOG_POINT_ID,
title: nls.localize({ key: 'miLogPoint', comment: ['&& denotes a mnemonic'] }, "Toggle &&Logpoint...")
},
order: 5
});
// Modify Breakpoints
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '5_breakpoints',
command: {
id: EnableAllBreakpointsAction.ID,
title: nls.localize({ key: 'miEnableAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Enable All Breakpoints")
},
order: 1
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '5_breakpoints',
command: {
id: DisableAllBreakpointsAction.ID,
title: nls.localize({ key: 'miDisableAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Disable A&&ll Breakpoints")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarDebugMenu, {
group: '5_breakpoints',
command: {
id: RemoveAllBreakpointsAction.ID,
title: nls.localize({ key: 'miRemoveAllBreakpoints', comment: ['&& denotes a mnemonic'] }, "Remove &&All Breakpoints")
},
order: 3
});
// Touch Bar
if (isMacintosh) {
......
......@@ -64,7 +64,6 @@ import 'vs/workbench/parts/scm/electron-browser/scmViewlet'; // can be packaged
import 'vs/workbench/parts/debug/electron-browser/debug.contribution';
import 'vs/workbench/parts/debug/browser/debugQuickOpen';
import 'vs/workbench/parts/debug/electron-browser/repl';
import 'vs/workbench/parts/debug/browser/debugEditorActions';
import 'vs/workbench/parts/debug/browser/debugViewlet'; // can be packaged separately
import 'vs/workbench/parts/markers/electron-browser/markers.contribution';
......@@ -142,4 +141,4 @@ import 'vs/workbench/parts/navigation/common/navigation.contribution';
// services
import 'vs/workbench/services/bulkEdit/electron-browser/bulkEditService';
import 'vs/workbench/parts/experiments/electron-browser/experiments.contribution';
\ No newline at end of file
import 'vs/workbench/parts/experiments/electron-browser/experiments.contribution';
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册