Syntax highlighting and language support for the Hew programming language — a high-performance, network-native, actor-based language.
- Full syntax highlighting for Hew v0.6 constructs
- Language Server Protocol — completion, hover, definition, document symbols, semantic tokens, diagnostics (requires
hew-lsp) - Document formatting — format on save via
hew fmt(requireshewCLI) - Actor declarations —
actor,receive fn,receive,init - Supervisor trees —
supervisor,child,restart,budget,strategy - Structured concurrency —
scope,launch,cancel,spawn,await - Generators —
gen fn,async gen fn,yield,cooperate - Wire types —
wire type,wire enum, field tags with@ - Traits and generics —
trait,impl ... for, type parameters[T: Send] - Pattern matching —
match,=>, guards, destructuring - All built-in types —
i8–i64,u8–u64,f32,f64,bool,char,string - String variants — regular
"...", rawr"...", interpolatedf"...{expr}..." - Duration literals —
100ms,5s,1h - Comments —
//,/* */,///(doc comments) - Auto-closing pairs for brackets, braces, parentheses, strings
- Code folding and bracket matching
actor Counter {
var count: i32 = 0;
receive fn increment() {
self.count = self.count + 1;
}
receive fn get() -> i32 {
self.count
}
}
supervisor CounterSupervisor {
child counter: Counter
restart(permanent)
budget(5, 30s)
strategy(one_for_one);
}
fn fibonacci(n: i32) -> i32 {
if n <= 1 {
n
} else {
fibonacci(n - 1) + fibonacci(n - 2)
}
}
fn main() -> i32 {
let result = fibonacci(10);
println(result);
0
}
- In the extension directory, run:
npm run package
- In VS Code, open the command palette (
Ctrl+Shift+P) and run: Extensions: Install from VSIX... - Select the generated
.vsixfile
- Clone this repository
- Run
npm install && npm run build:dev - Open this folder in VS Code and press
F5to launch the Extension Development Host
| Setting | Default | Description |
|---|---|---|
hew.lsp.serverPath |
"" |
Path to hew-lsp binary. If empty, searches trusted workspace target/, PATH, and bundled binaries. |
hew.formatterPath |
"" |
Path to hew binary for formatting. If empty, searches trusted workspace target/, PATH, and bundled binaries. |
hew.debugger.hewPath |
"" |
Path to the hew compiler used for debug builds. If empty, uses the same trusted search as hew.formatterPath. |
hew.allowUntrustedWorkspaceBinaries |
false |
Allows auto-detecting workspace target/release and target/debug binaries even in Restricted Mode. Set this in user settings only when you explicitly trust those workspace binaries. |
Workspace-built hew and hew-lsp binaries are only auto-selected in trusted workspaces by default. In Restricted Mode, trust the workspace or set hew.allowUntrustedWorkspaceBinaries in user settings to opt in.
Before launching a Hew debug session:
- If
programpoints to a.hewsource file, make surehew.debugger.hewPathis set orhewis onPATHso the extension can runhew build --debug. - Make sure the selected backend executable is on
PATH:debuggerBackend: "auto"pickslldb-mion macOS andgdbelsewhere.debuggerBackend: "lldb"requireslldb-mi.debuggerBackend: "gdb"requiresgdb.
Example .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "hew",
"request": "launch",
"name": "Debug Hew Program",
"program": "${workspaceFolder}/main.hew",
"debuggerBackend": "auto"
}
]
}If preflight reports that a backend is unavailable, either install the required tool or switch debuggerBackend to a backend that is already installed on your system.
| Hew Construct | TextMate Scope |
|---|---|
fn, let, var, struct, enum, trait, impl, gen |
keyword.declaration |
if, else, match, loop, for, while, return, await, scope, launch, cancel |
keyword.control |
actor, receive, spawn, init, async, mailbox, overflow |
keyword.actor |
supervisor, child, restart, budget, strategy |
keyword.supervisor |
wire, reserved, optional, deprecated, default, list |
keyword.wire |
and, or |
keyword.operator.logical |
one_for_one, permanent, true, false, None |
constant.language |
i32, u64, f64, bool, string |
storage.type |
Result, Option, Send, Frozen, Actor, ActorRef |
storage.type |
| PascalCase identifiers | entity.name.type |
| Function names in definitions | entity.name.function |
| Function calls | entity.name.function.call |
self |
variable.language.self |
"string", r"raw", f"interpolated {x}" |
string.quoted |
42, 0xFF, 0b1010, 3.14, 100ms |
constant.numeric |
//, /* */, /// |
comment |
Licensed under the Apache License, Version 2.0. See LICENSE for details.