Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions src/coreclr-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let _installLog: NodeJS.WritableStream;
let _reporter: TelemetryReporter; // Telemetry reporter
const _completionFileName: string = 'install.complete';

export function installCoreClrDebug(context: vscode.ExtensionContext) {
export function installCoreClrDebug(context: vscode.ExtensionContext, reporter: TelemetryReporter) {
_coreClrDebugDir = path.join(context.extensionPath, 'coreclr-debug');
_debugAdapterDir = path.join(_coreClrDebugDir, 'debugAdapters');

Expand All @@ -39,7 +39,7 @@ export function installCoreClrDebug(context: vscode.ExtensionContext) {
return;
}

initializeTelemetry(context);
_reporter = reporter;
_channel = vscode.window.createOutputChannel('coreclr-debug');

// Create our log file and override _channel.append to also outpu to the log
Expand Down Expand Up @@ -95,17 +95,6 @@ export function installCoreClrDebug(context: vscode.ExtensionContext) {
});
}

function initializeTelemetry(context: vscode.ExtensionContext) {
// parse our own package.json into json
const packageJson = JSON.parse(fs.readFileSync(path.join(context.extensionPath, 'package.json')).toString());

let extensionId = packageJson["publisher"] + "." + packageJson["name"];
let extensionVersion = packageJson["version"];
let aiKey = packageJson.contributes.debuggers[0]["aiKey"];

_reporter = new TelemetryReporter(extensionId, extensionVersion, aiKey);
}

function logTelemetry(eventName: string, properties?: {[prop: string]: string}) {
if (_reporter)
{
Expand Down
13 changes: 11 additions & 2 deletions src/omnisharpMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,23 @@ import reportStatus from './features/omnisharpStatus';
import {installCoreClrDebug} from './coreclr-debug';
import {promptToAddBuildTaskIfNecessary} from './tasks';
import * as vscode from 'vscode';
import TelemetryReporter from 'vscode-extension-telemetry';

export function activate(context: vscode.ExtensionContext): any {

const extensionId = 'ms-vscode.csharp';
const extension = vscode.extensions.getExtension(extensionId);
const extensionVersion = extension.packageJSON.version;
const aiKey = extension.packageJSON.contributes.debuggers[0].aiKey;

const reporter = new TelemetryReporter(extensionId, extensionVersion, aiKey);

const _selector: vscode.DocumentSelector = {
language: 'csharp',
scheme: 'file' // only files from disk
};

const server = new StdioOmnisharpServer();
const server = new StdioOmnisharpServer(reporter);
const advisor = new Advisor(server); // create before server is started
const disposables: vscode.Disposable[] = [];
const localDisposables: vscode.Disposable[] = [];
Expand Down Expand Up @@ -74,14 +82,15 @@ export function activate(context: vscode.ExtensionContext): any {
// stop server on deactivate
disposables.push(new vscode.Disposable(() => {
advisor.dispose();
server.reportAndClearTelemetry();
server.stop();
}));

// Check to see if there is a tasks.json with a "build" task and prompt the user to add it if missing.
promptToAddBuildTaskIfNecessary();

// install coreclr-debug
installCoreClrDebug(context);
installCoreClrDebug(context, reporter);

context.subscriptions.push(...disposables);
}
Expand Down
Loading