33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6- import nls = require ( 'vs/nls' ) ;
6+ import * as nls from 'vs/nls' ;
77import { TPromise } from 'vs/base/common/winjs.base' ;
88import { RunOnceScheduler } from 'vs/base/common/async' ;
9- import lifecycle = require ( 'vs/base/common/lifecycle' ) ;
10- import env = require ( 'vs/base/common/platform' ) ;
9+ import * as lifecycle from 'vs/base/common/lifecycle' ;
10+ import * as env from 'vs/base/common/platform' ;
1111import uri from 'vs/base/common/uri' ;
1212import { IAction , Action } from 'vs/base/common/actions' ;
1313import { KeyCode } from 'vs/base/common/keyCodes' ;
14- import keyboard = require ( 'vs/base/browser/keyboardEvent' ) ;
15- import editorbrowser = require ( 'vs/editor/browser/editorBrowser' ) ;
14+ import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent' ;
15+ import { ICodeEditor , IEditorMouseEvent } from 'vs/editor/browser/editorBrowser' ;
1616import { editorContribution } from 'vs/editor/browser/editorBrowserExtensions' ;
17- import editorcommon = require ( 'vs/editor/common/editorCommon' ) ;
17+ import { IModelDecorationOptions , MouseTargetType , IModelDeltaDecoration , TrackedRangeStickiness } from 'vs/editor/common/editorCommon' ;
1818import { DebugHoverWidget } from 'vs/workbench/parts/debug/electron-browser/debugHover' ;
19- import debugactions = require ( 'vs/workbench/parts/debug/browser/debugActions' ) ;
20- import debug = require ( 'vs/workbench/parts/debug/common/debug' ) ;
19+ import { RemoveBreakpointAction , EditConditionalBreakpointAction , ToggleEnablementAction , AddConditionalBreakpointAction } from 'vs/workbench/parts/debug/browser/debugActions' ;
20+ import { IDebugEditorContribution , IDebugService , State , IBreakpoint , EDITOR_CONTRIBUTION_ID } from 'vs/workbench/parts/debug/common/debug' ;
2121import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation' ;
2222import { IContextMenuService } from 'vs/platform/contextview/browser/contextView' ;
2323import { Range } from 'vs/editor/common/core/range' ;
@@ -26,7 +26,7 @@ import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'
2626const HOVER_DELAY = 300 ;
2727
2828@editorContribution
29- export class DebugEditorContribution implements debug . IDebugEditorContribution {
29+ export class DebugEditorContribution implements IDebugEditorContribution {
3030
3131 private toDispose : lifecycle . IDisposable [ ] ;
3232 private breakpointHintDecoration : string [ ] ;
@@ -37,8 +37,8 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
3737 private hoveringOver : string ;
3838
3939 constructor (
40- private editor : editorbrowser . ICodeEditor ,
41- @debug . IDebugService private debugService : debug . IDebugService ,
40+ private editor : ICodeEditor ,
41+ @IDebugService private debugService : IDebugService ,
4242 @IContextMenuService private contextMenuService : IContextMenuService ,
4343 @IInstantiationService private instantiationService : IInstantiationService ,
4444 @ICodeEditorService private codeEditorService : ICodeEditorService
@@ -51,12 +51,12 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
5151 this . registerListeners ( ) ;
5252 }
5353
54- private getContextMenuActions ( breakpoint : debug . IBreakpoint , uri : uri , lineNumber : number ) : TPromise < IAction [ ] > {
54+ private getContextMenuActions ( breakpoint : IBreakpoint , uri : uri , lineNumber : number ) : TPromise < IAction [ ] > {
5555 const actions = [ ] ;
5656 if ( breakpoint ) {
57- actions . push ( this . instantiationService . createInstance ( debugactions . RemoveBreakpointAction , debugactions . RemoveBreakpointAction . ID , debugactions . RemoveBreakpointAction . LABEL ) ) ;
58- actions . push ( this . instantiationService . createInstance ( debugactions . EditConditionalBreakpointAction , debugactions . EditConditionalBreakpointAction . ID , debugactions . EditConditionalBreakpointAction . LABEL , this . editor , lineNumber ) ) ;
59- actions . push ( this . instantiationService . createInstance ( debugactions . ToggleEnablementAction , debugactions . ToggleEnablementAction . ID , debugactions . ToggleEnablementAction . LABEL ) ) ;
57+ actions . push ( this . instantiationService . createInstance ( RemoveBreakpointAction , RemoveBreakpointAction . ID , RemoveBreakpointAction . LABEL ) ) ;
58+ actions . push ( this . instantiationService . createInstance ( EditConditionalBreakpointAction , EditConditionalBreakpointAction . ID , EditConditionalBreakpointAction . LABEL , this . editor , lineNumber ) ) ;
59+ actions . push ( this . instantiationService . createInstance ( ToggleEnablementAction , ToggleEnablementAction . ID , ToggleEnablementAction . LABEL ) ) ;
6060 } else {
6161 actions . push ( new Action (
6262 'addBreakpoint' ,
@@ -65,15 +65,15 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
6565 true ,
6666 ( ) => this . debugService . addBreakpoints ( uri , [ { lineNumber } ] )
6767 ) ) ;
68- actions . push ( this . instantiationService . createInstance ( debugactions . AddConditionalBreakpointAction , debugactions . AddConditionalBreakpointAction . ID , debugactions . AddConditionalBreakpointAction . LABEL , this . editor , lineNumber ) ) ;
68+ actions . push ( this . instantiationService . createInstance ( AddConditionalBreakpointAction , AddConditionalBreakpointAction . ID , AddConditionalBreakpointAction . LABEL , this . editor , lineNumber ) ) ;
6969 }
7070
7171 return TPromise . as ( actions ) ;
7272 }
7373
7474 private registerListeners ( ) : void {
75- this . toDispose . push ( this . editor . onMouseDown ( ( e : editorbrowser . IEditorMouseEvent ) => {
76- if ( e . target . type !== editorcommon . MouseTargetType . GUTTER_GLYPH_MARGIN || /* after last line */ e . target . detail ) {
75+ this . toDispose . push ( this . editor . onMouseDown ( ( e : IEditorMouseEvent ) => {
76+ if ( e . target . type !== MouseTargetType . GUTTER_GLYPH_MARGIN || /* after last line */ e . target . detail ) {
7777 return ;
7878 }
7979 const canSetBreakpoints = this . debugService . getConfigurationManager ( ) . canSetBreakpointsIn ( this . editor . getModel ( ) ) ;
@@ -106,46 +106,46 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
106106 }
107107 } ) ) ;
108108
109- this . toDispose . push ( this . editor . onMouseMove ( ( e : editorbrowser . IEditorMouseEvent ) => {
109+ this . toDispose . push ( this . editor . onMouseMove ( ( e : IEditorMouseEvent ) => {
110110 var showBreakpointHintAtLineNumber = - 1 ;
111- if ( e . target . type === editorcommon . MouseTargetType . GUTTER_GLYPH_MARGIN && this . debugService . getConfigurationManager ( ) . canSetBreakpointsIn ( this . editor . getModel ( ) ) ) {
111+ if ( e . target . type === MouseTargetType . GUTTER_GLYPH_MARGIN && this . debugService . getConfigurationManager ( ) . canSetBreakpointsIn ( this . editor . getModel ( ) ) ) {
112112 if ( ! e . target . detail ) {
113113 // is not after last line
114114 showBreakpointHintAtLineNumber = e . target . position . lineNumber ;
115115 }
116116 }
117117 this . ensureBreakpointHintDecoration ( showBreakpointHintAtLineNumber ) ;
118118 } ) ) ;
119- this . toDispose . push ( this . editor . onMouseLeave ( ( e : editorbrowser . IEditorMouseEvent ) => {
119+ this . toDispose . push ( this . editor . onMouseLeave ( ( e : IEditorMouseEvent ) => {
120120 this . ensureBreakpointHintDecoration ( - 1 ) ;
121121 } ) ) ;
122122 this . toDispose . push ( this . debugService . onDidChangeState ( ( ) => this . onDebugStateUpdate ( ) ) ) ;
123123
124124 // hover listeners & hover widget
125- this . toDispose . push ( this . editor . onMouseDown ( ( e : editorbrowser . IEditorMouseEvent ) => this . onEditorMouseDown ( e ) ) ) ;
126- this . toDispose . push ( this . editor . onMouseMove ( ( e : editorbrowser . IEditorMouseEvent ) => this . onEditorMouseMove ( e ) ) ) ;
127- this . toDispose . push ( this . editor . onMouseLeave ( ( e : editorbrowser . IEditorMouseEvent ) => {
125+ this . toDispose . push ( this . editor . onMouseDown ( ( e : IEditorMouseEvent ) => this . onEditorMouseDown ( e ) ) ) ;
126+ this . toDispose . push ( this . editor . onMouseMove ( ( e : IEditorMouseEvent ) => this . onEditorMouseMove ( e ) ) ) ;
127+ this . toDispose . push ( this . editor . onMouseLeave ( ( e : IEditorMouseEvent ) => {
128128 const rect = this . hoverWidget . getDomNode ( ) . getBoundingClientRect ( ) ;
129129 // Only hide the hover widget if the editor mouse leave event is outside the hover widget #3528
130130 if ( e . event . posx < rect . left || e . event . posx > rect . right || e . event . posy < rect . top || e . event . posy > rect . bottom ) {
131131 this . hideHoverWidget ( ) ;
132132 }
133133 } ) ) ;
134- this . toDispose . push ( this . editor . onKeyDown ( ( e : keyboard . IKeyboardEvent ) => this . onKeyDown ( e ) ) ) ;
134+ this . toDispose . push ( this . editor . onKeyDown ( ( e : IKeyboardEvent ) => this . onKeyDown ( e ) ) ) ;
135135 this . toDispose . push ( this . editor . onDidChangeModel ( ( ) => this . hideHoverWidget ( ) ) ) ;
136136 this . toDispose . push ( this . editor . onDidScrollChange ( ( ) => this . hideHoverWidget ) ) ;
137137 }
138138
139139 public getId ( ) : string {
140- return debug . EDITOR_CONTRIBUTION_ID ;
140+ return EDITOR_CONTRIBUTION_ID ;
141141 }
142142
143143 public showHover ( range : Range , hoveringOver : string , focus : boolean ) : TPromise < void > {
144144 return this . hoverWidget . showAt ( range , hoveringOver , focus ) ;
145145 }
146146
147147 private ensureBreakpointHintDecoration ( showBreakpointHintAtLineNumber : number ) : void {
148- var newDecoration : editorcommon . IModelDeltaDecoration [ ] = [ ] ;
148+ var newDecoration : IModelDeltaDecoration [ ] = [ ] ;
149149 if ( showBreakpointHintAtLineNumber !== - 1 ) {
150150 newDecoration . push ( {
151151 options : DebugEditorContribution . BREAKPOINT_HELPER_DECORATION ,
@@ -163,11 +163,11 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
163163
164164 private onDebugStateUpdate ( ) : void {
165165 const state = this . debugService . state ;
166- if ( state !== debug . State . Stopped ) {
166+ if ( state !== State . Stopped ) {
167167 this . hideHoverWidget ( ) ;
168168 }
169169 this . codeEditorService . listCodeEditors ( ) . forEach ( e => {
170- e . updateOptions ( { hover : state !== debug . State . Stopped } ) ;
170+ e . updateOptions ( { hover : state !== State . Stopped } ) ;
171171 } ) ;
172172 }
173173
@@ -181,27 +181,27 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
181181
182182 // hover business
183183
184- private onEditorMouseDown ( mouseEvent : editorbrowser . IEditorMouseEvent ) : void {
185- if ( mouseEvent . target . type === editorcommon . MouseTargetType . CONTENT_WIDGET && mouseEvent . target . detail === DebugHoverWidget . ID ) {
184+ private onEditorMouseDown ( mouseEvent : IEditorMouseEvent ) : void {
185+ if ( mouseEvent . target . type === MouseTargetType . CONTENT_WIDGET && mouseEvent . target . detail === DebugHoverWidget . ID ) {
186186 return ;
187187 }
188188
189189 this . hideHoverWidget ( ) ;
190190 }
191191
192- private onEditorMouseMove ( mouseEvent : editorbrowser . IEditorMouseEvent ) : void {
193- if ( this . debugService . state !== debug . State . Stopped ) {
192+ private onEditorMouseMove ( mouseEvent : IEditorMouseEvent ) : void {
193+ if ( this . debugService . state !== State . Stopped ) {
194194 return ;
195195 }
196196
197197 const targetType = mouseEvent . target . type ;
198198 const stopKey = env . isMacintosh ? 'metaKey' : 'ctrlKey' ;
199199
200- if ( targetType === editorcommon . MouseTargetType . CONTENT_WIDGET && mouseEvent . target . detail === DebugHoverWidget . ID && ! ( < any > mouseEvent . event ) [ stopKey ] ) {
200+ if ( targetType === MouseTargetType . CONTENT_WIDGET && mouseEvent . target . detail === DebugHoverWidget . ID && ! ( < any > mouseEvent . event ) [ stopKey ] ) {
201201 // mouse moved on top of debug hover widget
202202 return ;
203203 }
204- if ( targetType === editorcommon . MouseTargetType . CONTENT_TEXT ) {
204+ if ( targetType === MouseTargetType . CONTENT_TEXT ) {
205205 const wordAtPosition = this . editor . getModel ( ) . getWordAtPosition ( mouseEvent . target . range . getStartPosition ( ) ) ;
206206 if ( wordAtPosition && this . hoveringOver !== wordAtPosition . word ) {
207207 this . hoverRange = mouseEvent . target . range ;
@@ -213,7 +213,7 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
213213 }
214214 }
215215
216- private onKeyDown ( e : keyboard . IKeyboardEvent ) : void {
216+ private onKeyDown ( e : IKeyboardEvent ) : void {
217217 const stopKey = env . isMacintosh ? KeyCode . Meta : KeyCode . Ctrl ;
218218 if ( e . keyCode !== stopKey ) {
219219 // do not hide hover when Ctrl/Meta is pressed
@@ -223,9 +223,9 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
223223
224224 // end hover business
225225
226- private static BREAKPOINT_HELPER_DECORATION : editorcommon . IModelDecorationOptions = {
226+ private static BREAKPOINT_HELPER_DECORATION : IModelDecorationOptions = {
227227 glyphMarginClassName : 'debug-breakpoint-hint-glyph' ,
228- stickiness : editorcommon . TrackedRangeStickiness . NeverGrowsWhenTypingAtEdges
228+ stickiness : TrackedRangeStickiness . NeverGrowsWhenTypingAtEdges
229229 } ;
230230
231231 public dispose ( ) : void {
0 commit comments