command hygiene
This commit is contained in:
@@ -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",
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user