debug: Model -> DebugModel, IModel -> IDebugModel
This commit is contained in:
parent
7f9b85612d
commit
565938b6f9
10 changed files with 32 additions and 32 deletions
|
@ -16,7 +16,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
|
|||
import { WorkbenchTree, TreeResourceNavigator } from 'vs/platform/list/browser/listService';
|
||||
import { renderViewTree, twistiePixels } from 'vs/workbench/parts/debug/browser/baseDebugView';
|
||||
import { IAccessibilityProvider, ITree, IRenderer, IDataSource } from 'vs/base/parts/tree/browser/tree';
|
||||
import { IDebugSession, IDebugService, IModel, CONTEXT_LOADED_SCRIPTS_ITEM_TYPE } from 'vs/workbench/parts/debug/common/debug';
|
||||
import { IDebugSession, IDebugService, IDebugModel, CONTEXT_LOADED_SCRIPTS_ITEM_TYPE } from 'vs/workbench/parts/debug/common/debug';
|
||||
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
|
||||
import { IWorkspaceContextService, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
|
@ -201,7 +201,7 @@ class RootFolderTreeItem extends BaseTreeItem {
|
|||
|
||||
class RootTreeItem extends BaseTreeItem {
|
||||
|
||||
constructor(private _debugModel: IModel, private _environmentService: IEnvironmentService, private _contextService: IWorkspaceContextService) {
|
||||
constructor(private _debugModel: IDebugModel, private _environmentService: IEnvironmentService, private _contextService: IWorkspaceContextService) {
|
||||
super(undefined, 'Root');
|
||||
this._debugModel.getSessions().forEach(session => {
|
||||
this.add(session);
|
||||
|
|
|
@ -365,7 +365,7 @@ export interface IViewModel extends ITreeElement {
|
|||
onDidSelectExpression: Event<IExpression>;
|
||||
}
|
||||
|
||||
export interface IModel extends ITreeElement {
|
||||
export interface IDebugModel extends ITreeElement {
|
||||
getSessions(): ReadonlyArray<IDebugSession>;
|
||||
getBreakpoints(filter?: { uri?: uri, lineNumber?: number, column?: number, enabledOnly?: boolean }): ReadonlyArray<IBreakpoint>;
|
||||
areBreakpointsActivated(): boolean;
|
||||
|
@ -776,7 +776,7 @@ export interface IDebugService {
|
|||
/**
|
||||
* Gets the current debug model.
|
||||
*/
|
||||
getModel(): IModel;
|
||||
getModel(): IDebugModel;
|
||||
|
||||
/**
|
||||
* Gets the current view model.
|
||||
|
|
|
@ -16,7 +16,7 @@ import { isObject, isString, isUndefinedOrNull } from 'vs/base/common/types';
|
|||
import { distinct } from 'vs/base/common/arrays';
|
||||
import { Range, IRange } from 'vs/editor/common/core/range';
|
||||
import {
|
||||
ITreeElement, IExpression, IExpressionContainer, IDebugSession, IStackFrame, IExceptionBreakpoint, IBreakpoint, IFunctionBreakpoint, IModel, IReplElementSource,
|
||||
ITreeElement, IExpression, IExpressionContainer, IDebugSession, IStackFrame, IExceptionBreakpoint, IBreakpoint, IFunctionBreakpoint, IDebugModel, IReplElementSource,
|
||||
IThread, IRawModelUpdate, IScope, IRawStoppedDetails, IEnablement, IBreakpointData, IExceptionInfo, IReplElement, IBreakpointsChangeEvent, IBreakpointUpdateData, IBaseBreakpoint
|
||||
} from 'vs/workbench/parts/debug/common/debug';
|
||||
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
|
||||
|
@ -723,7 +723,7 @@ export class ThreadAndSessionIds implements ITreeElement {
|
|||
}
|
||||
}
|
||||
|
||||
export class Model implements IModel {
|
||||
export class DebugModel implements IDebugModel {
|
||||
|
||||
private sessions: IDebugSession[];
|
||||
private toDispose: lifecycle.IDisposable[];
|
||||
|
|
|
@ -9,7 +9,7 @@ import * as dom from 'vs/base/browser/dom';
|
|||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { TreeViewsViewletPanel, IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { IDebugService, State, IStackFrame, IDebugSession, IThread, CONTEXT_CALLSTACK_ITEM_TYPE } from 'vs/workbench/parts/debug/common/debug';
|
||||
import { Thread, StackFrame, ThreadAndSessionIds, Model } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import { Thread, StackFrame, ThreadAndSessionIds, DebugModel } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { MenuId } from 'vs/platform/actions/common/actions';
|
||||
|
@ -313,14 +313,14 @@ class CallStackDataSource implements IDataSource {
|
|||
}
|
||||
|
||||
public hasChildren(tree: ITree, element: any): boolean {
|
||||
return element instanceof Model || element instanceof DebugSession || (element instanceof Thread && (<Thread>element).stopped);
|
||||
return element instanceof DebugModel || element instanceof DebugSession || (element instanceof Thread && (<Thread>element).stopped);
|
||||
}
|
||||
|
||||
public getChildren(tree: ITree, element: any): TPromise<any> {
|
||||
if (element instanceof Thread) {
|
||||
return this.getThreadChildren(element);
|
||||
}
|
||||
if (element instanceof Model) {
|
||||
if (element instanceof DebugModel) {
|
||||
return TPromise.as(element.getSessions());
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import { FileChangesEvent, FileChangeType, IFileService } from 'vs/platform/file
|
|||
import { IWindowService } from 'vs/platform/windows/common/windows';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { Model, ExceptionBreakpoint, FunctionBreakpoint, Breakpoint, Expression, RawObjectReplElement } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import { DebugModel, ExceptionBreakpoint, FunctionBreakpoint, Breakpoint, Expression, RawObjectReplElement } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import { ViewModel } from 'vs/workbench/parts/debug/common/debugViewModel';
|
||||
import * as debugactions from 'vs/workbench/parts/debug/browser/debugActions';
|
||||
import { ConfigurationManager } from 'vs/workbench/parts/debug/electron-browser/debugConfigurationManager';
|
||||
|
@ -47,7 +47,7 @@ import { IAction, Action } from 'vs/base/common/actions';
|
|||
import { deepClone, equals } from 'vs/base/common/objects';
|
||||
import { DebugSession } from 'vs/workbench/parts/debug/electron-browser/debugSession';
|
||||
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IDebugService, State, IDebugSession, CONTEXT_DEBUG_TYPE, CONTEXT_DEBUG_STATE, CONTEXT_IN_DEBUG_MODE, IThread, IDebugConfiguration, VIEWLET_ID, REPL_ID, IConfig, ILaunch, IViewModel, IConfigurationManager, IModel, IReplElementSource, IEnablement, IBreakpoint, IBreakpointData, IExpression, ICompound, IGlobalConfig, IStackFrame, AdapterEndEvent } from 'vs/workbench/parts/debug/common/debug';
|
||||
import { IDebugService, State, IDebugSession, CONTEXT_DEBUG_TYPE, CONTEXT_DEBUG_STATE, CONTEXT_IN_DEBUG_MODE, IThread, IDebugConfiguration, VIEWLET_ID, REPL_ID, IConfig, ILaunch, IViewModel, IConfigurationManager, IDebugModel, IReplElementSource, IEnablement, IBreakpoint, IBreakpointData, IExpression, ICompound, IGlobalConfig, IStackFrame, AdapterEndEvent } from 'vs/workbench/parts/debug/common/debug';
|
||||
import { isExtensionHostDebugging } from 'vs/workbench/parts/debug/common/debugUtils';
|
||||
|
||||
const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint';
|
||||
|
@ -63,7 +63,7 @@ export class DebugService implements IDebugService {
|
|||
private readonly _onDidNewSession: Emitter<IDebugSession>;
|
||||
private readonly _onWillNewSession: Emitter<IDebugSession>;
|
||||
private readonly _onDidEndSession: Emitter<IDebugSession>;
|
||||
private model: Model;
|
||||
private model: DebugModel;
|
||||
private viewModel: ViewModel;
|
||||
private configurationManager: ConfigurationManager;
|
||||
private allSessions = new Map<string, IDebugSession>();
|
||||
|
@ -114,7 +114,7 @@ export class DebugService implements IDebugService {
|
|||
this.debugState = CONTEXT_DEBUG_STATE.bindTo(contextKeyService);
|
||||
this.inDebugMode = CONTEXT_IN_DEBUG_MODE.bindTo(contextKeyService);
|
||||
|
||||
this.model = new Model(this.loadBreakpoints(), this.storageService.getBoolean(DEBUG_BREAKPOINTS_ACTIVATED_KEY, StorageScope.WORKSPACE, true), this.loadFunctionBreakpoints(),
|
||||
this.model = new DebugModel(this.loadBreakpoints(), this.storageService.getBoolean(DEBUG_BREAKPOINTS_ACTIVATED_KEY, StorageScope.WORKSPACE, true), this.loadFunctionBreakpoints(),
|
||||
this.loadExceptionBreakpoints(), this.loadWatchExpressions(), this.textFileService);
|
||||
this.toDispose.push(this.model);
|
||||
|
||||
|
@ -158,7 +158,7 @@ export class DebugService implements IDebugService {
|
|||
return this.allSessions.get(sessionId);
|
||||
}
|
||||
|
||||
getModel(): IModel {
|
||||
getModel(): IDebugModel {
|
||||
return this.model;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import * as aria from 'vs/base/browser/ui/aria/aria';
|
|||
import { IDebugSession, IConfig, IThread, IRawModelUpdate, IDebugService, IRawStoppedDetails, State, LoadedSourceEvent, IFunctionBreakpoint, IExceptionBreakpoint, ActualBreakpoints, IBreakpoint, IExceptionInfo, AdapterEndEvent, IDebugger } from 'vs/workbench/parts/debug/common/debug';
|
||||
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { Thread, ExpressionContainer, Model } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import { Thread, ExpressionContainer, DebugModel } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import { RawDebugSession } from 'vs/workbench/parts/debug/electron-browser/rawDebugSession';
|
||||
import product from 'vs/platform/node/product';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
@ -49,7 +49,7 @@ export class DebugSession implements IDebugSession {
|
|||
constructor(
|
||||
private _configuration: { resolved: IConfig, unresolved: IConfig },
|
||||
public root: IWorkspaceFolder,
|
||||
private model: Model,
|
||||
private model: DebugModel,
|
||||
@INotificationService private notificationService: INotificationService,
|
||||
@IDebugService private debugService: IDebugService,
|
||||
@ITelemetryService private telemetryService: ITelemetryService,
|
||||
|
|
|
@ -15,7 +15,7 @@ import { IMouseEvent } from 'vs/base/browser/mouseEvent';
|
|||
import { ITree, IAccessibilityProvider, ContextMenuEvent, IDataSource, IRenderer, IActionProvider } from 'vs/base/parts/tree/browser/tree';
|
||||
import { ICancelableEvent } from 'vs/base/parts/tree/browser/treeDefaults';
|
||||
import { IExpressionContainer, IExpression, IReplElementSource } from 'vs/workbench/parts/debug/common/debug';
|
||||
import { Model, RawObjectReplElement, Expression, SimpleReplElement, Variable } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import { DebugModel, RawObjectReplElement, Expression, SimpleReplElement, Variable } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import { renderVariable, renderExpressionValue, IVariableTemplateData, BaseDebugController } from 'vs/workbench/parts/debug/browser/baseDebugView';
|
||||
import { ClearReplAction, ReplCollapseAllAction } from 'vs/workbench/parts/debug/browser/debugActions';
|
||||
import { CopyAction, CopyAllAction } from 'vs/workbench/parts/debug/electron-browser/electronDebugActions';
|
||||
|
@ -34,11 +34,11 @@ export class ReplExpressionsDataSource implements IDataSource {
|
|||
}
|
||||
|
||||
public hasChildren(tree: ITree, element: any): boolean {
|
||||
return element instanceof Model || (<IExpressionContainer>element).hasChildren;
|
||||
return element instanceof DebugModel || (<IExpressionContainer>element).hasChildren;
|
||||
}
|
||||
|
||||
public getChildren(tree: ITree, element: any): TPromise<any> {
|
||||
if (element instanceof Model) {
|
||||
if (element instanceof DebugModel) {
|
||||
return TPromise.as(element.getReplElements());
|
||||
}
|
||||
if (element instanceof RawObjectReplElement) {
|
||||
|
|
|
@ -12,7 +12,7 @@ import { IActionProvider, ITree, IDataSource, IRenderer, IAccessibilityProvider,
|
|||
import { CollapseAction } from 'vs/workbench/browser/viewlet';
|
||||
import { TreeViewsViewletPanel, IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { IDebugService, IExpression, CONTEXT_WATCH_EXPRESSIONS_FOCUSED } from 'vs/workbench/parts/debug/common/debug';
|
||||
import { Expression, Variable, Model } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import { Expression, Variable, DebugModel } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import { AddWatchExpressionAction, RemoveAllWatchExpressionsAction, EditWatchExpressionAction, RemoveWatchExpressionAction } from 'vs/workbench/parts/debug/browser/debugActions';
|
||||
import { IContextMenuService, IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
@ -202,7 +202,7 @@ class WatchExpressionsDataSource implements IDataSource {
|
|||
}
|
||||
|
||||
public hasChildren(tree: ITree, element: any): boolean {
|
||||
if (element instanceof Model) {
|
||||
if (element instanceof DebugModel) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ class WatchExpressionsDataSource implements IDataSource {
|
|||
}
|
||||
|
||||
public getChildren(tree: ITree, element: any): TPromise<any> {
|
||||
if (element instanceof Model) {
|
||||
if (element instanceof DebugModel) {
|
||||
const viewModel = this.debugService.getViewModel();
|
||||
return TPromise.join(element.getWatchExpressions().map(we =>
|
||||
we.name ? we.evaluate(viewModel.focusedSession, viewModel.focusedStackFrame, 'watch').then(() => we) : TPromise.as(we)));
|
||||
|
@ -344,7 +344,7 @@ class WatchExpressionsController extends BaseDebugController {
|
|||
const expression = <IExpression>element;
|
||||
this.debugService.getViewModel().setSelectedExpression(expression);
|
||||
return true;
|
||||
} else if (element instanceof Model && event.detail === 2) {
|
||||
} else if (element instanceof DebugModel && event.detail === 2) {
|
||||
// Double click in watch panel triggers to add a new watch expression
|
||||
this.debugService.addWatchExpression();
|
||||
return true;
|
||||
|
@ -376,8 +376,8 @@ class WatchExpressionsDragAndDrop extends DefaultDragAndDrop {
|
|||
return elements[0].name;
|
||||
}
|
||||
|
||||
public onDragOver(tree: ITree, data: IDragAndDropData, target: Expression | Model, originalEvent: DragMouseEvent): IDragOverReaction {
|
||||
if (target instanceof Expression || target instanceof Model) {
|
||||
public onDragOver(tree: ITree, data: IDragAndDropData, target: Expression | DebugModel, originalEvent: DragMouseEvent): IDragOverReaction {
|
||||
if (target instanceof Expression || target instanceof DebugModel) {
|
||||
return {
|
||||
accept: true,
|
||||
autoExpand: false
|
||||
|
@ -387,12 +387,12 @@ class WatchExpressionsDragAndDrop extends DefaultDragAndDrop {
|
|||
return DRAG_OVER_REJECT;
|
||||
}
|
||||
|
||||
public drop(tree: ITree, data: IDragAndDropData, target: Expression | Model, originalEvent: DragMouseEvent): void {
|
||||
public drop(tree: ITree, data: IDragAndDropData, target: Expression | DebugModel, originalEvent: DragMouseEvent): void {
|
||||
const draggedData = data.getData();
|
||||
if (Array.isArray(draggedData)) {
|
||||
const draggedElement = <Expression>draggedData[0];
|
||||
const watches = this.debugService.getModel().getWatchExpressions();
|
||||
const position = target instanceof Model ? watches.length - 1 : watches.indexOf(target);
|
||||
const position = target instanceof DebugModel ? watches.length - 1 : watches.indexOf(target);
|
||||
this.debugService.moveWatchExpression(draggedElement.getId(), position);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import { Event } from 'vs/base/common/event';
|
|||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { Position } from 'vs/editor/common/core/position';
|
||||
import { ILaunch, IDebugService, State, IDebugSession, IConfigurationManager, IStackFrame, IBreakpointData, IBreakpointUpdateData, IConfig, IModel, IViewModel, IBreakpoint, LoadedSourceEvent, IThread, IRawModelUpdate, ActualBreakpoints, IFunctionBreakpoint, IExceptionBreakpoint, IDebugger, IExceptionInfo, AdapterEndEvent } from 'vs/workbench/parts/debug/common/debug';
|
||||
import { ILaunch, IDebugService, State, IDebugSession, IConfigurationManager, IStackFrame, IBreakpointData, IBreakpointUpdateData, IConfig, IDebugModel, IViewModel, IBreakpoint, LoadedSourceEvent, IThread, IRawModelUpdate, ActualBreakpoints, IFunctionBreakpoint, IExceptionBreakpoint, IDebugger, IExceptionInfo, AdapterEndEvent } from 'vs/workbench/parts/debug/common/debug';
|
||||
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
|
||||
import { ISuggestion } from 'vs/editor/common/modes';
|
||||
|
||||
|
@ -109,7 +109,7 @@ export class MockDebugService implements IDebugService {
|
|||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
public getModel(): IModel {
|
||||
public getModel(): IDebugModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,18 +6,18 @@
|
|||
import * as assert from 'assert';
|
||||
import { URI as uri } from 'vs/base/common/uri';
|
||||
import severity from 'vs/base/common/severity';
|
||||
import { SimpleReplElement, Model, Expression, RawObjectReplElement, StackFrame, Thread } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import { SimpleReplElement, DebugModel, Expression, RawObjectReplElement, StackFrame, Thread } from 'vs/workbench/parts/debug/common/debugModel';
|
||||
import * as sinon from 'sinon';
|
||||
import { MockRawSession } from 'vs/workbench/parts/debug/test/common/mockDebug';
|
||||
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
|
||||
import { DebugSession } from 'vs/workbench/parts/debug/electron-browser/debugSession';
|
||||
|
||||
suite('Debug - Model', () => {
|
||||
let model: Model;
|
||||
let model: DebugModel;
|
||||
let rawSession: MockRawSession;
|
||||
|
||||
setup(() => {
|
||||
model = new Model([], true, [], [], [], <any>{ isDirty: (e: any) => false });
|
||||
model = new DebugModel([], true, [], [], [], <any>{ isDirty: (e: any) => false });
|
||||
rawSession = new MockRawSession();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue