aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 4e77c148b68acce7c9540398c54cc983d5a8045f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Zig Extension for Nova — Development Guide

## Overview

This repository contains the Zig language extension for Nova. For user documentation, see [Zig.novaextension/README.md](Zig.novaextension/README.md).

## Development

### Parser

The Tree-sitter parser is built from the vendored grammar snapshot under `vendor/tree-sitter-zig`. The pinned upstream commit is recorded in `vendor/tree-sitter-zig/VENDORING.md`.

Rebuild the parser dylib:

```sh
./scripts/build-parser.sh
```

Bump the vendored snapshot (and rebuild):

```sh
./scripts/update-parser.sh           # upstream HEAD
./scripts/update-parser.sh <ref>     # specific tag, branch, or SHA
```

### Validation

Validate the extension bundle:

```sh
/Applications/Nova.app/Contents/SharedSupport/nova extension validate Zig.novaextension/
```

### Testing

Manual test cases are documented in [TESTING.md](TESTING.md). Run the test suite:

```sh
cd examples/test-suite && zig build test
```

## Architecture

### Extension Structure

- `Zig.novaextension/` — Nova extension bundle
  - `Scripts/main.js` — Extension entry point, task system, ZLS client, debugger
  - `extension.json` — Manifest with task templates, config schema, language definitions
  - `Syntax/` — Syntax definitions and Tree-Sitter integration
  - `Commands/` — Custom commands and menu items
- `vendor/tree-sitter-zig/` — Vendored Tree-Sitter grammar
- `examples/` — Example projects for testing and demonstration
- `build/` — Build artifacts (not in use)

### Key Components

**Language Server Integration** — ZLS is launched on activation and provides completions, hover, go-to-definition, and diagnostics via the Nova language client API.

**Task System** — Four task templates (`zigBuildRun`, `zigTest`, `zigDebug`, `zigWatch`) wrap `zig build` subcommands with configurable arguments.

**Issue Collection** — Compiler diagnostics are parsed into a JSON file and loaded into Nova's issue collection for inline gutter annotations.

**Debugger** — LLDB-DAP is auto-discovered and used to debug Zig binaries via breakpoints and step controls.

## License

The extension's source code is licensed under the BSD 2-Clause License (see [`LICENSE`](LICENSE)). Bundled assets and vendored third-party code carry their own licenses, documented in [`NOTICES.md`](NOTICES.md).