diff --git a/.vscodeignore b/.vscodeignore new file mode 100644 index 0000000..aecfb4c --- /dev/null +++ b/.vscodeignore @@ -0,0 +1,2 @@ +node_modules/** +*.vsix diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..5a0720f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Void contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 6a650d1..9ae8c01 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,29 @@ # VbsVsCode -VS Code extension assets for VoidBuildSystem, generated by `vbs ide plugin`. \ No newline at end of file +VS Code extension for VoidBuildSystem (VBS). + +The assets in this repository are generated by: + +```sh +vbs ide plugin --editor vscode --output ./ --force +``` + +## Commands + +- `VBS: Build` - `vbs build` +- `VBS: Test` - `vbs test` +- `VBS: Install` - `vbs install --prefix build/install` +- `VBS: Package (installer)` - stages the prefix and writes `build/install/installer.sh` +- `VBS: Start Daemon` - `vbs daemon run` +- `VBS: Daemon Status` - `vbs daemon status` + +Commands run in a terminal rooted at the VS Code workspace folder (passed as +`--project`). Set `VBS_BIN` if `vbs` is not on `PATH`. + +## Packaging + +```sh +npm install -g @vscode/vsce +vsce package +code --install-extension vbs-tools-0.1.0.vsix +``` diff --git a/extension.js b/extension.js new file mode 100644 index 0000000..399570e --- /dev/null +++ b/extension.js @@ -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 }; diff --git a/package.json b/package.json new file mode 100644 index 0000000..e869e33 --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "vbs-tools", + "displayName": "VoidBuildSystem", + "description": "Build, test, install and package with VoidBuildSystem.", + "version": "0.1.0", + "publisher": "void", + "license": "MIT", + "engines": {"vscode": "^1.80.0"}, + "categories": ["Other"], + "activationEvents": [], + "main": "./extension.js", + "contributes": { + "commands": [{"command":"vbs.build","title":"VBS: Build"},{"command":"vbs.test","title":"VBS: Test"},{"command":"vbs.install","title":"VBS: Install"},{"command":"vbs.package","title":"VBS: Package (installer)"},{"command":"vbs.daemonStart","title":"VBS: Start Daemon"},{"command":"vbs.daemonStatus","title":"VBS: Daemon Status"}] + } +}