A Visual Studio Code extension that provides syntax highlighting, code completions, compiler diagnostics, and run support for the Wrench embedded scripting language.
- Syntax Highlighting — keywords, operators, strings, numbers, comments,
and namespaced library calls (
math::sin,str::strlen, etc.) - Code Snippets — common patterns like
fn,for,while,if,struct,enum,switch, and more - Auto-Completions — context-aware completions for all 14 standard library
namespaces (
math::,str::,io::,std::,sys::,msg::,debug::,array::,hash::,list::,queue::,stack::) with documentation - Compiler Diagnostics — errors shown as red squiggles on save, powered by the wrench compiler
- Run File — compile and execute
.wrfiles directly from the editor - Language Configuration — auto-closing brackets, comment toggling, code folding, and proper indentation
- File Association —
.wrand.wrenchfile extensions
There are three ways to run the current file:
- Ctrl+F5 keyboard shortcut (when editing a
.wrfile) - Play button in the editor title bar
- Command Palette — "Wrench: Run File"
Output appears in a dedicated "Wrench" terminal. The file is saved automatically before each run.
When you save a .wr file, the extension runs the wrench compiler and shows any
errors inline. This requires the wrench CLI to be available.
Configure the compiler path in settings if it's not on your PATH:
{
"wrench.compilerPath": "/path/to/wrench"
}| Prefix | Description |
|---|---|
fn/function |
Function declaration |
main |
Main function scaffold |
for |
For loop with counter |
while |
While loop |
do |
Do-while loop |
if |
If statement |
ife |
If-else statement |
switch |
Switch-case-default |
struct |
Struct declaration |
enum |
Enum declaration |
var |
Variable declaration |
print |
|
println |
Print with newline |
- Control flow:
if,else,while,do,for,switch,case,default,break,continue,return,yield,goto - Declarations:
var,function,struct,new,export,enum,unit - Types:
int,float - Constants:
true,false,null
- 32-bit integers and floats
- Strings (double-quoted with escape sequences)
- Arrays and hash tables
- Structs and enums (anonymous:
enum { RED, GREEN, BLUE })
- Single-line:
// - Multi-line:
/* */ - Folding regions:
//#region///#endregion
- Arithmetic:
+,-,*,/,%,++,-- - Comparison:
==,!=,>=,<=,>,< - Logical:
||,&&,! - Bitwise:
|,&,^,>>,<<,~ - Assignment:
=,+=,-=,*=,/=,%=,|=,&=,^=,>>=,<<= - Namespace:
::
| Setting | Default | Description |
|---|---|---|
wrench.compilerPath |
"wrench" |
Path to the wrench compiler executable |
Download the latest .vsix from the
Releases page and install it:
code --install-extension wrench-language-support-X.Y.Z.vsix- Clone this repository
- Install the VSCode Extension Manager:
npm install -g @vscode/vsce - Package the extension:
vsce package --no-dependencies - Install the generated
.vsixfile:code --install-extension wrench-language-support-*.vsix
Copy this folder to your VSCode extensions directory:
- Windows:
%USERPROFILE%\.vscode\extensions - macOS:
~/.vscode/extensions - Linux:
~/.vscode/extensions
Wrench is a compact, embedded scripting language designed for microcontrollers and embedded systems. It features:
- C-like syntax with weak typing
- Small footprint (~32k ROM, ~1k RAM)
- Native support for 32-bit integers, floats, and strings
- Cooperative multi-threading and yielding
- Easy integration with native code
For more information:
If you find any issues or want to contribute improvements, please submit issues or pull requests.
MIT