diff --git a/src/vs/code/electron-browser/processExplorer/processExplorerMain.ts b/src/vs/code/electron-browser/processExplorer/processExplorerMain.ts index aa8210ae770934c6a07ee77d205d6a438696ec1c..a3a47fd39a96b4218e5611f14008a9e83904e85f 100644 --- a/src/vs/code/electron-browser/processExplorer/processExplorerMain.ts +++ b/src/vs/code/electron-browser/processExplorer/processExplorerMain.ts @@ -96,7 +96,7 @@ function attachTo(item: ProcessItem) { config.port = parseInt(matches[2]); } - ipcRenderer.send('vscode:workbenchCommand', { id: 'workbench.action.debug.start', from: 'processExplorer', args: [config] }); + ipcRenderer.send('vscode:workbenchCommand', { id: 'debug.startFromConfig', from: 'processExplorer', args: [config] }); } function getProcessIdWithHighestProperty(processList, propertyName: string) { @@ -299,4 +299,4 @@ export function startup(data: ProcessExplorerData): void { applyZoom(webFrame.getZoomLevel() - 1); } }; -} \ No newline at end of file +} diff --git a/src/vs/workbench/parts/debug/browser/debugActions.ts b/src/vs/workbench/parts/debug/browser/debugActions.ts index 26f3536fe9cb1684567d8f222245e7bff4c7f197..7485fe71b15e187f32de8c53b22cea4480459e32 100644 --- a/src/vs/workbench/parts/debug/browser/debugActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugActions.ts @@ -10,7 +10,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { ICommandService } from 'vs/platform/commands/common/commands'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IFileService } from 'vs/platform/files/common/files'; -import { IDebugService, State, IDebugSession, IThread, IEnablement, IBreakpoint, IStackFrame, REPL_ID, IConfig } +import { IDebugService, State, IDebugSession, IThread, IEnablement, IBreakpoint, IStackFrame, REPL_ID } from 'vs/workbench/parts/debug/common/debug'; import { Variable, Expression, Thread, Breakpoint } from 'vs/workbench/parts/debug/common/debugModel'; import { IPartService } from 'vs/workbench/services/part/common/partService'; @@ -135,11 +135,7 @@ export class StartAction extends AbstractDebugAction { // Note: When this action is executed from the process explorer, a config is passed. For all // other cases it is run with no arguments. - public run(config?: IConfig): Promise { - if (config && 'type' in config && 'request' in config) { - return this.debugService.startDebugging(undefined, config, this.isNoDebug()); - } - + public run(): Promise { const configurationManager = this.debugService.getConfigurationManager(); let launch = configurationManager.selectedConfiguration.launch; if (!launch || launch.getConfigurationNames().length === 0) { diff --git a/src/vs/workbench/parts/debug/browser/debugCommands.ts b/src/vs/workbench/parts/debug/browser/debugCommands.ts index cb0180013d676fed8fc8c8afff0fe97034955fdc..f983c1cc2d03af58b6e677c8b105145e9884ed42 100644 --- a/src/vs/workbench/parts/debug/browser/debugCommands.ts +++ b/src/vs/workbench/parts/debug/browser/debugCommands.ts @@ -23,43 +23,22 @@ import { INotificationService } from 'vs/platform/notification/common/notificati import { InputFocusedContext } from 'vs/platform/workbench/common/contextkeys'; import { ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { PanelFocusContext } from 'vs/workbench/browser/parts/panel/panelPart'; -import { StartAction } from 'vs/workbench/parts/debug/browser/debugActions'; -import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { IHistoryService } from 'vs/workbench/services/history/common/history'; +import { CommandsRegistry } from 'vs/platform/commands/common/commands'; +import { onUnexpectedError } from 'vs/base/common/errors'; export const ADD_CONFIGURATION_ID = 'debug.addConfiguration'; export const TOGGLE_INLINE_BREAKPOINT_ID = 'editor.debug.action.toggleInlineBreakpoint'; export function registerCommands(): void { - KeybindingsRegistry.registerCommandAndKeybindingRule({ - id: StartAction.ID, - weight: KeybindingWeight.WorkbenchContrib, - when: CONTEXT_IN_DEBUG_MODE.toNegated(), - primary: KeyCode.F5, - handler: (accessor, config?: IConfig) => { - const notificationService = accessor.get(INotificationService); - const keybindingService = accessor.get(IKeybindingService); + CommandsRegistry.registerCommand({ + id: 'debug.startFromConfig', + handler: (accessor, config: IConfig) => { const debugService = accessor.get(IDebugService); - const contextService = accessor.get(IWorkspaceContextService); - const historyService = accessor.get(IHistoryService); - - const startAction = new StartAction(StartAction.ID, StartAction.LABEL, debugService, keybindingService, contextService, historyService); - if (!startAction.enabled) { - startAction.dispose(); - return undefined; - } - - startAction.run(config).then(_ => { - startAction.dispose(); - }, err => { - startAction.dispose(); - notificationService.error(err); - }); + debugService.startDebugging(undefined, config).then(undefined, onUnexpectedError); } }); - KeybindingsRegistry.registerCommandAndKeybindingRule({ id: 'debug.toggleBreakpoint', weight: KeybindingWeight.WorkbenchContrib + 5, @@ -257,12 +236,6 @@ export function registerCommands(): void { handler: inlineBreakpointHandler }); - MenuRegistry.addCommand({ - id: StartAction.ID, - title: StartAction.LABEL, - category: nls.localize('debug', "Debug") - }); - MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: TOGGLE_INLINE_BREAKPOINT_ID, diff --git a/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts b/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts index 42a3d00300006ec4522359e1e3d8505f4d912b07..e99c0bc453e6cd615141804c4e7c2456319e8875 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts @@ -130,6 +130,7 @@ Registry.as(WorkbenchExtensions.Workbench).regi const debugCategory = nls.localize('debugCategory', "Debug"); +registry.registerWorkbenchAction(new SyncActionDescriptor(StartAction, StartAction.ID, StartAction.LABEL, { primary: KeyCode.F5 }), 'Debug: Start Debugging', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(StepOverAction, StepOverAction.ID, StepOverAction.LABEL, { primary: KeyCode.F10 }, CONTEXT_IN_DEBUG_MODE), 'Debug: Step Over', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(StepIntoAction, StepIntoAction.ID, StepIntoAction.LABEL, { primary: KeyCode.F11 }, CONTEXT_IN_DEBUG_MODE, KeybindingWeight.WorkbenchContrib + 1), 'Debug: Step Into', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(StepOutAction, StepOutAction.ID, StepOutAction.LABEL, { primary: KeyMod.Shift | KeyCode.F11 }, CONTEXT_IN_DEBUG_MODE), 'Debug: Step Out', debugCategory);