command hygiene

This commit is contained in:
2026-02-08 12:21:15 +01:00
parent acbcc57402
commit a4b07f4fd2
3 changed files with 37 additions and 1 deletions
+21 -1
View File
@@ -31,7 +31,27 @@
"command": "devrun-vscode.stopServer", "command": "devrun-vscode.stopServer",
"title": "DevRun: Stop the run server (for quick run starts)" "title": "DevRun: Stop the run server (for quick run starts)"
} }
] ],
"menus": {
"commandPalette": [
{
"command": "devrun-vscode.startRun",
"when": "!devrun.runActive"
},
{
"command": "devrun-vscode.stopRun",
"when": "devrun.runActive"
},
{
"command": "devrun-vscode.startServer",
"when": "!devrun.serverActive"
},
{
"command": "devrun-vscode.stopServer",
"when": "devrun.serverActive"
}
]
}
}, },
"scripts": { "scripts": {
"vscode:prepublish": "npm run compile", "vscode:prepublish": "npm run compile",
+4
View File
@@ -53,6 +53,8 @@ export async function startRun(
.padStart(2, "0")}`; .padStart(2, "0")}`;
}, 50), }, 50),
}; };
await vscode.commands.executeCommand("setContext", "devrun.runActive", true);
} }
export async function stopRun() { export async function stopRun() {
@@ -60,4 +62,6 @@ export async function stopRun() {
clearTimeout(currentRun.interval); clearTimeout(currentRun.interval);
currentRun = null; currentRun = null;
} }
await vscode.commands.executeCommand("setContext", "devrun.runActive", false);
} }
+12
View File
@@ -52,6 +52,12 @@ export async function startServer(statusBarItem: vscode.StatusBarItem) {
server = app.listen(63780, "127.0.0.1", () => { server = app.listen(63780, "127.0.0.1", () => {
setTimeout(() => (statusBarItem.text = "$(clock) No active run"), 500); setTimeout(() => (statusBarItem.text = "$(clock) No active run"), 500);
}); });
await vscode.commands.executeCommand(
"setContext",
"devrun.serverActive",
true,
);
} }
export async function stopServer(statusBarItem: vscode.StatusBarItem) { export async function stopServer(statusBarItem: vscode.StatusBarItem) {
@@ -67,4 +73,10 @@ export async function stopServer(statusBarItem: vscode.StatusBarItem) {
server = undefined; server = undefined;
setTimeout(() => (statusBarItem.text = "$(clock) No active run"), 500); setTimeout(() => (statusBarItem.text = "$(clock) No active run"), 500);
await vscode.commands.executeCommand(
"setContext",
"devrun.serverActive",
false,
);
} }