Skip to content

Commit 22791b2

Browse files
committed
chore: enhance README with comprehensive WIT extension features and update images
Signed-off-by: Gordon Smith <GordonJSmith@gmail.com>
1 parent 64f9830 commit 22791b2

File tree

6 files changed

+179
-50
lines changed

6 files changed

+179
-50
lines changed

README.md

Lines changed: 179 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,202 @@
11
# WIT IDL for VSCode
22

3-
This package is a Visual Studio Code extension to recognize and highlight the WebAssembly Interface Type (WIT) Interface Definition Language (IDL). It can also be used as a bundle in TextMate.
3+
![Editor with WIT menu](images/editor-menu.png)
44

5-
The description of the WIT format can be found at: https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md
5+
_A comprehensive Visual Studio Code extension for WebAssembly Interface Type (WIT) development. This extension provides **syntax highlighting**, **validation**, **formatting**, **language bindings generation**, and **WebAssembly component tooling** for the WIT Interface Definition Language (IDL). Also compatible as a TextMate bundle._
66

7+
**Key Features:**
8+
- 🎨 Full syntax highlighting and code completion
9+
- ✅ Real-time syntax validation with detailed error diagnostics
10+
- 🔧 Automatic code formatting
11+
- 🌐 Generate bindings for Rust, C, C++, C#, Go, MoonBit, and Markdown
12+
- 🧩 WebAssembly component detection and WIT extraction
13+
- 📝 Context menu integration for quick access to tools
714

8-
## Features
15+
The description of the WIT format can be found at: https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md
916

10-
![Screenshot](images/screenshot.png)
17+
## Features
1118

12-
This extension provides:
13-
- Basic syntax highlighting of ".wit" files.
14-
- [Snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets) for worlds and interfaces.
15-
- Basic markdown highlighting in comments.
16-
- Simple list-based autocomplete.
17-
- **WIT Syntax Checking**: Validate WIT files for common syntax errors and provide diagnostics.
19+
This extension provides comprehensive support for WebAssembly Interface Type (WIT) files and WebAssembly components:
1820

19-
### Syntax Validation and Error Display
21+
### Language Support
22+
- **Syntax Highlighting**: Full TextMate grammar for WIT files with proper scoping
23+
- **Code Snippets**: Pre-built snippets for worlds, interfaces, and common patterns
24+
- **Markdown in Comments**: Syntax highlighting for markdown within WIT comments
25+
- **Code Completion**: Context-aware autocomplete for WIT keywords and constructs
2026

21-
The extension provides comprehensive WIT syntax validation with error display in VS Code's PROBLEMS pane:
27+
### Validation and Diagnostics
2228

2329
#### Automatic Validation
2430
- **On File Save**: Automatically validates WIT files when saved
2531
- **On File Open**: Validates WIT files when opened in the editor
26-
- **Real-time Feedback**: Errors appear immediately in the PROBLEMS pane
32+
- **Real-time Feedback**: Errors appear immediately in VS Code's PROBLEMS pane
33+
- **Workspace Validation**: Validate all WIT files across your entire workspace
2734

28-
#### Manual Commands
29-
- **WIT: Check Syntax** (`Ctrl+Shift+P` → "WIT: Check Syntax")
30-
- Validates the currently active WIT file
31-
- Shows detailed error information in notifications
32-
- Displays errors in the PROBLEMS pane
35+
#### Error Display
36+
- **Precise Location**: Errors show exact line and column numbers
37+
- **Detailed Messages**: Clear descriptions of syntax errors with context
38+
- **Quick Navigation**: Click any error in PROBLEMS pane to jump to the issue
39+
- **Multi-file Support**: Track errors across multiple files simultaneously
40+
41+
### Document Formatting
42+
43+
Format WIT files with a single command:
44+
- **Auto-formatting**: Format on save or on demand
45+
- **Consistent Style**: Ensures uniform code style across your project
46+
- **Default Formatter**: Automatically set as the default formatter for `.wit` files
47+
- **Keyboard Shortcut**: `Shift+Alt+F` to format the active document
48+
49+
### Binding Generation
50+
51+
Generate language bindings directly from WIT files or WebAssembly components:
52+
53+
#### Supported Languages
54+
- **Rust**: Generate idiomatic Rust bindings with `wit-bindgen`
55+
- **C**: Generate C bindings for C projects
56+
- **C++**: Generate C++ bindings
57+
- **C#**: Generate C# bindings for .NET projects
58+
- **Go**: Generate Go bindings
59+
- **MoonBit**: Generate MoonBit bindings
60+
- **Markdown**: Generate documentation in Markdown format
61+
62+
#### Binding Generation Features
63+
- **Context Menu Integration**: Right-click on `.wit` or `.wasm` files to generate bindings
64+
- **Multiple Targets**: Generate bindings for multiple languages at once
65+
- **Output to Folder**: Automatically creates language-specific output directories
66+
- **Progress Feedback**: Visual feedback during generation process
67+
68+
### WebAssembly Component Support
69+
70+
![Editor with WIT menu](images/component-view-menu.png)
3371

34-
- **WIT: Check Syntax in Workspace** (`Ctrl+Shift+P` → "WIT: Check Syntax in Workspace")
35-
- Validates all WIT files in the workspace
36-
- Shows progress notification during validation
37-
- Provides summary of results
38-
- Creates detailed report in output channel
3972

40-
#### Error Information
41-
When validation fails, the extension displays:
42-
- **Error location**: Precise line and column numbers
43-
- **Error message**: Detailed description of the syntax error
44-
- **Context**: Additional information about the error
45-
- **Related information**: Links to relevant documentation or context
73+
#### Component Detection
74+
- **Visual Indicators**: WebAssembly component files (`.wasm`) are decorated with a 🧩 emoji in the Explorer
75+
- **Component Colors**: Customizable color scheme for component files in the file explorer
76+
- **Automatic Detection**: Distinguishes between core WebAssembly modules and components
4677

47-
#### PROBLEMS Pane Integration
48-
- Errors appear automatically in VS Code's PROBLEMS pane
49-
- Click on any error to jump directly to the problematic line
50-
- Errors are cleared automatically when files are fixed or closed
51-
- Supports multiple files with errors simultaneously
78+
#### Component Operations
79+
- **Extract WIT**: Extract WIT definitions from compiled WebAssembly components
80+
- **Extract Core Wasm**: Extract the core WebAssembly module from a component
81+
- **Custom Editor**: View WIT interfaces directly from `.wasm` component files
82+
- **Real-time Updates**: WIT view updates automatically when the component file changes
5283

53-
### Code Completion
84+
### Context Menu Integration
5485

55-
The extension offers intelligent code completion for WIT files:
86+
Right-click on files in the editor or Explorer for quick access to:
5687

57-
- **Context-aware suggestions**: Provides completion items based on the current context
58-
- **Keyword snippets**: Includes common WIT keywords and constructs
59-
- **Custom snippets**: User-defined snippets for faster coding
88+
**For `.wit` files:**
89+
- Check WIT Syntax
90+
- Format Document
91+
- Generate Bindings (with language submenu)
6092

61-
### Command Palette Integration
93+
**For `.wasm` component files:**
94+
- Extract WIT
95+
- Extract Core Wasm
96+
- Generate Bindings (with language submenu)
6297

63-
Easily access extension features through the Command Palette:
98+
## Available Commands
6499

65-
- **WIT: Check Syntax**: Validate the current file's syntax
66-
- **WIT: Check Syntax in Workspace**: Validate all WIT files in the workspace
67-
- **WIT: Show Output Channel**: Display the extension's output channel
100+
Access these commands via the Command Palette (`Ctrl+Shift+P` or `Cmd+Shift+P`):
101+
102+
### Validation Commands
103+
- **WIT: Check WIT Syntax** (`F7` when in a WIT file)
104+
- Validates the currently active WIT file
105+
- Shows errors in the PROBLEMS pane and notifications
106+
107+
- **WIT: Check WIT Syntax in Workspace** (`Shift+F7`)
108+
- Validates all WIT files in the workspace
109+
- Shows progress notification during validation
110+
- Provides summary of results in output channel
111+
112+
### Formatting Commands
113+
- **WIT: Format Document** (`Shift+Alt+F` when in a WIT file)
114+
- Formats the current WIT file
115+
- Applies consistent styling and indentation
116+
117+
### Binding Generation Commands
118+
- **WIT: Generate Language Bindings**
119+
- Opens a language selection menu
120+
- Available for `.wit` files and WebAssembly components
121+
122+
- **WIT: Generate Rust Bindings**
123+
- Generates Rust bindings using `wit-bindgen`
124+
125+
- **WIT: Generate C Bindings**
126+
- Generates C bindings for C projects
127+
128+
- **WIT: Generate C++ Bindings**
129+
- Generates C++ bindings
130+
131+
- **WIT: Generate C# Bindings**
132+
- Generates C# bindings for .NET projects
133+
134+
- **WIT: Generate Go Bindings**
135+
- Generates Go bindings
136+
137+
- **WIT: Generate MoonBit Bindings**
138+
- Generates MoonBit bindings
139+
140+
- **WIT: Generate Markdown Documentation**
141+
- Generates Markdown documentation from WIT definitions
142+
143+
### WebAssembly Component Commands
144+
- **WIT: Extract WIT**
145+
- Extracts WIT definitions from a WebAssembly component file
146+
- Available only for component-type `.wasm` files
147+
148+
- **WIT: Extract Core Wasm**
149+
- Extracts the core WebAssembly module from a component
150+
- Available only for component-type `.wasm` files
151+
152+
### Utility Commands
153+
- **WIT: Show WIT Bindgen Version**
154+
- Displays the version of wit-bindgen used by the extension
155+
156+
## Keyboard Shortcuts
157+
158+
| Command | Shortcut | When |
159+
|---------|----------|------|
160+
| Check WIT Syntax | `F7` | Editing a `.wit` file |
161+
| Check WIT Syntax in Workspace | `Shift+F7` | Anytime |
162+
| Format Document | `Shift+Alt+F` | Editing a `.wit` file |
163+
164+
## Extension Settings
165+
166+
This extension contributes the following settings:
167+
168+
### Default Formatter
169+
The extension automatically configures itself as the default formatter for WIT files. This is equivalent to:
170+
171+
```json
172+
{
173+
"[wit]": {
174+
"editor.defaultFormatter": "bytecodealliance.wit-idl"
175+
}
176+
}
177+
```
178+
179+
You can override this in your user or workspace settings if needed.
180+
181+
### Component File Decoration Color
182+
Customize the color used to decorate WebAssembly component files in the Explorer:
183+
184+
- **Color ID**: `witIdl.componentColor`
185+
- **Description**: Color used to decorate WebAssembly component files (.wasm) in the explorer
186+
- **Defaults**:
187+
- Light theme: `#5043b3`
188+
- Dark theme: `#7c5eff`
189+
- High contrast: `#b15eff`
190+
191+
To customize, add to your settings:
192+
193+
```json
194+
{
195+
"workbench.colorCustomizations": {
196+
"witIdl.componentColor": "#your-color-here"
197+
}
198+
}
199+
```
68200

69201
## Installation
70202

@@ -80,7 +212,9 @@ This extension is available on:
80212
- Install from Open VSX: https://open-vsx.org/extension/bytecodealliance/wit-idl
81213
- Or install via CLI: `ovsx get bytecodealliance.wit-idl`
82214

83-
### Prerequisites
215+
### From Source
216+
217+
#### Prerequisites
84218

85219
This extension includes a WebAssembly component that requires the following tools for building:
86220

@@ -96,7 +230,6 @@ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
96230
npm run setup-wasm
97231
```
98232

99-
### From Source
100233

101234
To install from source, follow these steps:
102235
* Clone the repository: `git clone https://github.com/bytecodealliance/vscode-wit.git && cd vscode-wit`
@@ -112,7 +245,3 @@ This extension is automatically published to both Visual Studio Marketplace and
112245
- `PAT_VSCE`: Personal Access Token for Visual Studio Marketplace
113246
- `OVSX_PAT`: Personal Access Token for Open VSX Registry
114247

115-
To obtain an Open VSX token:
116-
1. Create an account at https://open-vsx.org/
117-
2. Generate a Personal Access Token from your account settings
118-
3. Add the token as `OVSX_PAT` in the repository secrets

images/component-view-menu.png

105 KB
Loading

images/component-view.png

101 KB
Loading

images/editor-menu.png

75.4 KB
Loading

images/editor.png

42.2 KB
Loading

images/screenshot.png

-118 KB
Binary file not shown.

0 commit comments

Comments
 (0)