提交 95bdfe00 编写于 作者: I isidor

debug: move firstSessionStart to view model

上级 2719dec1
......@@ -9,6 +9,8 @@ import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/c
export class ViewModel implements IViewModel {
firstSessionStart = true;
private _focusedStackFrame: IStackFrame;
private _focusedSession: ISession;
private _focusedThread: IThread;
......@@ -32,15 +34,15 @@ export class ViewModel implements IViewModel {
this.loadedScriptsSupportedContextKey = CONTEXT_LOADED_SCRIPTS_SUPPORTED.bindTo(contextKeyService);
}
public getId(): string {
getId(): string {
return 'root';
}
public get focusedSession(): ISession {
get focusedSession(): ISession {
return this._focusedSession;
}
public get focusedThread(): IThread {
get focusedThread(): IThread {
if (this._focusedStackFrame) {
return this._focusedStackFrame.thread;
}
......@@ -54,11 +56,11 @@ export class ViewModel implements IViewModel {
return undefined;
}
public get focusedStackFrame(): IStackFrame {
get focusedStackFrame(): IStackFrame {
return this._focusedStackFrame;
}
public setFocus(stackFrame: IStackFrame, thread: IThread, session: ISession, explicit: boolean): void {
setFocus(stackFrame: IStackFrame, thread: IThread, session: ISession, explicit: boolean): void {
let shouldEmit = this._focusedSession !== session || this._focusedThread !== thread || this._focusedStackFrame !== stackFrame;
if (this._focusedSession !== session) {
......@@ -75,42 +77,42 @@ export class ViewModel implements IViewModel {
}
}
public get onDidFocusSession(): Event<ISession> {
get onDidFocusSession(): Event<ISession> {
return this._onDidFocusSession.event;
}
public get onDidFocusStackFrame(): Event<{ stackFrame: IStackFrame, explicit: boolean }> {
get onDidFocusStackFrame(): Event<{ stackFrame: IStackFrame, explicit: boolean }> {
return this._onDidFocusStackFrame.event;
}
public getSelectedExpression(): IExpression {
getSelectedExpression(): IExpression {
return this.selectedExpression;
}
public setSelectedExpression(expression: IExpression) {
setSelectedExpression(expression: IExpression) {
this.selectedExpression = expression;
this.expressionSelectedContextKey.set(!!expression);
this._onDidSelectExpression.fire(expression);
}
public get onDidSelectExpression(): Event<IExpression> {
get onDidSelectExpression(): Event<IExpression> {
return this._onDidSelectExpression.event;
}
public getSelectedFunctionBreakpoint(): IFunctionBreakpoint {
getSelectedFunctionBreakpoint(): IFunctionBreakpoint {
return this.selectedFunctionBreakpoint;
}
public setSelectedFunctionBreakpoint(functionBreakpoint: IFunctionBreakpoint): void {
setSelectedFunctionBreakpoint(functionBreakpoint: IFunctionBreakpoint): void {
this.selectedFunctionBreakpoint = functionBreakpoint;
this.breakpointSelectedContextKey.set(!!functionBreakpoint);
}
public isMultiSessionView(): boolean {
isMultiSessionView(): boolean {
return this.multiSessionView;
}
public setMultiSessionView(isMultiSessionView: boolean): void {
setMultiSessionView(isMultiSessionView: boolean): void {
this.multiSessionView = isMultiSessionView;
}
}
......@@ -75,7 +75,6 @@ export class DebugService implements IDebugService {
private debugState: IContextKey<string>;
private inDebugMode: IContextKey<boolean>;
private breakpointsToSendOnResourceSaved: Set<string>;
private firstSessionStart: boolean;
private skipRunningTask: boolean;
private previousState: State;
......@@ -117,7 +116,6 @@ export class DebugService implements IDebugService {
this.loadExceptionBreakpoints(), this.loadWatchExpressions());
this.toDispose.push(this.model);
this.viewModel = new ViewModel(contextKeyService);
this.firstSessionStart = true;
this.registerListeners();
}
......@@ -646,16 +644,16 @@ export class DebugService implements IDebugService {
this._onDidNewSession.fire(session);
const internalConsoleOptions = resolved.internalConsoleOptions || this.configurationService.getValue<IDebugConfiguration>('debug').internalConsoleOptions;
if (internalConsoleOptions === 'openOnSessionStart' || (this.firstSessionStart && internalConsoleOptions === 'openOnFirstSessionStart')) {
if (internalConsoleOptions === 'openOnSessionStart' || (this.viewModel.firstSessionStart && internalConsoleOptions === 'openOnFirstSessionStart')) {
this.panelService.openPanel(REPL_ID, false).done(undefined, errors.onUnexpectedError);
}
const openDebug = this.configurationService.getValue<IDebugConfiguration>('debug').openDebug;
// Open debug viewlet based on the visibility of the side bar and openDebug setting
if (openDebug === 'openOnSessionStart' || (openDebug === 'openOnFirstSessionStart' && this.firstSessionStart)) {
if (openDebug === 'openOnSessionStart' || (openDebug === 'openOnFirstSessionStart' && this.viewModel.firstSessionStart)) {
this.viewletService.openViewlet(VIEWLET_ID);
}
this.firstSessionStart = false;
this.viewModel.firstSessionStart = false;
this.debugType.set(resolved.type);
if (this.model.getSessions().length > 1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册