Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Dispose telemetryReporter in the end
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-rao-a committed Jan 3, 2018
1 parent 542f838 commit a112302
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 40 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -42,7 +42,7 @@
"vscode-debug-logger": "^0.0.4",
"vscode-debugadapter": "^1.11.0",
"vscode-debugprotocol": "^1.11.0",
"vscode-extension-telemetry": "0.0.5",
"vscode-extension-telemetry": "0.0.10",
"vscode-languageclient": "^2.5.0"
},
"devDependencies": {
Expand Down Expand Up @@ -979,4 +979,4 @@
]
}
}
}
}
5 changes: 3 additions & 2 deletions src/goMain.ts
Expand Up @@ -30,7 +30,7 @@ import * as goGenerateTests from './goGenerateTests';
import { addImport } from './goImport';
import { getAllPackages } from './goPackages';
import { installAllTools, checkLanguageServer } from './goInstallTools';
import { isGoPathSet, getBinPath, sendTelemetryEvent, getExtensionCommands, getGoVersion, getCurrentGoPath, getToolsGopath, handleDiagnosticErrors } from './util';
import { isGoPathSet, getBinPath, sendTelemetryEvent, getExtensionCommands, getGoVersion, getCurrentGoPath, getToolsGopath, handleDiagnosticErrors, disposeTelemetryReporter } from './util';
import { LanguageClient } from 'vscode-languageclient';
import { clearCacheForTools } from './goPath';
import { addTags, removeTags } from './goModifytags';
Expand Down Expand Up @@ -331,7 +331,8 @@ export function activate(ctx: vscode.ExtensionContext): void {
sendTelemetryEventForConfig(vscode.workspace.getConfiguration('go', vscode.window.activeTextEditor ? vscode.window.activeTextEditor.document.uri : null));
}

function deactivate() {
export function deactivate() {
return disposeTelemetryReporter();
}

function runBuilds(document: vscode.TextDocument, goConfig: vscode.WorkspaceConfiguration) {
Expand Down
7 changes: 7 additions & 0 deletions src/util.ts
Expand Up @@ -276,6 +276,13 @@ export function sendTelemetryEvent(eventName: string, properties?: {
telemtryReporter.sendTelemetryEvent(eventName, properties, measures);
}

export function disposeTelemetryReporter(): Promise<any> {
if (telemtryReporter) {
return telemtryReporter.dispose();
}
return Promise.resolve(null);
}

export function isPositionInString(document: vscode.TextDocument, position: vscode.Position): boolean {
let lineText = document.lineAt(position.line).text;
let lineTillCurrentPosition = lineText.substr(0, position.character);
Expand Down
36 changes: 0 additions & 36 deletions typings/vscode-extension-telemetry.d.ts

This file was deleted.

0 comments on commit a112302

Please sign in to comment.