From 203566118443271a9e9b0d94bff90cae39266bdc Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 23 Dec 2015 17:12:38 +0100 Subject: [PATCH] debug: plugin breakpoints widget --- .../parts/debug/browser/debugEditorContribution.ts | 4 ++-- src/vs/workbench/parts/debug/browser/debugViewer.ts | 6 +++--- src/vs/workbench/parts/debug/common/debug.ts | 3 ++- .../parts/debug/electron-browser/debugActions.ts | 9 +++++---- .../parts/debug/electron-browser/debugService.ts | 6 +++++- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/vs/workbench/parts/debug/browser/debugEditorContribution.ts b/src/vs/workbench/parts/debug/browser/debugEditorContribution.ts index 6c5f96b8de4..ce7dbc06d28 100644 --- a/src/vs/workbench/parts/debug/browser/debugEditorContribution.ts +++ b/src/vs/workbench/parts/debug/browser/debugEditorContribution.ts @@ -45,7 +45,7 @@ export class DebugEditorContribution implements editorcommon.IEditorContribution const actions = []; if (breakpoint) { actions.push(this.instantiationService.createInstance(debugactions.RemoveBreakpointAction, debugactions.RemoveBreakpointAction.ID, debugactions.RemoveBreakpointAction.LABEL)); - actions.push(this.instantiationService.createInstance(debugactions.EditConditionalBreakpointAction, debugactions.EditConditionalBreakpointAction.ID, debugactions.EditConditionalBreakpointAction.LABEL)); + actions.push(this.instantiationService.createInstance(debugactions.EditConditionalBreakpointAction, debugactions.EditConditionalBreakpointAction.ID, debugactions.EditConditionalBreakpointAction.LABEL, this.editor, lineNumber)); actions.push(this.instantiationService.createInstance(debugactions.ToggleEnablementAction, debugactions.ToggleEnablementAction.ID, debugactions.ToggleEnablementAction.LABEL)); } else { actions.push(new Action( @@ -55,7 +55,7 @@ export class DebugEditorContribution implements editorcommon.IEditorContribution true, () => this.debugService.toggleBreakpoint({ uri, lineNumber }) )); - actions.push(this.instantiationService.createInstance(debugactions.AddConditionalBreakpointAction, debugactions.AddConditionalBreakpointAction.ID, debugactions.AddConditionalBreakpointAction.LABEL)); + actions.push(this.instantiationService.createInstance(debugactions.AddConditionalBreakpointAction, debugactions.AddConditionalBreakpointAction.ID, debugactions.AddConditionalBreakpointAction.LABEL, this.editor, lineNumber)); } return TPromise.as(actions); diff --git a/src/vs/workbench/parts/debug/browser/debugViewer.ts b/src/vs/workbench/parts/debug/browser/debugViewer.ts index 65851f57eb2..fbc48ae55d5 100644 --- a/src/vs/workbench/parts/debug/browser/debugViewer.ts +++ b/src/vs/workbench/parts/debug/browser/debugViewer.ts @@ -6,6 +6,7 @@ import nls = require('vs/nls'); import { Promise, TPromise } from 'vs/base/common/winjs.base'; import lifecycle = require('vs/base/common/lifecycle'); +import { CommonKeybindings } from 'vs/base/common/keyCodes'; import paths = require('vs/base/common/paths'); import async = require('vs/base/common/async'); import errors = require('vs/base/common/errors'); @@ -29,7 +30,6 @@ import { IContextViewService, IContextMenuService } from 'vs/platform/contextvie import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; import { IMessageService } from 'vs/platform/message/common/message'; -import { CommonKeybindings } from 'vs/base/common/keyCodes'; const $ = dom.emmet; const booleanRegex = /^true|false$/i; @@ -108,8 +108,8 @@ function renderRenameBox(debugService: debug.IDebugService, contextViewService: }); toDispose.push(dom.addStandardDisposableListener(inputBox.inputElement, 'keydown', (e: dom.IKeyboardEvent) => { - let isEscape = e.equals(CommonKeybindings.ESCAPE); - let isEnter = e.equals(CommonKeybindings.ENTER); + const isEscape = e.equals(CommonKeybindings.ESCAPE); + const isEnter = e.equals(CommonKeybindings.ENTER); if (isEscape || isEnter) { wrapUp(isEnter); } diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index 4929fad7482..410fea6e181 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -9,6 +9,7 @@ import ee = require('vs/base/common/eventEmitter'); import severity from 'vs/base/common/severity'; import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import editor = require('vs/editor/common/editorCommon'); +import editorbrowser = require('vs/editor/browser/editorBrowser'); import { Source } from 'vs/workbench/parts/debug/common/debugSource'; export var VIEWLET_ID = 'workbench.view.debug'; @@ -230,7 +231,7 @@ export interface IDebugService extends ee.IEventEmitter { toggleBreakpointsActivated(): Promise; removeAllBreakpoints(): Promise; sendAllBreakpoints(): Promise; - editBreakpoint(breakpoint?: IBreakpoint): Promise; + editBreakpoint(editor: editorbrowser.ICodeEditor, lineNumber: number): Promise; addFunctionBreakpoint(functionName?: string): Promise; renameFunctionBreakpoint(id: string, newFunctionName: string): Promise; diff --git a/src/vs/workbench/parts/debug/electron-browser/debugActions.ts b/src/vs/workbench/parts/debug/electron-browser/debugActions.ts index 532dcdf0a01..4a81a19dda0 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugActions.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugActions.ts @@ -8,6 +8,7 @@ import actions = require('vs/base/common/actions'); import lifecycle = require('vs/base/common/lifecycle'); import { Promise, TPromise } from 'vs/base/common/winjs.base'; import editorCommon = require('vs/editor/common/editorCommon'); +import editorbrowser = require('vs/editor/browser/editorBrowser'); import baseeditor = require('vs/workbench/browser/parts/editor/baseEditor'); import { EditorAction, Behaviour } from 'vs/editor/common/editorAction'; import platform = require('vs/platform/platform'); @@ -396,12 +397,12 @@ export class AddConditionalBreakpointAction extends AbstractDebugAction { static ID = 'workbench.debug.viewlet.action.addConditionalBreakpointAction'; static LABEL = nls.localize('addConditionalBreakpoint', "Add Conditional Breakpoint"); - constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) { + constructor(id: string, label: string, private editor: editorbrowser.ICodeEditor, private lineNumber: number, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) { super(id, label, null, debugService, keybindingService); } public run(): Promise { - return this.debugService.editBreakpoint(); + return this.debugService.editBreakpoint(this.editor, this.lineNumber); } } @@ -409,12 +410,12 @@ export class EditConditionalBreakpointAction extends AbstractDebugAction { static ID = 'workbench.debug.viewlet.action.editConditionalBreakpointAction'; static LABEL = nls.localize('editConditionalBreakpoint', "Edit Breakpoint"); - constructor(id: string, label: string, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) { + constructor(id: string, label: string, private editor: editorbrowser.ICodeEditor, private lineNumber: number, @IDebugService debugService: IDebugService, @IKeybindingService keybindingService: IKeybindingService) { super(id, label, null, debugService, keybindingService); } public run(breakpoint: debug.IBreakpoint): Promise { - return this.debugService.editBreakpoint(breakpoint); + return this.debugService.editBreakpoint(this.editor, this.lineNumber); } } diff --git a/src/vs/workbench/parts/debug/electron-browser/debugService.ts b/src/vs/workbench/parts/debug/electron-browser/debugService.ts index 9ee161bb5ab..a60b59650a3 100644 --- a/src/vs/workbench/parts/debug/electron-browser/debugService.ts +++ b/src/vs/workbench/parts/debug/electron-browser/debugService.ts @@ -22,6 +22,7 @@ import model = require('vs/workbench/parts/debug/common/debugModel'); import debuginputs = require('vs/workbench/parts/debug/browser/debugEditorInputs'); import viewmodel = require('vs/workbench/parts/debug/common/debugViewModel'); import debugactions = require('vs/workbench/parts/debug/electron-browser/debugActions'); +import { BreakpointWidget } from 'vs/workbench/parts/debug/browser/breakpointWidget'; import { ConfigurationManager } from 'vs/workbench/parts/debug/node/debugConfigurationManager'; import { Repl } from 'vs/workbench/parts/debug/browser/replEditor'; import { Source } from 'vs/workbench/parts/debug/common/debugSource'; @@ -421,7 +422,10 @@ export class DebugService extends ee.EventEmitter implements debug.IDebugService return this.sendAllBreakpoints(); } - public editBreakpoint(breakpoint?: debug.IBreakpoint): Promise { + public editBreakpoint(editor: editorbrowser.ICodeEditor, lineNumber: number): Promise { + const breakpointWidget = this.instantiationService.createInstance(BreakpointWidget, editor, lineNumber); + breakpointWidget.show({ lineNumber, column: 1 }, 2); + return Promise.as(true); } -- GitLab