Skeleton for client

This commit is contained in:
2026-02-08 02:55:30 +01:00
parent c4a28fef37
commit 88ed1d6f1f
2 changed files with 32 additions and 11 deletions
+13
View File
@@ -0,0 +1,13 @@
export interface LiveRunMove {
latency: number;
cursor: number;
changes?: {
from: number;
to: number;
insert: string;
};
}
export async function submitRun() {}
export async function addRunMoves() {}
+19 -11
View File
@@ -1,6 +1,10 @@
import * as vscode from "vscode";
export var currentRun: NodeJS.Timeout | null = null;
export var currentRun: {
interval: NodeJS.Timeout;
problemId: string;
start: Date;
} | null = null;
export async function startRun(
statusBarItem: vscode.StatusBarItem,
@@ -34,22 +38,26 @@ export async function startRun(
let start = Date.now();
currentRun = setInterval(() => {
const elapsed = Date.now() - start;
currentRun = {
problemId,
start: new Date(),
interval: setInterval(() => {
const elapsed = Date.now() - start;
const minutes = Math.floor(elapsed / 60000);
const seconds = Math.floor((elapsed % 60000) / 1000);
const hundredths = Math.floor((elapsed % 1000) / 10);
const minutes = Math.floor(elapsed / 60000);
const seconds = Math.floor((elapsed % 60000) / 1000);
const hundredths = Math.floor((elapsed % 1000) / 10);
statusBarItem.text = `$(clock) ${minutes}:${seconds.toString().padStart(2, "0")}.${hundredths
.toString()
.padStart(2, "0")}`;
}, 50);
statusBarItem.text = `$(clock) ${minutes}:${seconds.toString().padStart(2, "0")}.${hundredths
.toString()
.padStart(2, "0")}`;
}, 50),
};
}
export async function stopRun() {
if (currentRun) {
clearTimeout(currentRun);
clearTimeout(currentRun.interval);
currentRun = null;
}
}