🔮 A magical Visual Studio Code extension for Bitcoin Script 🪄
This VSCode extension is intended to be used in Rust projects that use the script!
macro (from rust-bitcoin-script).
The first line after the script!
invocation must be in one of these formats:
[X, Y]
(just the main stack)[X, Y], [Z]
(the main stack and the alt-stack)
use bitcoin_script::{define_pushable, script};
define_pushable!();
fn retrieve_hashed_leaf_item() -> ScriptBuf {
script! {
// [1, 2], [3] <-- Add this comment
OP_DUP // you should now see [1, 2, 2], [3] here
OP_2 // and [1, 2, 2, 2], [3] here
OP_ADD // etc...
OP_DEPTH
OP_GREATERTHAN
OP_IF
OP_FROMALTSTACK
OP_SWAP
OP_ENDIF
}
}
You can install this extension in several ways:
-
VS Code Marketplace
- Open VS Code
- Click on the Extensions icon in the Activity Bar
- Search for "Rust Bitcoin Lib Script! Hints"
- Click Install
-
Quick Open
- Press
Ctrl+P
/Cmd+P
- Paste
ext install portlandhodl.bitcoin-script-hints
- Press Enter
- Press
-
Manual Installation
- Download the
.vsix
file from the latest release - Open VS Code
- Press
Ctrl+Shift+P
/Cmd+Shift+P
- Type "Install from VSIX"
- Select the downloaded file
- Download the
If you want to test or develop the extension locally:
-
Clone and Setup
git clone https://github.com/russeree/bitcoin-script-hints-vscode.git cd bitcoin-script-hints-vscode npm install
-
Build the Extension
npm run package
-
Test in VSCode
- Press
F5
to open a new VSCode window with the extension loaded - Open a Rust file containing
script!
macros - The extension will automatically activate and show stack hints
- Press
-
Development Tips
- Use
npm run watch
during development for automatic rebuilds - After making changes, reload the VSCode window (
Ctrl+R
orCmd+R
) - Check the "Output" panel (View -> Output) and select "Bitcoin Script Hints" for logs
- Use
- Visual Studio Code >= 1.80.0
- A Rust project using the
script!
macro
- Real-time stack visualization for Bitcoin Script operations
- Inline hints showing stack state after each operation
- Support for both main stack and alt-stack visualization
- Automatic updates as you type
This extension is a port of the bitcoin-script-hints.nvim plugin. Special thanks to the original plugin creators and the Script Wiz IDE team, which inspired both projects with their excellent stack visualization capabilities.