From 4870120726ca8a7440d303aad6eebb962d0b3f66 Mon Sep 17 00:00:00 2001 From: isidor Date: Wed, 18 Jan 2017 12:48:47 +0100 Subject: [PATCH] debug: remove SessionRequestType --- src/vs/workbench/parts/debug/browser/debugActions.ts | 4 ++-- .../workbench/parts/debug/browser/debugActionsWidget.ts | 2 +- src/vs/workbench/parts/debug/common/debug.ts | 8 +------- src/vs/workbench/parts/debug/common/debugModel.ts | 4 ++++ .../parts/debug/electron-browser/rawDebugSession.ts | 3 --- src/vs/workbench/parts/debug/test/common/mockDebug.ts | 6 +----- 6 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/vs/workbench/parts/debug/browser/debugActions.ts b/src/vs/workbench/parts/debug/browser/debugActions.ts index 9b267d76537..6715dbe037d 100644 --- a/src/vs/workbench/parts/debug/browser/debugActions.ts +++ b/src/vs/workbench/parts/debug/browser/debugActions.ts @@ -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 { diff --git a/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts b/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts index 3ef3fcc3dde..01ba860401b 100644 --- a/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts +++ b/src/vs/workbench/parts/debug/browser/debugActionsWidget.ts @@ -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) { diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index 3f6a5701b48..96083e00530 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -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; scopes(args: DebugProtocol.ScopesArguments): TPromise; variables(args: DebugProtocol.VariablesArguments): TPromise; @@ -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; diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index 9a1a4fba638..302890f4bb3 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -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); } diff --git a/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts b/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts index 04be8868b7e..fda0b9b1db1 100644 --- a/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts +++ b/src/vs/workbench/parts/debug/electron-browser/rawDebugSession.ts @@ -50,7 +50,6 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession { private socket: net.Socket = null; private cachedInitServer: TPromise; private startTime: number; - public requestType: debug.SessionRequestType; public disconnected: boolean; private sentPromises: TPromise[]; private capabilities: DebugProtocol.Capabilities; @@ -241,12 +240,10 @@ export class RawDebugSession extends v8.V8Protocol implements debug.ISession { } public launch(args: DebugProtocol.LaunchRequestArguments): TPromise { - 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 { - this.requestType = debug.SessionRequestType.ATTACH; return this.send('attach', args).then(response => this.readCapabilities(response)); } diff --git a/src/vs/workbench/parts/debug/test/common/mockDebug.ts b/src/vs/workbench/parts/debug/test/common/mockDebug.ts index 7e8acab6248..ffd1e3802b6 100644 --- a/src/vs/workbench/parts/debug/test/common/mockDebug.ts +++ b/src/vs/workbench/parts/debug/test/common/mockDebug.ts @@ -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; } -- GitLab