提交 fc47f07c 编写于 作者: I isidor

debug actions: final polish

上级 0c203ce8
......@@ -8,12 +8,9 @@ import { Action } from 'vs/base/common/actions';
import * as lifecycle from 'vs/base/common/lifecycle';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IDebugService, State, IEnablement, IBreakpoint, REPL_ID } from 'vs/workbench/contrib/debug/common/debug';
import { Variable, Expression, Breakpoint } from 'vs/workbench/contrib/debug/common/debugModel';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IDebugService, State, IEnablement, IBreakpoint } from 'vs/workbench/contrib/debug/common/debug';
import { Variable, Breakpoint } from 'vs/workbench/contrib/debug/common/debugModel';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { TogglePanelAction } from 'vs/workbench/browser/panel';
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IHistoryService } from 'vs/workbench/services/history/common/history';
......@@ -338,20 +335,6 @@ export class AddWatchExpressionAction extends AbstractDebugAction {
}
}
export class EditWatchExpressionAction extends AbstractDebugAction {
static readonly ID = 'workbench.debug.viewlet.action.editWatchExpression';
static LABEL = nls.localize('editWatchExpression', "Edit Expression");
constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) {
super(id, label, '', debugService, keybindingService);
}
public run(expression: Expression): Promise<any> {
this.debugService.getViewModel().setSelectedExpression(expression);
return Promise.resolve();
}
}
export class RemoveAllWatchExpressionsAction extends AbstractDebugAction {
static readonly ID = 'workbench.debug.viewlet.action.removeAllWatchExpressions';
static LABEL = nls.localize('removeAllWatchExpressions', "Remove All Expressions");
......@@ -371,35 +354,6 @@ export class RemoveAllWatchExpressionsAction extends AbstractDebugAction {
}
}
export class ToggleReplAction extends TogglePanelAction {
static readonly ID = 'workbench.debug.action.toggleRepl';
static LABEL = nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugConsoleAction' }, 'Debug Console');
private toDispose: lifecycle.IDisposable[];
constructor(id: string, label: string,
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
@IPanelService panelService: IPanelService
) {
super(id, label, REPL_ID, panelService, layoutService, 'debug-action toggle-repl');
this.toDispose = [];
this.registerListeners();
}
private registerListeners(): void {
this.toDispose.push(this.panelService.onDidPanelOpen(({ panel }) => {
if (panel.getId() === REPL_ID) {
this.class = 'debug-action toggle-repl';
this.tooltip = ToggleReplAction.LABEL;
}
}));
}
public dispose(): void {
super.dispose();
this.toDispose = lifecycle.dispose(this.toDispose);
}
}
export class FocusSessionAction extends AbstractDebugAction {
static readonly ID = 'workbench.action.debug.focusProcess';
static LABEL = nls.localize('focusSession', "Focus Session");
......
......@@ -9,8 +9,8 @@ import { IAction } from 'vs/base/common/actions';
import * as DOM from 'vs/base/browser/dom';
import { IActionItem } from 'vs/base/browser/ui/actionbar/actionbar';
import { ViewContainerViewlet } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { IDebugService, VIEWLET_ID, State, BREAKPOINTS_VIEW_ID, IDebugConfiguration } from 'vs/workbench/contrib/debug/common/debug';
import { StartAction, ToggleReplAction, ConfigureAction, SelectAndStartAction, FocusSessionAction } from 'vs/workbench/contrib/debug/browser/debugActions';
import { IDebugService, VIEWLET_ID, State, BREAKPOINTS_VIEW_ID, IDebugConfiguration, REPL_ID } from 'vs/workbench/contrib/debug/common/debug';
import { StartAction, ConfigureAction, SelectAndStartAction, FocusSessionAction } from 'vs/workbench/contrib/debug/browser/debugActions';
import { StartDebugActionItem, FocusSessionActionItem } from 'vs/workbench/contrib/debug/browser/debugActionItems';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
......@@ -31,6 +31,8 @@ import { IMenu, MenuId, IMenuService, MenuItemAction } from 'vs/platform/actions
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { MenuItemActionItem } from 'vs/platform/actions/browser/menuItemActionItem';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { TogglePanelAction } from 'vs/workbench/browser/panel';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
export class DebugViewlet extends ViewContainerViewlet {
......@@ -193,3 +195,15 @@ export class DebugViewlet extends ViewContainerViewlet {
}
}
}
class ToggleReplAction extends TogglePanelAction {
static readonly ID = 'debug.toggleRepl';
static LABEL = nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'debugConsoleAction' }, 'Debug Console');
constructor(id: string, label: string,
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
@IPanelService panelService: IPanelService
) {
super(id, label, REPL_ID, panelService, layoutService, 'debug-action toggle-repl');
}
}
......@@ -10,7 +10,7 @@ import { CollapseAction } from 'vs/workbench/browser/viewlet';
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { IDebugService, IExpression, CONTEXT_WATCH_EXPRESSIONS_FOCUSED } from 'vs/workbench/contrib/debug/common/debug';
import { Expression, Variable } from 'vs/workbench/contrib/debug/common/debugModel';
import { AddWatchExpressionAction, RemoveAllWatchExpressionsAction, EditWatchExpressionAction, CopyValueAction } from 'vs/workbench/contrib/debug/browser/debugActions';
import { AddWatchExpressionAction, RemoveAllWatchExpressionsAction, CopyValueAction } from 'vs/workbench/contrib/debug/browser/debugActions';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
......@@ -144,7 +144,10 @@ export class WatchExpressionsView extends ViewletPanel {
if (element instanceof Expression) {
const expression = <Expression>element;
actions.push(new AddWatchExpressionAction(AddWatchExpressionAction.ID, AddWatchExpressionAction.LABEL, this.debugService, this.keybindingService));
actions.push(new EditWatchExpressionAction(EditWatchExpressionAction.ID, EditWatchExpressionAction.LABEL, this.debugService, this.keybindingService));
actions.push(new Action('debug.editWatchExpression', nls.localize('editWatchExpression', "Edit Expression"), undefined, true, () => {
this.debugService.getViewModel().setSelectedExpression(expression);
return Promise.resolve();
}));
if (!expression.hasChildren) {
actions.push(this.instantiationService.createInstance(CopyValueAction, CopyValueAction.ID, CopyValueAction.LABEL, expression.value, 'watch', this.debugService));
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册