提交 48701207 编写于 作者: I isidor

debug: remove SessionRequestType

上级 f1ef98af
......@@ -11,7 +11,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IDebugService, State, IProcess, SessionRequestType, IThread, IEnablement, IBreakpoint, IStackFrame, IFunctionBreakpoint, IDebugEditorContribution, EDITOR_CONTRIBUTION_ID, IExpression, REPL_ID }
import { IDebugService, State, IProcess, IThread, IEnablement, IBreakpoint, IStackFrame, IFunctionBreakpoint, IDebugEditorContribution, EDITOR_CONTRIBUTION_ID, IExpression, REPL_ID }
from 'vs/workbench/parts/debug/common/debug';
import { Variable, Expression, Thread, Breakpoint, Process } from 'vs/workbench/parts/debug/common/debugModel';
import { IPartService } from 'vs/workbench/services/part/common/partService';
......@@ -179,7 +179,7 @@ export class RestartAction extends AbstractDebugAction {
}
private setLabel(process: IProcess): void {
this.updateLabel(process && process.session.requestType === SessionRequestType.ATTACH ? RestartAction.RECONNECT_LABEL : RestartAction.LABEL);
this.updateLabel(process && process.isAttach() ? RestartAction.RECONNECT_LABEL : RestartAction.LABEL);
}
public run(process: IProcess): TPromise<any> {
......
......@@ -209,7 +209,7 @@ export class DebugActionsWidget implements IWorkbenchContribution {
const state = this.debugService.state;
const process = this.debugService.getViewModel().focusedProcess;
const attached = process && !strings.equalsIgnoreCase(process.session.configuration.type, 'extensionHost') && process.session.requestType === debug.SessionRequestType.ATTACH;
const attached = process && !strings.equalsIgnoreCase(process.session.configuration.type, 'extensionHost') && process.isAttach();
return this.allActions.filter(a => {
if (a.id === ContinueAction.ID) {
......
......@@ -68,14 +68,7 @@ export interface IExpression extends ITreeElement, IExpressionContainer {
type?: string;
}
export enum SessionRequestType {
LAUNCH,
ATTACH,
LAUNCH_NO_DEBUG
}
export interface ISession {
requestType: SessionRequestType;
stackTrace(args: DebugProtocol.StackTraceArguments): TPromise<DebugProtocol.StackTraceResponse>;
scopes(args: DebugProtocol.ScopesArguments): TPromise<DebugProtocol.ScopesResponse>;
variables(args: DebugProtocol.VariablesArguments): TPromise<DebugProtocol.VariablesResponse>;
......@@ -104,6 +97,7 @@ export interface IProcess extends ITreeElement {
name: string;
configuration: IConfig;
session: ISession;
isAttach(): boolean;
getThread(threadId: number): IThread;
getAllThreads(): IThread[];
completions(frameId: number, text: string, position: Position, overwriteBefore: number): TPromise<ISuggestion[]>;
......
......@@ -504,6 +504,10 @@ export class Process implements debug.IProcess {
return this.configuration.name;
}
public isAttach(): boolean {
return this.configuration.type === 'attach';
}
public getThread(threadId: number): Thread {
return this.threads.get(threadId);
}
......
......@@ -50,7 +50,6 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession {
private socket: net.Socket = null;
private cachedInitServer: TPromise<void>;
private startTime: number;
public requestType: debug.SessionRequestType;
public disconnected: boolean;
private sentPromises: TPromise<DebugProtocol.Response>[];
private capabilities: DebugProtocol.Capabilities;
......@@ -241,12 +240,10 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession {
}
public launch(args: DebugProtocol.LaunchRequestArguments): TPromise<DebugProtocol.LaunchResponse> {
this.requestType = args.noDebug ? debug.SessionRequestType.LAUNCH_NO_DEBUG : debug.SessionRequestType.LAUNCH;
return this.send('launch', args).then(response => this.readCapabilities(response));
}
public attach(args: DebugProtocol.AttachRequestArguments): TPromise<DebugProtocol.AttachResponse> {
this.requestType = debug.SessionRequestType.ATTACH;
return this.send('attach', args).then(response => this.readCapabilities(response));
}
......
......@@ -6,7 +6,7 @@
import uri from 'vs/base/common/uri';
import Event from 'vs/base/common/event';
import { TPromise } from 'vs/base/common/winjs.base';
import debug = require('vs/workbench/parts/debug/common/debug');
import * as debug from 'vs/workbench/parts/debug/common/debug';
export class MockDebugService implements debug.IDebugService {
public _serviceBrand: any;
......@@ -98,10 +98,6 @@ export class MockSession implements debug.ISession {
return 'mockrawsession';
}
public get requestType() {
return debug.SessionRequestType.LAUNCH;
}
public getLengthInSeconds(): number {
return 100;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册