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

cleanup debug commands used by process explorer

上级 f855e045
......@@ -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
}
......@@ -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<any> {
if (config && 'type' in config && 'request' in config) {
return this.debugService.startDebugging(undefined, config, this.isNoDebug());
}
public run(): Promise<any> {
const configurationManager = this.debugService.getConfigurationManager();
let launch = configurationManager.selectedConfiguration.launch;
if (!launch || launch.getConfigurationNames().length === 0) {
......
......@@ -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,
......
......@@ -130,6 +130,7 @@ Registry.as<IWorkbenchContributionsRegistry>(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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册