Run server
This commit is contained in:
+27
-6
@@ -2,15 +2,29 @@ import * as vscode from "vscode";
|
||||
|
||||
export var currentRun: NodeJS.Timeout | null = null;
|
||||
|
||||
export async function stopRun() {
|
||||
|
||||
if (currentRun) clearTimeout(currentRun);
|
||||
}
|
||||
|
||||
export async function startRun(
|
||||
statusBarItem: vscode.StatusBarItem,
|
||||
problemId: string,
|
||||
problemId?: string,
|
||||
) {
|
||||
if (currentRun) {
|
||||
vscode.window.showErrorMessage("You are already in a run");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!problemId) {
|
||||
problemId = await vscode.window.showInputBox({
|
||||
prompt: "Enter a valid problem ID",
|
||||
placeHolder: "my-problem",
|
||||
validateInput: (text) => {
|
||||
return text.match(/^[a-zA-Z0-9-]+$/)
|
||||
? null
|
||||
: "Must only contain '-' and alphanumeric characters";
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (!problemId) return;
|
||||
|
||||
const mode = await vscode.window.showQuickPick(["any%", "100%"], {
|
||||
placeHolder: "Select a mode",
|
||||
canPickMany: false,
|
||||
@@ -30,3 +44,10 @@ export async function startRun(
|
||||
.padStart(2, "0")}`;
|
||||
}, 50);
|
||||
}
|
||||
|
||||
export async function stopRun() {
|
||||
if (currentRun) {
|
||||
clearTimeout(currentRun);
|
||||
currentRun = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user