提交 959669be 编写于 作者: I isidor

cleanup debug commands used by process explorer

上级 f855e045
...@@ -96,7 +96,7 @@ function attachTo(item: ProcessItem) { ...@@ -96,7 +96,7 @@ function attachTo(item: ProcessItem) {
config.port = parseInt(matches[2]); 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) { function getProcessIdWithHighestProperty(processList, propertyName: string) {
...@@ -299,4 +299,4 @@ export function startup(data: ProcessExplorerData): void { ...@@ -299,4 +299,4 @@ export function startup(data: ProcessExplorerData): void {
applyZoom(webFrame.getZoomLevel() - 1); applyZoom(webFrame.getZoomLevel() - 1);
} }
}; };
} }
\ No newline at end of file
...@@ -10,7 +10,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; ...@@ -10,7 +10,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ICommandService } from 'vs/platform/commands/common/commands'; import { ICommandService } from 'vs/platform/commands/common/commands';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace'; import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IFileService } from 'vs/platform/files/common/files'; 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'; from 'vs/workbench/parts/debug/common/debug';
import { Variable, Expression, Thread, Breakpoint } from 'vs/workbench/parts/debug/common/debugModel'; import { Variable, Expression, Thread, Breakpoint } from 'vs/workbench/parts/debug/common/debugModel';
import { IPartService } from 'vs/workbench/services/part/common/partService'; import { IPartService } from 'vs/workbench/services/part/common/partService';
...@@ -135,11 +135,7 @@ export class StartAction extends AbstractDebugAction { ...@@ -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 // Note: When this action is executed from the process explorer, a config is passed. For all
// other cases it is run with no arguments. // other cases it is run with no arguments.
public run(config?: IConfig): Promise<any> { public run(): Promise<any> {
if (config && 'type' in config && 'request' in config) {
return this.debugService.startDebugging(undefined, config, this.isNoDebug());
}
const configurationManager = this.debugService.getConfigurationManager(); const configurationManager = this.debugService.getConfigurationManager();
let launch = configurationManager.selectedConfiguration.launch; let launch = configurationManager.selectedConfiguration.launch;
if (!launch || launch.getConfigurationNames().length === 0) { if (!launch || launch.getConfigurationNames().length === 0) {
......
...@@ -23,43 +23,22 @@ import { INotificationService } from 'vs/platform/notification/common/notificati ...@@ -23,43 +23,22 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { InputFocusedContext } from 'vs/platform/workbench/common/contextkeys'; import { InputFocusedContext } from 'vs/platform/workbench/common/contextkeys';
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions'; import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
import { PanelFocusContext } from 'vs/workbench/browser/parts/panel/panelPart'; import { PanelFocusContext } from 'vs/workbench/browser/parts/panel/panelPart';
import { StartAction } from 'vs/workbench/parts/debug/browser/debugActions'; import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { onUnexpectedError } from 'vs/base/common/errors';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
export const ADD_CONFIGURATION_ID = 'debug.addConfiguration'; export const ADD_CONFIGURATION_ID = 'debug.addConfiguration';
export const TOGGLE_INLINE_BREAKPOINT_ID = 'editor.debug.action.toggleInlineBreakpoint'; export const TOGGLE_INLINE_BREAKPOINT_ID = 'editor.debug.action.toggleInlineBreakpoint';
export function registerCommands(): void { export function registerCommands(): void {
KeybindingsRegistry.registerCommandAndKeybindingRule({ CommandsRegistry.registerCommand({
id: StartAction.ID, id: 'debug.startFromConfig',
weight: KeybindingWeight.WorkbenchContrib, handler: (accessor, config: IConfig) => {
when: CONTEXT_IN_DEBUG_MODE.toNegated(),
primary: KeyCode.F5,
handler: (accessor, config?: IConfig) => {
const notificationService = accessor.get(INotificationService);
const keybindingService = accessor.get(IKeybindingService);
const debugService = accessor.get(IDebugService); const debugService = accessor.get(IDebugService);
const contextService = accessor.get(IWorkspaceContextService); debugService.startDebugging(undefined, config).then(undefined, onUnexpectedError);
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);
});
} }
}); });
KeybindingsRegistry.registerCommandAndKeybindingRule({ KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'debug.toggleBreakpoint', id: 'debug.toggleBreakpoint',
weight: KeybindingWeight.WorkbenchContrib + 5, weight: KeybindingWeight.WorkbenchContrib + 5,
...@@ -257,12 +236,6 @@ export function registerCommands(): void { ...@@ -257,12 +236,6 @@ export function registerCommands(): void {
handler: inlineBreakpointHandler handler: inlineBreakpointHandler
}); });
MenuRegistry.addCommand({
id: StartAction.ID,
title: StartAction.LABEL,
category: nls.localize('debug', "Debug")
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
command: { command: {
id: TOGGLE_INLINE_BREAKPOINT_ID, id: TOGGLE_INLINE_BREAKPOINT_ID,
......
...@@ -130,6 +130,7 @@ Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).regi ...@@ -130,6 +130,7 @@ Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).regi
const debugCategory = nls.localize('debugCategory', "Debug"); 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(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(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); registry.registerWorkbenchAction(new SyncActionDescriptor(StepOutAction, StepOutAction.ID, StepOutAction.LABEL, { primary: KeyMod.Shift | KeyCode.F11 }, CONTEXT_IN_DEBUG_MODE), 'Debug: Step Out', debugCategory);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册