提交 48701207 编写于 作者: I isidor

debug: remove SessionRequestType

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