提交 78f6a691 编写于 作者: I isidor

move debug session to a seperate file in electron-browser

上级 c0f818e5
......@@ -14,7 +14,7 @@ import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/
import { IFileService } from 'vs/platform/files/common/files';
import { IDebugService, State, ISession, IThread, IEnablement, IBreakpoint, IStackFrame, REPL_ID, SessionState }
from 'vs/workbench/parts/debug/common/debug';
import { Variable, Expression, Thread, Breakpoint, Session } from 'vs/workbench/parts/debug/common/debugModel';
import { Variable, Expression, Thread, Breakpoint } from 'vs/workbench/parts/debug/common/debugModel';
import { IPartService } from 'vs/workbench/services/part/common/partService';
import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
......@@ -230,7 +230,7 @@ export class RestartAction extends AbstractDebugAction {
}
public run(session: ISession): TPromise<any> {
if (!(session instanceof Session)) {
if (!session || !session.getId) {
session = this.debugService.getViewModel().focusedSession;
}
......@@ -325,7 +325,7 @@ export class StopAction extends AbstractDebugAction {
}
public run(session: ISession): TPromise<any> {
if (!(session instanceof Session)) {
if (!session || !session.getId) {
session = this.debugService.getViewModel().focusedSession;
}
......
......@@ -146,16 +146,20 @@ export enum SessionState {
}
export interface ISession extends ITreeElement {
getName(includeRoot: boolean): string;
readonly configuration: IConfig;
readonly raw: IRawSession;
readonly state: SessionState;
getName(includeRoot: boolean): string;
getSourceForUri(modelUri: uri): Source;
getThread(threadId: number): IThread;
getAllThreads(): ReadonlyArray<IThread>;
getSource(raw: DebugProtocol.Source): Source;
getLoadedSources(): TPromise<Source[]>;
completions(frameId: number, text: string, position: Position, overwriteBefore: number): TPromise<ISuggestion[]>;
clearThreads(removeThreads: boolean, reference?: number): void;
rawUpdate(data: IRawModelUpdate): void;
}
export interface IThread extends ITreeElement {
......
......@@ -16,14 +16,11 @@ import severity from 'vs/base/common/severity';
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 { ISuggestion } from 'vs/editor/common/modes';
import { Position } from 'vs/editor/common/core/position';
import {
ITreeElement, IExpression, IExpressionContainer, ISession, IStackFrame, IExceptionBreakpoint, IBreakpoint, IFunctionBreakpoint, IModel, IReplElementSource,
IConfig, IRawSession, IThread, IRawModelUpdate, IScope, IRawStoppedDetails, IEnablement, IBreakpointData, IExceptionInfo, IReplElement, SessionState, IBreakpointsChangeEvent, IBreakpointUpdateData, IBaseBreakpoint
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';
import { mixin } from 'vs/base/common/objects';
import { commonSuffixLength } from 'vs/base/common/strings';
import { sep } from 'vs/base/common/paths';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
......@@ -552,175 +549,6 @@ export class Thread implements IThread {
}
}
export class Session implements ISession {
private sources: Map<string, Source>;
private threads: Map<number, Thread>;
constructor(private _configuration: { resolved: IConfig, unresolved: IConfig }, private session: IRawSession & ITreeElement) {
this.threads = new Map<number, Thread>();
this.sources = new Map<string, Source>();
}
public get configuration(): IConfig {
return this._configuration.resolved;
}
public get unresolvedConfiguration(): IConfig {
return this._configuration.unresolved;
}
public get raw(): IRawSession & ITreeElement {
return this.session;
}
public set raw(value: IRawSession & ITreeElement) {
this.session = value;
}
public getName(includeRoot: boolean): string {
return includeRoot && this.raw.root ? `${this.configuration.name} (${resources.basenameOrAuthority(this.raw.root.uri)})` : this.configuration.name;
}
public get state(): SessionState {
return this.configuration.type === 'attach' ? SessionState.ATTACH : SessionState.LAUNCH;
}
public getSourceForUri(modelUri: uri): Source {
return this.sources.get(modelUri.toString());
}
public getSource(raw: DebugProtocol.Source): Source {
let source = new Source(raw, this.getId());
if (this.sources.has(source.uri.toString())) {
source = this.sources.get(source.uri.toString());
source.raw = mixin(source.raw, raw);
if (source.raw && raw) {
// Always take the latest presentation hint from adapter #42139
source.raw.presentationHint = raw.presentationHint;
}
} else {
this.sources.set(source.uri.toString(), source);
}
return source;
}
public getThread(threadId: number): Thread {
return this.threads.get(threadId);
}
public getAllThreads(): IThread[] {
const result: IThread[] = [];
this.threads.forEach(t => result.push(t));
return result;
}
public getLoadedSources(): TPromise<Source[]> {
return this.raw.loadedSources({}).then(response => {
return response.body.sources.map(src => this.getSource(src));
}, error => {
return [];
});
}
public getId(): string {
return this.session.getId();
}
public rawUpdate(data: IRawModelUpdate): void {
if (data.thread && !this.threads.has(data.threadId)) {
// A new thread came in, initialize it.
this.threads.set(data.threadId, new Thread(this, data.thread.name, data.thread.id));
} else if (data.thread && data.thread.name) {
// Just the thread name got updated #18244
this.threads.get(data.threadId).name = data.thread.name;
}
if (data.stoppedDetails) {
// Set the availability of the threads' callstacks depending on
// whether the thread is stopped or not
if (data.stoppedDetails.allThreadsStopped) {
this.threads.forEach(thread => {
thread.stoppedDetails = thread.threadId === data.threadId ? data.stoppedDetails : { reason: undefined };
thread.stopped = true;
thread.clearCallStack();
});
} else if (this.threads.has(data.threadId)) {
// One thread is stopped, only update that thread.
const thread = this.threads.get(data.threadId);
thread.stoppedDetails = data.stoppedDetails;
thread.clearCallStack();
thread.stopped = true;
}
}
}
public clearThreads(removeThreads: boolean, reference: number = undefined): void {
if (reference !== undefined && reference !== null) {
if (this.threads.has(reference)) {
const thread = this.threads.get(reference);
thread.clearCallStack();
thread.stoppedDetails = undefined;
thread.stopped = false;
if (removeThreads) {
this.threads.delete(reference);
}
}
} else {
this.threads.forEach(thread => {
thread.clearCallStack();
thread.stoppedDetails = undefined;
thread.stopped = false;
});
if (removeThreads) {
this.threads.clear();
ExpressionContainer.allValues.clear();
}
}
}
public completions(frameId: number, text: string, position: Position, overwriteBefore: number): TPromise<ISuggestion[]> {
if (!this.raw.capabilities.supportsCompletionsRequest) {
return TPromise.as([]);
}
return this.raw.completions({
frameId,
text,
column: position.column,
line: position.lineNumber
}).then(response => {
const result: ISuggestion[] = [];
if (response && response.body && response.body.targets) {
response.body.targets.forEach(item => {
if (item && item.label) {
result.push({
label: item.label,
insertText: item.text || item.label,
type: item.type,
filterText: item.start && item.length && text.substr(item.start, item.length).concat(item.label),
overwriteBefore: item.length || overwriteBefore
});
}
});
}
return result;
}, () => []);
}
setNotAvailable(modelUri: uri) {
const source = this.sources.get(modelUri.toString());
if (source) {
source.available = false;
}
}
}
export class Enablement implements IEnablement {
constructor(
public enabled: boolean,
......@@ -905,7 +733,7 @@ export class ThreadAndSessionIds implements ITreeElement {
export class Model implements IModel {
private sessions: Session[];
private sessions: ISession[];
private toDispose: lifecycle.IDisposable[];
private replElements: IReplElement[];
private schedulers = new Map<string, RunOnceScheduler>();
......@@ -935,15 +763,12 @@ export class Model implements IModel {
return 'root';
}
public getSessions(): Session[] {
public getSessions(): ISession[] {
return this.sessions;
}
public addSession(configuration: { resolved: IConfig, unresolved: IConfig }, raw: IRawSession & ITreeElement): Session {
const session = new Session(configuration, raw);
public addSession(session: ISession): void {
this.sessions.push(session);
return session;
}
public removeSession(id: string): void {
......@@ -1277,7 +1102,7 @@ export class Model implements IModel {
}
public sourceIsNotAvailable(uri: uri): void {
this.sessions.forEach(p => p.setNotAvailable(uri));
this.sessions.forEach(p => p.getSourceForUri(uri).available = false);
this._onDidChangeCallStack.fire();
}
......
......@@ -10,7 +10,7 @@ import { TPromise } from 'vs/base/common/winjs.base';
import * as errors from 'vs/base/common/errors';
import { TreeViewsViewletPanel, IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { IDebugService, State, IStackFrame, ISession, IThread, CONTEXT_CALLSTACK_ITEM_TYPE } from 'vs/workbench/parts/debug/common/debug';
import { Thread, StackFrame, ThreadAndSessionIds, Session, Model } from 'vs/workbench/parts/debug/common/debugModel';
import { Thread, StackFrame, ThreadAndSessionIds, Model } 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';
......@@ -28,6 +28,7 @@ import { Separator } from 'vs/base/browser/ui/actionbar/actionbar';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IViewletPanelOptions } from 'vs/workbench/browser/parts/views/panelViewlet';
import { IUriLabelService } from 'vs/platform/uriLabel/common/uriLabel';
import { Session } from 'vs/workbench/parts/debug/electron-browser/debugSession';
const $ = dom.$;
......
......@@ -28,7 +28,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import * as debug from 'vs/workbench/parts/debug/common/debug';
import { RawDebugSession } from 'vs/workbench/parts/debug/electron-browser/rawDebugSession';
import { Model, ExceptionBreakpoint, FunctionBreakpoint, Breakpoint, Expression, RawObjectReplElement, ExpressionContainer, Session, Thread } from 'vs/workbench/parts/debug/common/debugModel';
import { Model, ExceptionBreakpoint, FunctionBreakpoint, Breakpoint, Expression, RawObjectReplElement, ExpressionContainer, Thread } 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';
......@@ -55,6 +55,7 @@ import { normalizeDriveLetter } from 'vs/base/common/labels';
import { RunOnceScheduler } from 'vs/base/common/async';
import product from 'vs/platform/node/product';
import { deepClone, equals } from 'vs/base/common/objects';
import { Session } from 'vs/workbench/parts/debug/electron-browser/debugSession';
const DEBUG_BREAKPOINTS_KEY = 'debug.breakpoint';
const DEBUG_BREAKPOINTS_ACTIVATED_KEY = 'debug.breakpointactivated';
......@@ -895,7 +896,8 @@ export class DebugService implements debug.IDebugService {
const raw = this.instantiationService.createInstance(RawDebugSession, sessionId, configuration.resolved.debugServer, dbg, customTelemetryService, root);
if (!session) {
session = this.model.addSession(configuration, raw);
session = new Session(configuration, raw);
this.model.addSession(session);
this.allSessions.set(session.getId(), session);
} else {
session.raw = raw;
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import uri from 'vs/base/common/uri';
import * as resources from 'vs/base/common/resources';
import { TPromise } from 'vs/base/common/winjs.base';
import { ISuggestion } from 'vs/editor/common/modes';
import { Position } from 'vs/editor/common/core/position';
import { ITreeElement, ISession, IConfig, IRawSession, IThread, IRawModelUpdate, SessionState } 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 } from 'vs/workbench/parts/debug/common/debugModel';
export class Session implements ISession {
private sources: Map<string, Source>;
private threads: Map<number, Thread>;
constructor(private _configuration: { resolved: IConfig, unresolved: IConfig }, private session: IRawSession & ITreeElement) {
this.threads = new Map<number, Thread>();
this.sources = new Map<string, Source>();
}
public get configuration(): IConfig {
return this._configuration.resolved;
}
public get unresolvedConfiguration(): IConfig {
return this._configuration.unresolved;
}
public get raw(): IRawSession & ITreeElement {
return this.session;
}
public set raw(value: IRawSession & ITreeElement) {
this.session = value;
}
public getName(includeRoot: boolean): string {
return includeRoot && this.raw.root ? `${this.configuration.name} (${resources.basenameOrAuthority(this.raw.root.uri)})` : this.configuration.name;
}
public get state(): SessionState {
return this.configuration.type === 'attach' ? SessionState.ATTACH : SessionState.LAUNCH;
}
public getSourceForUri(modelUri: uri): Source {
return this.sources.get(modelUri.toString());
}
public getSource(raw: DebugProtocol.Source): Source {
let source = new Source(raw, this.getId());
if (this.sources.has(source.uri.toString())) {
source = this.sources.get(source.uri.toString());
source.raw = mixin(source.raw, raw);
if (source.raw && raw) {
// Always take the latest presentation hint from adapter #42139
source.raw.presentationHint = raw.presentationHint;
}
} else {
this.sources.set(source.uri.toString(), source);
}
return source;
}
public getThread(threadId: number): Thread {
return this.threads.get(threadId);
}
public getAllThreads(): IThread[] {
const result: IThread[] = [];
this.threads.forEach(t => result.push(t));
return result;
}
public getLoadedSources(): TPromise<Source[]> {
return this.raw.loadedSources({}).then(response => {
return response.body.sources.map(src => this.getSource(src));
}, error => {
return [];
});
}
public getId(): string {
return this.session.getId();
}
public rawUpdate(data: IRawModelUpdate): void {
if (data.thread && !this.threads.has(data.threadId)) {
// A new thread came in, initialize it.
this.threads.set(data.threadId, new Thread(this, data.thread.name, data.thread.id));
} else if (data.thread && data.thread.name) {
// Just the thread name got updated #18244
this.threads.get(data.threadId).name = data.thread.name;
}
if (data.stoppedDetails) {
// Set the availability of the threads' callstacks depending on
// whether the thread is stopped or not
if (data.stoppedDetails.allThreadsStopped) {
this.threads.forEach(thread => {
thread.stoppedDetails = thread.threadId === data.threadId ? data.stoppedDetails : { reason: undefined };
thread.stopped = true;
thread.clearCallStack();
});
} else if (this.threads.has(data.threadId)) {
// One thread is stopped, only update that thread.
const thread = this.threads.get(data.threadId);
thread.stoppedDetails = data.stoppedDetails;
thread.clearCallStack();
thread.stopped = true;
}
}
}
public clearThreads(removeThreads: boolean, reference: number = undefined): void {
if (reference !== undefined && reference !== null) {
if (this.threads.has(reference)) {
const thread = this.threads.get(reference);
thread.clearCallStack();
thread.stoppedDetails = undefined;
thread.stopped = false;
if (removeThreads) {
this.threads.delete(reference);
}
}
} else {
this.threads.forEach(thread => {
thread.clearCallStack();
thread.stoppedDetails = undefined;
thread.stopped = false;
});
if (removeThreads) {
this.threads.clear();
ExpressionContainer.allValues.clear();
}
}
}
public completions(frameId: number, text: string, position: Position, overwriteBefore: number): TPromise<ISuggestion[]> {
if (!this.raw.capabilities.supportsCompletionsRequest) {
return TPromise.as([]);
}
return this.raw.completions({
frameId,
text,
column: position.column,
line: position.lineNumber
}).then(response => {
const result: ISuggestion[] = [];
if (response && response.body && response.body.targets) {
response.body.targets.forEach(item => {
if (item && item.label) {
result.push({
label: item.label,
insertText: item.text || item.label,
type: item.type,
filterText: item.start && item.length && text.substr(item.start, item.length).concat(item.label),
overwriteBefore: item.length || overwriteBefore
});
}
});
}
return result;
}, () => []);
}
}
......@@ -6,7 +6,7 @@
import * as assert from 'assert';
import { replaceWhitespace, renderExpressionValue, renderVariable } from 'vs/workbench/parts/debug/browser/baseDebugView';
import * as dom from 'vs/base/browser/dom';
import { Expression, Variable, Session, Scope, StackFrame, Thread } from 'vs/workbench/parts/debug/common/debugModel';
import { Expression, Variable, Scope, StackFrame, Thread } from 'vs/workbench/parts/debug/common/debugModel';
import { MockSession } from 'vs/workbench/parts/debug/test/common/mockDebug';
const $ = dom.$;
......@@ -52,8 +52,7 @@ suite('Debug - Base Debug View', () => {
});
test('render variable', () => {
const rawSession = new MockSession();
const session = new Session({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, rawSession);
const session = new MockSession();
const thread = new Thread(session, 'mockthread', 1);
const stackFrame = new StackFrame(thread, 1, null, 'app.js', 'normal', { startLineNumber: 1, startColumn: 1, endLineNumber: undefined, endColumn: undefined }, 0);
const scope = new Scope(stackFrame, 1, 'local', 1, false, 10, 10);
......
......@@ -5,7 +5,7 @@
import * as assert from 'assert';
import { ViewModel } from 'vs/workbench/parts/debug/common/debugViewModel';
import { StackFrame, Expression, Thread, Session } from 'vs/workbench/parts/debug/common/debugModel';
import { StackFrame, Expression, Thread } from 'vs/workbench/parts/debug/common/debugModel';
import { MockSession } from 'vs/workbench/parts/debug/test/common/mockDebug';
import { MockContextKeyService } from 'vs/platform/keybinding/test/common/mockKeybindingService';
......@@ -23,8 +23,7 @@ suite('Debug - View Model', () => {
test('focused stack frame', () => {
assert.equal(model.focusedStackFrame, null);
assert.equal(model.focusedThread, null);
const mockSession = new MockSession();
const session = new Session({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, mockSession);
const session = new MockSession();
const thread = new Thread(session, 'myThread', 1);
const frame = new StackFrame(thread, 1, null, 'app.js', 'normal', { startColumn: 1, startLineNumber: 1, endColumn: undefined, endLineNumber: undefined }, 0);
model.setFocus(frame, thread, session, false);
......
......@@ -7,7 +7,10 @@ import uri from 'vs/base/common/uri';
import { Event, Emitter } from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { ILaunch, IDebugService, State, DebugEvent, ISession, IConfigurationManager, IStackFrame, IBreakpointData, IBreakpointUpdateData, IConfig, IModel, IViewModel, IRawSession, IBreakpoint, LoadedSourceEvent } from 'vs/workbench/parts/debug/common/debug';
import { Position } from 'vs/editor/common/core/position';
import { ILaunch, IDebugService, State, DebugEvent, ISession, IConfigurationManager, IStackFrame, IBreakpointData, IBreakpointUpdateData, IConfig, IModel, IViewModel, IRawSession, IBreakpoint, LoadedSourceEvent, SessionState, IThread, IRawModelUpdate } from 'vs/workbench/parts/debug/common/debug';
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
import { ISuggestion } from 'vs/editor/common/modes';
export class MockDebugService implements IDebugService {
public _serviceBrand: any;
......@@ -114,7 +117,49 @@ export class MockDebugService implements IDebugService {
public sourceIsNotAvailable(uri: uri): void { }
}
export class MockSession implements IRawSession {
export class MockSession implements ISession {
configuration: IConfig = { type: 'mock', request: 'launch' };
raw: IRawSession = new MockRawSession();
state = SessionState.LAUNCH;
getName(includeRoot: boolean): string {
return 'mockname';
}
getSourceForUri(modelUri: uri): Source {
return null;
}
getThread(threadId: number): IThread {
return null;
}
getAllThreads(): ReadonlyArray<IThread> {
return [];
}
getSource(raw: DebugProtocol.Source): Source {
return undefined;
}
getLoadedSources(): TPromise<Source[]> {
return TPromise.as([]);
}
completions(frameId: number, text: string, position: Position, overwriteBefore: number): TPromise<ISuggestion[]> {
return TPromise.as([]);
}
clearThreads(removeThreads: boolean, reference?: number): void { }
rawUpdate(data: IRawModelUpdate): void { }
getId(): string {
return 'mock';
}
}
export class MockRawSession implements IRawSession {
public readyForBreakpoints = true;
public emittedStopped = true;
......
......@@ -6,18 +6,19 @@
import * as assert from 'assert';
import uri from 'vs/base/common/uri';
import severity from 'vs/base/common/severity';
import { SimpleReplElement, Model, Session, Expression, RawObjectReplElement, StackFrame, Thread } from 'vs/workbench/parts/debug/common/debugModel';
import { SimpleReplElement, Model, Expression, RawObjectReplElement, StackFrame, Thread } from 'vs/workbench/parts/debug/common/debugModel';
import * as sinon from 'sinon';
import { MockSession } from 'vs/workbench/parts/debug/test/common/mockDebug';
import { MockRawSession } from 'vs/workbench/parts/debug/test/common/mockDebug';
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
import { Session } from 'vs/workbench/parts/debug/electron-browser/debugSession';
suite('Debug - Model', () => {
let model: Model;
let rawSession: MockSession;
let rawSession: MockRawSession;
setup(() => {
model = new Model([], true, [], [], []);
rawSession = new MockSession();
rawSession = new MockRawSession();
});
teardown(() => {
......@@ -108,8 +109,8 @@ suite('Debug - Model', () => {
test('threads simple', () => {
const threadId = 1;
const threadName = 'firstThread';
model.addSession({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, rawSession);
const session = new Session({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, rawSession);
model.addSession(session);
assert.equal(model.getSessions().length, 1);
model.rawUpdate({
sessionId: rawSession.getId(),
......@@ -119,7 +120,6 @@ suite('Debug - Model', () => {
name: threadName
}
});
const session = model.getSessions().filter(p => p.getId() === rawSession.getId()).pop();
assert.equal(session.getThread(threadId).name, threadName);
......@@ -140,7 +140,8 @@ suite('Debug - Model', () => {
const stoppedReason = 'breakpoint';
// Add the threads
model.addSession({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, rawSession);
const session = new Session({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, rawSession);
model.addSession(session);
model.rawUpdate({
sessionId: rawSession.getId(),
threadId: threadId1,
......@@ -169,7 +170,6 @@ suite('Debug - Model', () => {
allThreadsStopped: true
},
});
const session = model.getSessions().filter(p => p.getId() === rawSession.getId()).pop();
const thread1 = session.getThread(threadId1);
const thread2 = session.getThread(threadId2);
......@@ -230,7 +230,8 @@ suite('Debug - Model', () => {
const runningThreadId = 2;
const runningThreadName = 'runningThread';
const stoppedReason = 'breakpoint';
model.addSession({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, rawSession);
const session = new Session({ resolved: { name: 'mockSession', type: 'node', request: 'launch' }, unresolved: undefined }, rawSession);
model.addSession(session);
// Add the threads
model.rawUpdate({
sessionId: rawSession.getId(),
......@@ -260,7 +261,6 @@ suite('Debug - Model', () => {
allThreadsStopped: false
}
});
const session = model.getSessions().filter(p => p.getId() === rawSession.getId()).pop();
const stoppedThread = session.getThread(stoppedThreadId);
const runningThread = session.getThread(runningThreadId);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册