提交 c2c080da 编写于 作者: I isidor

debug: restructure imports

上级 fe4d68e4
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import uri from 'vs/base/common/uri';
import paths = require('vs/base/common/paths');
import * as paths from 'vs/base/common/paths';
import { DEBUG_SCHEME } from 'vs/workbench/parts/debug/common/debug';
export class Source {
......
......@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import Event, { Emitter } from 'vs/base/common/event';
import debug = require('vs/workbench/parts/debug/common/debug');
import * as debug from 'vs/workbench/parts/debug/common/debug';
export class ViewModel implements debug.IViewModel {
......
......@@ -3,21 +3,21 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import nls = require('vs/nls');
import * as nls from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { RunOnceScheduler } from 'vs/base/common/async';
import lifecycle = require('vs/base/common/lifecycle');
import env = require('vs/base/common/platform');
import * as lifecycle from 'vs/base/common/lifecycle';
import * as env from 'vs/base/common/platform';
import uri from 'vs/base/common/uri';
import { IAction, Action } from 'vs/base/common/actions';
import { KeyCode } from 'vs/base/common/keyCodes';
import keyboard = require('vs/base/browser/keyboardEvent');
import editorbrowser = require('vs/editor/browser/editorBrowser');
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { ICodeEditor, IEditorMouseEvent } from 'vs/editor/browser/editorBrowser';
import { editorContribution } from 'vs/editor/browser/editorBrowserExtensions';
import editorcommon = require('vs/editor/common/editorCommon');
import { IModelDecorationOptions, MouseTargetType, IModelDeltaDecoration, TrackedRangeStickiness } from 'vs/editor/common/editorCommon';
import { DebugHoverWidget } from 'vs/workbench/parts/debug/electron-browser/debugHover';
import debugactions = require('vs/workbench/parts/debug/browser/debugActions');
import debug = require('vs/workbench/parts/debug/common/debug');
import { RemoveBreakpointAction, EditConditionalBreakpointAction, ToggleEnablementAction, AddConditionalBreakpointAction } from 'vs/workbench/parts/debug/browser/debugActions';
import { IDebugEditorContribution, IDebugService, State, IBreakpoint, EDITOR_CONTRIBUTION_ID } from 'vs/workbench/parts/debug/common/debug';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { Range } from 'vs/editor/common/core/range';
......@@ -26,7 +26,7 @@ import { ICodeEditorService } from 'vs/editor/common/services/codeEditorService'
const HOVER_DELAY = 300;
@editorContribution
export class DebugEditorContribution implements debug.IDebugEditorContribution {
export class DebugEditorContribution implements IDebugEditorContribution {
private toDispose: lifecycle.IDisposable[];
private breakpointHintDecoration: string[];
......@@ -37,8 +37,8 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
private hoveringOver: string;
constructor(
private editor: editorbrowser.ICodeEditor,
@debug.IDebugService private debugService: debug.IDebugService,
private editor: ICodeEditor,
@IDebugService private debugService: IDebugService,
@IContextMenuService private contextMenuService: IContextMenuService,
@IInstantiationService private instantiationService: IInstantiationService,
@ICodeEditorService private codeEditorService: ICodeEditorService
......@@ -51,12 +51,12 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
this.registerListeners();
}
private getContextMenuActions(breakpoint: debug.IBreakpoint, uri: uri, lineNumber: number): TPromise<IAction[]> {
private getContextMenuActions(breakpoint: IBreakpoint, uri: uri, lineNumber: number): TPromise<IAction[]> {
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, this.editor, lineNumber));
actions.push(this.instantiationService.createInstance(debugactions.ToggleEnablementAction, debugactions.ToggleEnablementAction.ID, debugactions.ToggleEnablementAction.LABEL));
actions.push(this.instantiationService.createInstance(RemoveBreakpointAction, RemoveBreakpointAction.ID, RemoveBreakpointAction.LABEL));
actions.push(this.instantiationService.createInstance(EditConditionalBreakpointAction, EditConditionalBreakpointAction.ID, EditConditionalBreakpointAction.LABEL, this.editor, lineNumber));
actions.push(this.instantiationService.createInstance(ToggleEnablementAction, ToggleEnablementAction.ID, ToggleEnablementAction.LABEL));
} else {
actions.push(new Action(
'addBreakpoint',
......@@ -65,15 +65,15 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
true,
() => this.debugService.addBreakpoints(uri, [{ lineNumber }])
));
actions.push(this.instantiationService.createInstance(debugactions.AddConditionalBreakpointAction, debugactions.AddConditionalBreakpointAction.ID, debugactions.AddConditionalBreakpointAction.LABEL, this.editor, lineNumber));
actions.push(this.instantiationService.createInstance(AddConditionalBreakpointAction, AddConditionalBreakpointAction.ID, AddConditionalBreakpointAction.LABEL, this.editor, lineNumber));
}
return TPromise.as(actions);
}
private registerListeners(): void {
this.toDispose.push(this.editor.onMouseDown((e: editorbrowser.IEditorMouseEvent) => {
if (e.target.type !== editorcommon.MouseTargetType.GUTTER_GLYPH_MARGIN || /* after last line */ e.target.detail) {
this.toDispose.push(this.editor.onMouseDown((e: IEditorMouseEvent) => {
if (e.target.type !== MouseTargetType.GUTTER_GLYPH_MARGIN || /* after last line */ e.target.detail) {
return;
}
const canSetBreakpoints = this.debugService.getConfigurationManager().canSetBreakpointsIn(this.editor.getModel());
......@@ -106,9 +106,9 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
}
}));
this.toDispose.push(this.editor.onMouseMove((e: editorbrowser.IEditorMouseEvent) => {
this.toDispose.push(this.editor.onMouseMove((e: IEditorMouseEvent) => {
var showBreakpointHintAtLineNumber = -1;
if (e.target.type === editorcommon.MouseTargetType.GUTTER_GLYPH_MARGIN && this.debugService.getConfigurationManager().canSetBreakpointsIn(this.editor.getModel())) {
if (e.target.type === MouseTargetType.GUTTER_GLYPH_MARGIN && this.debugService.getConfigurationManager().canSetBreakpointsIn(this.editor.getModel())) {
if (!e.target.detail) {
// is not after last line
showBreakpointHintAtLineNumber = e.target.position.lineNumber;
......@@ -116,28 +116,28 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
}
this.ensureBreakpointHintDecoration(showBreakpointHintAtLineNumber);
}));
this.toDispose.push(this.editor.onMouseLeave((e: editorbrowser.IEditorMouseEvent) => {
this.toDispose.push(this.editor.onMouseLeave((e: IEditorMouseEvent) => {
this.ensureBreakpointHintDecoration(-1);
}));
this.toDispose.push(this.debugService.onDidChangeState(() => this.onDebugStateUpdate()));
// hover listeners & hover widget
this.toDispose.push(this.editor.onMouseDown((e: editorbrowser.IEditorMouseEvent) => this.onEditorMouseDown(e)));
this.toDispose.push(this.editor.onMouseMove((e: editorbrowser.IEditorMouseEvent) => this.onEditorMouseMove(e)));
this.toDispose.push(this.editor.onMouseLeave((e: editorbrowser.IEditorMouseEvent) => {
this.toDispose.push(this.editor.onMouseDown((e: IEditorMouseEvent) => this.onEditorMouseDown(e)));
this.toDispose.push(this.editor.onMouseMove((e: IEditorMouseEvent) => this.onEditorMouseMove(e)));
this.toDispose.push(this.editor.onMouseLeave((e: IEditorMouseEvent) => {
const rect = this.hoverWidget.getDomNode().getBoundingClientRect();
// Only hide the hover widget if the editor mouse leave event is outside the hover widget #3528
if (e.event.posx < rect.left || e.event.posx > rect.right || e.event.posy < rect.top || e.event.posy > rect.bottom) {
this.hideHoverWidget();
}
}));
this.toDispose.push(this.editor.onKeyDown((e: keyboard.IKeyboardEvent) => this.onKeyDown(e)));
this.toDispose.push(this.editor.onKeyDown((e: IKeyboardEvent) => this.onKeyDown(e)));
this.toDispose.push(this.editor.onDidChangeModel(() => this.hideHoverWidget()));
this.toDispose.push(this.editor.onDidScrollChange(() => this.hideHoverWidget));
}
public getId(): string {
return debug.EDITOR_CONTRIBUTION_ID;
return EDITOR_CONTRIBUTION_ID;
}
public showHover(range: Range, hoveringOver: string, focus: boolean): TPromise<void> {
......@@ -145,7 +145,7 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
}
private ensureBreakpointHintDecoration(showBreakpointHintAtLineNumber: number): void {
var newDecoration: editorcommon.IModelDeltaDecoration[] = [];
var newDecoration: IModelDeltaDecoration[] = [];
if (showBreakpointHintAtLineNumber !== -1) {
newDecoration.push({
options: DebugEditorContribution.BREAKPOINT_HELPER_DECORATION,
......@@ -163,11 +163,11 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
private onDebugStateUpdate(): void {
const state = this.debugService.state;
if (state !== debug.State.Stopped) {
if (state !== State.Stopped) {
this.hideHoverWidget();
}
this.codeEditorService.listCodeEditors().forEach(e => {
e.updateOptions({ hover: state !== debug.State.Stopped });
e.updateOptions({ hover: state !== State.Stopped });
});
}
......@@ -181,27 +181,27 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
// hover business
private onEditorMouseDown(mouseEvent: editorbrowser.IEditorMouseEvent): void {
if (mouseEvent.target.type === editorcommon.MouseTargetType.CONTENT_WIDGET && mouseEvent.target.detail === DebugHoverWidget.ID) {
private onEditorMouseDown(mouseEvent: IEditorMouseEvent): void {
if (mouseEvent.target.type === MouseTargetType.CONTENT_WIDGET && mouseEvent.target.detail === DebugHoverWidget.ID) {
return;
}
this.hideHoverWidget();
}
private onEditorMouseMove(mouseEvent: editorbrowser.IEditorMouseEvent): void {
if (this.debugService.state !== debug.State.Stopped) {
private onEditorMouseMove(mouseEvent: IEditorMouseEvent): void {
if (this.debugService.state !== State.Stopped) {
return;
}
const targetType = mouseEvent.target.type;
const stopKey = env.isMacintosh ? 'metaKey' : 'ctrlKey';
if (targetType === editorcommon.MouseTargetType.CONTENT_WIDGET && mouseEvent.target.detail === DebugHoverWidget.ID && !(<any>mouseEvent.event)[stopKey]) {
if (targetType === MouseTargetType.CONTENT_WIDGET && mouseEvent.target.detail === DebugHoverWidget.ID && !(<any>mouseEvent.event)[stopKey]) {
// mouse moved on top of debug hover widget
return;
}
if (targetType === editorcommon.MouseTargetType.CONTENT_TEXT) {
if (targetType === MouseTargetType.CONTENT_TEXT) {
const wordAtPosition = this.editor.getModel().getWordAtPosition(mouseEvent.target.range.getStartPosition());
if (wordAtPosition && this.hoveringOver !== wordAtPosition.word) {
this.hoverRange = mouseEvent.target.range;
......@@ -213,7 +213,7 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
}
}
private onKeyDown(e: keyboard.IKeyboardEvent): void {
private onKeyDown(e: IKeyboardEvent): void {
const stopKey = env.isMacintosh ? KeyCode.Meta : KeyCode.Ctrl;
if (e.keyCode !== stopKey) {
// do not hide hover when Ctrl/Meta is pressed
......@@ -223,9 +223,9 @@ export class DebugEditorContribution implements debug.IDebugEditorContribution {
// end hover business
private static BREAKPOINT_HELPER_DECORATION: editorcommon.IModelDecorationOptions = {
private static BREAKPOINT_HELPER_DECORATION: IModelDecorationOptions = {
glyphMarginClassName: 'debug-breakpoint-hint-glyph',
stickiness: editorcommon.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges
};
public dispose(): void {
......
......@@ -3,13 +3,13 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import nls = require('vs/nls');
import * as nls from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import strings = require('vs/base/common/strings');
import objects = require('vs/base/common/objects');
import paths = require('vs/base/common/paths');
import platform = require('vs/base/common/platform');
import debug = require('vs/workbench/parts/debug/common/debug');
import * as strings from 'vs/base/common/strings';
import * as objects from 'vs/base/common/objects';
import * as paths from 'vs/base/common/paths';
import * as platform from 'vs/base/common/platform';
import * as debug from 'vs/workbench/parts/debug/common/debug';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册