command hygiene
This commit is contained in:
+21
-1
@@ -31,7 +31,27 @@
|
||||
"command": "devrun-vscode.stopServer",
|
||||
"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": {
|
||||
"vscode:prepublish": "npm run compile",
|
||||
|
||||
@@ -53,6 +53,8 @@ export async function startRun(
|
||||
.padStart(2, "0")}`;
|
||||
}, 50),
|
||||
};
|
||||
|
||||
await vscode.commands.executeCommand("setContext", "devrun.runActive", true);
|
||||
}
|
||||
|
||||
export async function stopRun() {
|
||||
@@ -60,4 +62,6 @@ export async function stopRun() {
|
||||
clearTimeout(currentRun.interval);
|
||||
currentRun = null;
|
||||
}
|
||||
|
||||
await vscode.commands.executeCommand("setContext", "devrun.runActive", false);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,12 @@ export async function startServer(statusBarItem: vscode.StatusBarItem) {
|
||||
server = app.listen(63780, "127.0.0.1", () => {
|
||||
setTimeout(() => (statusBarItem.text = "$(clock) No active run"), 500);
|
||||
});
|
||||
|
||||
await vscode.commands.executeCommand(
|
||||
"setContext",
|
||||
"devrun.serverActive",
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
export async function stopServer(statusBarItem: vscode.StatusBarItem) {
|
||||
@@ -67,4 +73,10 @@ export async function stopServer(statusBarItem: vscode.StatusBarItem) {
|
||||
|
||||
server = undefined;
|
||||
setTimeout(() => (statusBarItem.text = "$(clock) No active run"), 500);
|
||||
|
||||
await vscode.commands.executeCommand(
|
||||
"setContext",
|
||||
"devrun.serverActive",
|
||||
false,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user