Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Commit

Permalink
Merge pull request #631 from changsi-an/master
Browse files Browse the repository at this point in the history
Use the telemetry collector to append an additional telemetry property for launch request.
  • Loading branch information
roblourens authored Mar 23, 2018
2 parents 6a1b6e9 + 736af28 commit d507c9e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
],
"license": "SEE LICENSE IN LICENSE.txt",
"dependencies": {
"vscode-chrome-debug-core": "^3.23.10",
"vscode-chrome-debug-core": "^3.23.11",
"vscode-debugadapter": "^1.28.0-pre.2",
"vscode-nls": "^3.2.1"
},
Expand Down
9 changes: 6 additions & 3 deletions src/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as os from 'os';
import * as fs from 'fs';
import * as path from 'path';

import {ChromeDebugAdapter as CoreDebugAdapter, logger, utils as coreUtils, ISourceMapPathOverrides, ChromeDebugSession, telemetry } from 'vscode-chrome-debug-core';
import {ChromeDebugAdapter as CoreDebugAdapter, logger, utils as coreUtils, ISourceMapPathOverrides, ChromeDebugSession, telemetry, ITelemetryPropertyCollector } from 'vscode-chrome-debug-core';
import { spawn, ChildProcess, fork, execSync } from 'child_process';
import { Crdp } from 'vscode-chrome-debug-core';
import { DebugProtocol } from 'vscode-debugprotocol';
Expand Down Expand Up @@ -48,13 +48,16 @@ export class ChromeDebugAdapter extends CoreDebugAdapter {
return capabilities;
}

public launch(args: ILaunchRequestArgs): Promise<void> {
public launch(args: ILaunchRequestArgs, telemetryPropertyCollector: ITelemetryPropertyCollector, seq?: number): Promise<void> {
if (args.breakOnLoad && !args.breakOnLoadStrategy) {
args.breakOnLoadStrategy = 'instrument';
}

return super.launch(args).then(async () => {
return super.launch(args, telemetryPropertyCollector).then(async () => {
let runtimeExecutable: string;
if (args.shouldLaunchChromeUnelevated !== undefined) {
telemetryPropertyCollector.addTelemetryProperty('shouldLaunchChromeUnelevated', args.shouldLaunchChromeUnelevated.toString());
}
if (args.runtimeExecutable) {
const re = findExecutable(args.runtimeExecutable);
if (!re) {
Expand Down
5 changes: 3 additions & 2 deletions test/chromeDebugAdapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*--------------------------------------------------------*/

import { DebugProtocol } from 'vscode-debugprotocol';
import { chromeConnection, ISourceMapPathOverrides } from 'vscode-chrome-debug-core';
import { chromeConnection, ISourceMapPathOverrides, telemetry } from 'vscode-chrome-debug-core';

import * as mockery from 'mockery';
import { EventEmitter } from 'events';
Expand Down Expand Up @@ -121,7 +121,8 @@ suite('ChromeDebugAdapter', () => {
.setup(x => x.evaluate(It.isAny()))
.returns(() => Promise.resolve<any>({ result: { type: 'string', value: '123' }}));

return chromeDebugAdapter.launch({ file: 'c:\\path with space\\index.html', runtimeArgs: ['abc', 'def'] })
return chromeDebugAdapter.launch({ file: 'c:\\path with space\\index.html', runtimeArgs: ['abc', 'def'] },
new telemetry.TelemetryPropertyCollector())
.then(() => assert(spawnCalled));
});
});
Expand Down

0 comments on commit d507c9e

Please sign in to comment.