diff --git a/package-lock.json b/package-lock.json index f40f922..9c234d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "competitive-programming-helper", - "version": "5.16.0", + "version": "6.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "competitive-programming-helper", - "version": "5.16.0", + "version": "6.1.0", "license": "GPL-3.0-or-later", "dependencies": { "@vscode/extension-telemetry": "^0.9.0", @@ -20,7 +20,7 @@ "@types/node": "^20.9.5", "@types/react": "^18.2.38", "@types/react-dom": "^18.2.17", - "@types/vscode": "^1.84.2", + "@types/vscode": "^1.52.0", "@typescript-eslint/eslint-plugin": "^6.12.0", "@typescript-eslint/parser": "^6.12.0", "@vscode/codicons": "^0.0.35", diff --git a/src/companion.ts b/src/companion.ts index c500c16..1d4ad0b 100644 --- a/src/companion.ts +++ b/src/companion.ts @@ -104,13 +104,16 @@ export const setupCompanionServer = () => { }); req.on('close', function () { try { + if (rawProblem == '') { + return; + } const problem: Problem = JSON.parse(rawProblem); handleNewProblem(problem); COMPANION_LOGGING && console.log('Companion server closed connection.'); } catch (e) { vscode.window.showErrorMessage( - `Error parsing problem from companion "${e}"`, + `Error parsing problem from companion "${e}. Raw problem: '${rawProblem}'"`, ); } }); diff --git a/src/config.ts b/src/config.ts index b556310..1e43c32 100644 --- a/src/config.ts +++ b/src/config.ts @@ -4,7 +4,7 @@ */ export default { - telemetryKey: 'e57deb32-2bd3-4c02-89a5-d1f1ed0bc0d6', + telemetryKey: '560c1323-27e1-446c-98c0-f8424c435ab3', port: 27121, // companion listener server timeout: 10000, // for a testcase run extensions: { diff --git a/src/extension.ts b/src/extension.ts index aa8fbb4..cc69472 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -67,8 +67,6 @@ const registerCommands = (context: vscode.ExtensionContext) => { context.subscriptions.push(disposable4); globalThis.reporter = new TelemetryReporter(config.telemetryKey); context.subscriptions.push(globalThis.reporter); - - globalThis.reporter.sendTelemetryEvent(telmetry.EXTENSION_ACTIVATED); }; // This method is called when the extension is activated diff --git a/src/telmetry.ts b/src/telmetry.ts index 8a35e1a..0082365 100644 --- a/src/telmetry.ts +++ b/src/telmetry.ts @@ -1,5 +1,4 @@ export default { - EXTENSION_ACTIVATED: 'extension-activated', RUN_TESTCASE: 'run-testcase', RUN_ALL_TESTCASES: 'run-all-testcases', SUBMIT_TO_CODEFORCES: 'submit-to-codeforces', @@ -8,5 +7,4 @@ export default { NEW_LOCAL_PROBLEM: 'new-local-problem', KILL_RUNNING: 'kill-running', DELETE_ALL_TESTCASES: 'delete-all-testcases', - USE_EXTENSION: 'use-extension', }; diff --git a/src/webview/JudgeView.ts b/src/webview/JudgeView.ts index 602c66e..e01db55 100644 --- a/src/webview/JudgeView.ts +++ b/src/webview/JudgeView.ts @@ -14,8 +14,6 @@ import { import { setOnlineJudgeEnv } from '../compiler'; import telmetry from '../telmetry'; -let initializedOnce = false; - class JudgeViewProvider implements vscode.WebviewViewProvider { public static readonly viewType = 'cph.judgeView'; @@ -109,11 +107,6 @@ class JudgeViewProvider implements vscode.WebviewViewProvider { } private getInitialProblem() { - if (!initializedOnce) { - globalThis.reporter.sendTelemetryEvent(telmetry.USE_EXTENSION); - } - - initializedOnce = true; const doc = vscode.window.activeTextEditor?.document; this.extensionToJudgeViewMessage({ command: 'new-problem', diff --git a/src/webview/processRunAll.ts b/src/webview/processRunAll.ts index f17523a..cc1311c 100644 --- a/src/webview/processRunAll.ts +++ b/src/webview/processRunAll.ts @@ -21,7 +21,7 @@ export default async (problem: Problem) => { id: testCase.id, problem: problem, }); - await runSingleAndSave(problem, testCase.id, true); + await runSingleAndSave(problem, testCase.id, true, true); } console.log('Run all finished'); deleteBinary( diff --git a/src/webview/processRunSingle.ts b/src/webview/processRunSingle.ts index 48c1602..d131641 100644 --- a/src/webview/processRunSingle.ts +++ b/src/webview/processRunSingle.ts @@ -13,8 +13,11 @@ export const runSingleAndSave = async ( problem: Problem, id: number, skipCompile = false, + skipTelemetry = false, ) => { - globalThis.reporter.sendTelemetryEvent(telmetry.RUN_TESTCASE); + if (!skipTelemetry) { + globalThis.reporter.sendTelemetryEvent(telmetry.RUN_TESTCASE); + } console.log('Run and save started', problem, id); const srcPath = problem.srcPath; const language = getLanguage(srcPath);