Add VS Code extension assets generated by vbs ide plugin
This commit is contained in:
1 parent
7b589d578c
commit
5d87ec5c93
5 files changed
+99
-1
No files matched your search
@@ -0,0 +1,34 @@
|
||||
// Generated by `vbs ide plugin`. Requires the `vbs` executable in PATH or VBS_BIN.
|
||||
const vscode = require('vscode');
|
||||
const vbs = process.env.VBS_BIN || "vbs";
|
||||
|
||||
function projectArgs() {
|
||||
const folders = vscode.workspace.workspaceFolders;
|
||||
return folders && folders.length ? ['--project', folders[0].uri.fsPath] : [];
|
||||
}
|
||||
|
||||
function runTerminal(name, args) {
|
||||
const terminal = vscode.window.createTerminal({ name });
|
||||
terminal.show(true);
|
||||
const full = [...args, ...projectArgs()];
|
||||
terminal.sendText([vbs, ...full].map((a) => (a.includes(' ') ? `'${a}'` : a)).join(' '));
|
||||
}
|
||||
|
||||
const commands = [
|
||||
["vbs.build", "VBS: Build", ["build"]],
|
||||
["vbs.test", "VBS: Test", ["test"]],
|
||||
["vbs.install", "VBS: Install", ["install","--prefix","build/install"]],
|
||||
["vbs.package", "VBS: Package (installer)", ["install","--prefix","build/install","--archive","build/install/installer.sh","--archive-format","sh"]],
|
||||
["vbs.daemonStart", "VBS: Start Daemon", ["daemon","run"]],
|
||||
["vbs.daemonStatus", "VBS: Daemon Status", ["daemon","status"]],
|
||||
];
|
||||
|
||||
function activate(context) {
|
||||
for (const [id, title, args] of commands) {
|
||||
context.subscriptions.push(vscode.commands.registerCommand(id, () => runTerminal(title, args)));
|
||||
}
|
||||
}
|
||||
|
||||
function deactivate() {}
|
||||
|
||||
module.exports = { activate, deactivate };
|
||||
Reference in new issue
Block a user