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() {}
+12 -4
View File
@@ -1,6 +1,10 @@
import * as vscode from "vscode"; 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( export async function startRun(
statusBarItem: vscode.StatusBarItem, statusBarItem: vscode.StatusBarItem,
@@ -34,7 +38,10 @@ export async function startRun(
let start = Date.now(); let start = Date.now();
currentRun = setInterval(() => { currentRun = {
problemId,
start: new Date(),
interval: setInterval(() => {
const elapsed = Date.now() - start; const elapsed = Date.now() - start;
const minutes = Math.floor(elapsed / 60000); const minutes = Math.floor(elapsed / 60000);
@@ -44,12 +51,13 @@ export async function startRun(
statusBarItem.text = `$(clock) ${minutes}:${seconds.toString().padStart(2, "0")}.${hundredths statusBarItem.text = `$(clock) ${minutes}:${seconds.toString().padStart(2, "0")}.${hundredths
.toString() .toString()
.padStart(2, "0")}`; .padStart(2, "0")}`;
}, 50); }, 50),
};
} }
export async function stopRun() { export async function stopRun() {
if (currentRun) { if (currentRun) {
clearTimeout(currentRun); clearTimeout(currentRun.interval);
currentRun = null; currentRun = null;
} }
} }