Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [20, 22, 24]
node-version: [22, 24]
runs-on: ${{ matrix.os }}
permissions:
contents: read
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
targets: wasm32-unknown-unknown,wasm32-wasip2

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ typings/
# Typescript Output
dist/

# Rust build artifacts
samples/target/

# VSCode extension development
.vscode-test/
*.vsix
Expand All @@ -80,3 +83,6 @@ dist/
types/
out/
tmp/

# Test coverage
coverage/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dist/
*.vsix
wit-bindgen-wasm/pkg/
wit-bindgen-wasm/target/
samples/target/

# Test snapshots (these are auto-generated and shouldn't be manually formatted)
*.snap
Expand Down
13 changes: 12 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"name": "default",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
Expand All @@ -15,6 +15,17 @@
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceRoot}/tests/grammar"
]
},
{
"name": "samples",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}",
"${workspaceRoot}/samples"
]
}
]
}
56 changes: 39 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ _A comprehensive Visual Studio Code extension for WebAssembly Interface Type (WI
- 🎨 Full syntax highlighting and code completion
- ✅ Real-time syntax validation with detailed error diagnostics
- 🔧 Automatic code formatting
- 🌐 Generate bindings for Rust, C, C++, C#, Go, MoonBit, and Markdown
- 🌐 Generate guest bindings for Rust, C, C++, C#, Go, MoonBit, and JavaScript
- 🧱 Generate JavaScript host bindings from WIT or `.wasm` components
- 📚 Generate Markdown documentation from WIT definitions
- 🧩 WebAssembly component detection and WIT extraction
- 📝 Context menu integration for quick access to tools

Expand Down Expand Up @@ -50,19 +52,27 @@ Format WIT files with a single command:

Generate language bindings directly from WIT files or WebAssembly components:

#### Supported Languages
#### Guest Bindings
- **Rust**: Generate idiomatic Rust bindings with `wit-bindgen`
- **C**: Generate C bindings for C projects
- **C++**: Generate C++ bindings
- **C#**: Generate C# bindings for .NET projects
- **Go**: Generate Go bindings
- **MoonBit**: Generate MoonBit bindings
- **JavaScript**: Generate JavaScript/TypeScript guest-side bindings

#### Host Bindings
- **JavaScript**: Generate host-side JavaScript output
- For `.wit` files, generates host-oriented TypeScript declarations
- For `.wasm` components, transpiles to runnable JavaScript host modules

#### Documentation Output
- **Markdown**: Generate documentation in Markdown format

#### Binding Generation Features
- **Context Menu Integration**: Right-click on `.wit` or `.wasm` files to generate bindings
- **Multiple Targets**: Generate bindings for multiple languages at once
- **Output to Folder**: Automatically creates language-specific output directories
- **Context Menu Integration**: Right-click on `.wit` or `.wasm` files to generate outputs
- **Structured Menus**: Separate submenus for guest bindings, host bindings, and documentation
- **Output to Folder**: Preserves generated relative folder layout safely
- **Progress Feedback**: Visual feedback during generation process

### WebAssembly Component Support
Expand All @@ -88,12 +98,16 @@ Right-click on files in the editor or Explorer for quick access to:
**For `.wit` files:**
- Check WIT Syntax
- Format Document
- Generate Bindings (with language submenu)
- Generate Guest Bindings (submenu)
- Generate Host Bindings (submenu)
- Generate Documentation (submenu)

**For `.wasm` component files:**
- Extract WIT
- Extract Core Wasm
- Generate Bindings (with language submenu)
- Generate Guest Bindings (submenu)
- Generate Host Bindings (submenu)
- Generate Documentation (submenu)

## Available Commands

Expand All @@ -115,31 +129,36 @@ Access these commands via the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`):
- Applies consistent styling and indentation

### Binding Generation Commands
- **WIT: Generate Language Bindings**
- Opens a language selection menu
- Available for `.wit` files and WebAssembly components

- **WIT: Generate Rust Bindings**
- Generates Rust bindings using `wit-bindgen`
- Generates Rust guest bindings using `wit-bindgen`

- **WIT: Generate C Bindings**
- Generates C bindings for C projects
- Generates C guest bindings for C projects

- **WIT: Generate C++ Bindings**
- Generates C++ bindings
- Generates C++ guest bindings

- **WIT: Generate C# Bindings**
- Generates C# bindings for .NET projects
- Generates C# guest bindings for .NET projects

- **WIT: Generate Go Bindings**
- Generates Go bindings
- Generates Go guest bindings

- **WIT: Generate MoonBit Bindings**
- Generates MoonBit bindings
- Generates MoonBit guest bindings

- **WIT: Generate JavaScript Bindings (Guest)**
- Generates JavaScript/TypeScript guest bindings from `.wit` or extracted component WIT

- **WIT: Generate JavaScript Bindings (Host)**
- Generates host-side JavaScript output
- Uses host type generation for `.wit`, and component transpilation for `.wasm`

- **WIT: Generate Markdown Documentation**
- Generates Markdown documentation from WIT definitions

> Note: legacy command IDs for `wit-idl.generateBindings*` are still supported as deprecated aliases for backward compatibility.

### WebAssembly Component Commands
- **WIT: Extract WIT**
- Extracts WIT definitions from a WebAssembly component file
Expand Down Expand Up @@ -248,6 +267,9 @@ npm test
# Run unit tests only
npm run test-unit

# Run unit tests with coverage report
npm run test-unit-coverage

# Run tests in watch mode
npm run test-unit-watch
```
Expand Down
Binary file modified images/component-view-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/editor-menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading