diff --git a/src/vs/code/electron-main/menus.ts b/src/vs/code/electron-main/menus.ts index f7775e1c8f143f3d4415db86fffdbf8c648c21f1..5f0f989a68ed9a487953390ce910c806c0d67576 100644 --- a/src/vs/code/electron-main/menus.ts +++ b/src/vs/code/electron-main/menus.ts @@ -496,7 +496,7 @@ export class VSCodeMenu { const debug = this.createMenuItem(nls.localize({ key: 'miViewDebug', comment: ['&& denotes a mnemonic'] }, "&&Debug"), 'workbench.view.debug'); const extensions = this.createMenuItem(nls.localize({ key: 'miViewExtensions', comment: ['&& denotes a mnemonic'] }, "E&&xtensions"), 'workbench.view.extensions'); const output = this.createMenuItem(nls.localize({ key: 'miToggleOutput', comment: ['&& denotes a mnemonic'] }, "&&Output"), 'workbench.action.output.toggleOutput'); - const debugConsole = this.createMenuItem(nls.localize({ key: 'miToggleDebugConsole', comment: ['&& denotes a mnemonic'] }, "De&&bug Console"), 'workbench.debug.action.toggleRepl'); + const debugConsole = this.createMenuItem(nls.localize({ key: 'miToggleDebugConsole', comment: ['&& denotes a mnemonic'] }, "De&&bug Console"), 'workbench.panel.repl'); const integratedTerminal = this.createMenuItem(nls.localize({ key: 'miToggleIntegratedTerminal', comment: ['&& denotes a mnemonic'] }, "&&Integrated Terminal"), 'workbench.action.terminal.toggleTerminal'); const problems = this.createMenuItem(nls.localize({ key: 'miMarker', comment: ['&& denotes a mnemonic'] }, "&&Problems"), 'workbench.actions.view.problems'); diff --git a/src/vs/workbench/parts/debug/browser/debugActions.ts b/src/vs/workbench/parts/debug/browser/debugActions.ts index f88ec15f033f9ea1ab2a2488abe09b02d860bc77..f8640c7cf3f44757d32be6bd8d40b722465f2771 100644 --- a/src/vs/workbench/parts/debug/browser/debugActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugActions.ts @@ -19,7 +19,6 @@ import {IInstantiationService} from 'vs/platform/instantiation/common/instantiat import debug = require('vs/workbench/parts/debug/common/debug'); import model = require('vs/workbench/parts/debug/common/debugModel'); import {BreakpointWidget} from 'vs/workbench/parts/debug/browser/breakpointWidget'; -import {IPartService} from 'vs/workbench/services/part/common/partService'; import {IPanelService} from 'vs/workbench/services/panel/common/panelService'; import {IViewletService} from 'vs/workbench/services/viewlet/common/viewletService'; import IDebugService = debug.IDebugService; @@ -827,51 +826,6 @@ export class ClearReplAction extends AbstractDebugAction { } } -export class ToggleReplAction extends AbstractDebugAction { - static ID = 'workbench.debug.action.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, - @IDebugService debugService: IDebugService, - @IPartService private partService: IPartService, - @IPanelService private panelService: IPanelService, - @IKeybindingService keybindingService: IKeybindingService - ) { - super(id, label, 'debug-action toggle-repl', debugService, keybindingService); - this.enabled = this.debugService.state !== debug.State.Disabled; - this.registerListeners(); - } - - public run(): TPromise { - if (this.isReplVisible()) { - this.partService.setPanelHidden(true); - return TPromise.as(null); - } - - return this.panelService.openPanel(debug.REPL_ID, true); - } - - private registerListeners(): void { - this.toDispose.push(this.debugService.getModel().onDidChangeReplElements(() => { - if (!this.isReplVisible()) { - this.class = 'debug-action toggle-repl notification'; - this.tooltip = nls.localize('unreadOutput', "New Output in Debug Console"); - } - })); - this.toDispose.push(this.panelService.onDidPanelOpen(panel => { - if (panel.getId() === debug.REPL_ID) { - this.class = 'debug-action toggle-repl'; - this.tooltip = ToggleReplAction.LABEL; - } - })); - } - - private isReplVisible(): boolean { - const panel = this.panelService.getActivePanel(); - return panel && panel.getId() === debug.REPL_ID; - } -} - export class FocusReplAction extends Action { static ID = 'workbench.debug.action.focusRepl'; diff --git a/src/vs/workbench/parts/debug/browser/debugViewlet.ts b/src/vs/workbench/parts/debug/browser/debugViewlet.ts index 50e3595eb4ede588f32c38fb5fd518e9950c8166..ee24e4100a6174ba23c1f4953948020a81707d8d 100644 --- a/src/vs/workbench/parts/debug/browser/debugViewlet.ts +++ b/src/vs/workbench/parts/debug/browser/debugViewlet.ts @@ -126,8 +126,7 @@ export class DebugViewlet extends Viewlet { this.actions = [ this.instantiationService.createInstance(debugactions.StartAction, debugactions.StartAction.ID, debugactions.StartAction.LABEL), this.instantiationService.createInstance(debugactions.SelectConfigAction, debugactions.SelectConfigAction.ID, debugactions.SelectConfigAction.LABEL), - this.instantiationService.createInstance(debugactions.ConfigureAction, debugactions.ConfigureAction.ID, debugactions.ConfigureAction.LABEL), - this.instantiationService.createInstance(debugactions.ToggleReplAction, debugactions.ToggleReplAction.ID, debugactions.ToggleReplAction.LABEL) + this.instantiationService.createInstance(debugactions.ConfigureAction, debugactions.ConfigureAction.ID, debugactions.ConfigureAction.LABEL) ]; this.actions.forEach(a => { 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 d0d12a0a84797289d8b115c655a2b912fc3134e0..4d3eb018173dec4474802e07f5b1dd2982d80588 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debug.contribution.ts @@ -23,9 +23,11 @@ import {VariablesView, WatchExpressionsView, CallStackView, BreakpointsView} fro import wbext = require('vs/workbench/common/contributions'); import {EditorDescriptor} from 'vs/workbench/browser/parts/editor/baseEditor'; import * as debug from 'vs/workbench/parts/debug/common/debug'; +import {IPartService} from 'vs/workbench/services/part/common/partService'; +import {IPanelService} from 'vs/workbench/services/panel/common/panelService'; import {DebugEditorModelManager} from 'vs/workbench/parts/debug/browser/debugEditorModelManager'; import {StepOverAction, ClearReplAction, FocusReplAction, StepIntoAction, StepOutAction, StartAction, StepBackAction, RestartAction, ContinueAction, StopAction, DisconnectAction, PauseAction, AddFunctionBreakpointAction, - ConfigureAction, ToggleReplAction, DisableAllBreakpointsAction, EnableAllBreakpointsAction, RemoveAllBreakpointsAction, RunAction, ReapplyBreakpointsAction} from 'vs/workbench/parts/debug/browser/debugActions'; + ConfigureAction, DisableAllBreakpointsAction, EnableAllBreakpointsAction, RemoveAllBreakpointsAction, RunAction, ReapplyBreakpointsAction} from 'vs/workbench/parts/debug/browser/debugActions'; import debugwidget = require('vs/workbench/parts/debug/browser/debugActionsWidget'); import service = require('vs/workbench/parts/debug/electron-browser/debugService'); import {DebugErrorEditorInput} from 'vs/workbench/parts/debug/browser/debugEditorInputs'; @@ -51,6 +53,21 @@ class OpenDebugViewletAction extends viewlet.ToggleViewletAction { } } +class OpenDebugPanelAction extends panel.TogglePanelAction { + public static ID = debug.REPL_ID; + public static LABEL = nls.localize('toggleDebugPanel', "Debug Console"); + + constructor( + id: string, + label: string, + @IPanelService panelService: IPanelService, + @IWorkbenchEditorService editorService: IWorkbenchEditorService, + @IPartService partService: IPartService + ) { + super(id, label, debug.REPL_ID, panelService, partService, editorService); + } +} + // register viewlet (platform.Registry.as(viewlet.Extensions.Viewlets)).registerViewlet(new viewlet.ViewletDescriptor( 'vs/workbench/parts/debug/browser/debugViewlet', @@ -64,6 +81,9 @@ class OpenDebugViewletAction extends viewlet.ToggleViewletAction { const openViewletKb: IKeybindings = { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_D }; +const openPanelKb: IKeybindings = { + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Y +}; // register repl panel (platform.Registry.as(panel.Extensions.Panels)).registerPanel(new panel.PanelDescriptor( @@ -83,6 +103,7 @@ DebugViewRegistry.registerDebugView(BreakpointsView, 40); // register action to open viewlet const registry = (platform.Registry.as(wbaregistry.Extensions.WorkbenchActions)); +registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDebugPanelAction, OpenDebugPanelAction.ID, OpenDebugPanelAction.LABEL, openPanelKb), 'View: Debug Console', nls.localize('view', "View")); registry.registerWorkbenchAction(new SyncActionDescriptor(OpenDebugViewletAction, OpenDebugViewletAction.ID, OpenDebugViewletAction.LABEL, openViewletKb), 'View: Show Debug', nls.localize('view', "View")); (platform.Registry.as(wbext.Extensions.Workbench)).registerWorkbenchContribution(DebugEditorModelManager); @@ -101,7 +122,6 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(DisconnectAction, Disc registry.registerWorkbenchAction(new SyncActionDescriptor(ContinueAction, ContinueAction.ID, ContinueAction.LABEL, { primary: KeyCode.F5 }, debug.CONTEXT_IN_DEBUG_MODE), 'Debug: Continue', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(PauseAction, PauseAction.ID, PauseAction.LABEL), 'Debug: Pause', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(ConfigureAction, ConfigureAction.ID, ConfigureAction.LABEL), 'Debug: Open launch.json', debugCategory); -registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleReplAction, ToggleReplAction.ID, ToggleReplAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Y, }), 'Debug: Debug Console', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(AddFunctionBreakpointAction, AddFunctionBreakpointAction.ID, AddFunctionBreakpointAction.LABEL), 'Debug: Add Function Breakpoint', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(ReapplyBreakpointsAction, ReapplyBreakpointsAction.ID, ReapplyBreakpointsAction.LABEL), 'Debug: Reapply All Breakpoints', debugCategory); registry.registerWorkbenchAction(new SyncActionDescriptor(RunAction, RunAction.ID, RunAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.F5 }, debug.CONTEXT_NOT_IN_DEBUG_MODE), 'Debug: Start Without Debugging', debugCategory);