Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Commit

Permalink
Add __restart support for microsoft/vscode-node-debug2#103
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Jun 22, 2017
1 parent b46f585 commit f8d4ffc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/chrome/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {ICommonRequestArgs, ILaunchRequestArgs, ISetBreakpointsArgs, ISetBreakpo
IAttachRequestArgs, IScopesResponseBody, IVariablesResponseBody,
ISourceResponseBody, IThreadsResponseBody, IEvaluateResponseBody, ISetVariableResponseBody, IDebugAdapter,
ICompletionsResponseBody, IToggleSkipFileStatusArgs, IInternalStackTraceResponseBody, ILoadedScript, IAllLoadedScriptsResponseBody,
IExceptionInfoResponseBody, ISetBreakpointResult, TimeTravelRuntime} from '../debugAdapterInterfaces';
IExceptionInfoResponseBody, ISetBreakpointResult, TimeTravelRuntime, IRestartRequestArgs} from '../debugAdapterInterfaces';
import {IChromeDebugAdapterOpts, ChromeDebugSession} from './chromeDebugSession';
import {ChromeConnection} from './chromeConnection';
import * as ChromeUtils from './chromeUtils';
Expand Down Expand Up @@ -130,6 +130,7 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
protected _inShutdown: boolean;
protected _attachMode: boolean;
protected _launchAttachArgs: ICommonRequestArgs;
protected _port: number;
private _blackboxedRegexes: RegExp[] = [];
private _skipFileStatuses = new Map<string, boolean>();

Expand Down Expand Up @@ -230,7 +231,10 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
this._sourceMapTransformer.launch(args);
this._pathTransformer.launch(args);

telemetry.reportEvent('debugStarted', { request: 'launch', args: Object.keys(args) });
if (!args.__restart) {
telemetry.reportEvent('debugStarted', { request: 'launch', args: Object.keys(args) });
}

return Promise.resolve();
}

Expand Down Expand Up @@ -272,7 +276,7 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
this._session.shutdown();
}

protected terminateSession(reason: string, restart?: boolean): void {
protected terminateSession(reason: string, restart?: IRestartRequestArgs): void {
logger.log('Terminated: ' + reason);

if (!this._hasTerminated) {
Expand Down Expand Up @@ -328,6 +332,8 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
await this._chromeConnection.attach(address, port, targetUrl, timeout);
}

this._port = port;

this.hookConnectionEvents();
let patterns: string[] = [];

Expand Down
5 changes: 5 additions & 0 deletions src/debugAdapterInterfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ export interface ICommonRequestArgs {
showAsyncStacks?: boolean;
}

export interface IRestartRequestArgs {
port: number;
}

/**
* Properties needed by -core, just a subset of the properties needed for launch in general
*/
export interface ILaunchRequestArgs extends DebugProtocol.LaunchRequestArguments, ICommonRequestArgs {
__restart?: IRestartRequestArgs;
}

export interface IAttachRequestArgs extends DebugProtocol.AttachRequestArguments, ICommonRequestArgs {
Expand Down

0 comments on commit f8d4ffc

Please sign in to comment.