diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..46218d9 --- /dev/null +++ b/README.md | |||
| @@ -0,0 +1,87 @@ | |||
| 1 | # Zig for Nova | ||
| 2 | |||
| 3 | Zig language support – ZLS, LLDB, Tree-Sitter grammar | ||
| 4 | |||
| 5 | ## Requirements | ||
| 6 | |||
| 7 | - [Zig](https://ziglang.org/download/) installed and on `PATH` (or configured in extension preferences) | ||
| 8 | - [ZLS](https://github.com/zigtools/zls)\* for language intelligence | ||
| 9 | - [LLDB DAP](https://lldb.llvm.org/use/lldbdap.html)\* for debugging (discovered automatically via `xcrun` or `PATH`; install the Xcode Command Line Tools if absent: `xcode-select --install`) | ||
| 10 | |||
| 11 | \* optional but recommended for full experience | ||
| 12 | |||
| 13 | ## Why | ||
| 14 | |||
| 15 | A personal project to learn Zig without leaving Nova and without giving up the comfort of language server and debugging features. | ||
| 16 | |||
| 17 | ## Features | ||
| 18 | |||
| 19 | ### Editing | ||
| 20 | |||
| 21 | - Syntax highlighting for `.zig` and `.zon` | ||
| 22 | - Code folding for blocks, declarations, and control-flow expressions | ||
| 23 | - Document symbols (outline, breadcrumbs, Go to Symbol) | ||
| 24 | - Diagnostics, completion, hover, go to definition, find references, select all references, formatting (all via ZLS) | ||
| 25 | - Inline compiler errors from `zig build` | ||
| 26 | |||
| 27 | ### Tasks | ||
| 28 | |||
| 29 | - **Zig Package**: build and run a Zig package in the Nova console | ||
| 30 | - **Zig Package (macOS Terminal)**: build and run in the external Terminal app for interactive CLIs | ||
| 31 | - **Zig Debug**: build in Debug mode and launch under the debugger, with configurable console and stop-on-entry | ||
| 32 | - A clean action on every runnable template that removes `.zig-cache`, `zig-cache`, and `zig-out` | ||
| 33 | |||
| 34 | ### Debugging | ||
| 35 | |||
| 36 | - Breakpoint support in Zig source files | ||
| 37 | - LLDB-based debug adapter, auto-discovered via `xcrun` or `PATH` | ||
| 38 | |||
| 39 | ## Configuration | ||
| 40 | |||
| 41 | Global settings live under **Nova Preferences > Extensions > Zig**. | ||
| 42 | Per-workspace overrides live under **Project Settings > Zig** and take precedence. | ||
| 43 | |||
| 44 | ### Tooling | ||
| 45 | |||
| 46 | Paths to the `zig`, `zls`, and `lldb-dap` executables. Leave any blank to discover from `PATH`. | ||
| 47 | |||
| 48 | ### Language Server | ||
| 49 | |||
| 50 | - Enable or disable ZLS | ||
| 51 | - Allow ZLS to run its build/check on save | ||
| 52 | - Log ZLS traffic to the Extension Console (for troubleshooting) | ||
| 53 | |||
| 54 | ## Troubleshooting | ||
| 55 | |||
| 56 | ### A large part of the file turns red after one error | ||
| 57 | |||
| 58 | The parser may report a broad recovery range when it hits an incomplete expression (for example, `MyError.`), and Nova highlights that entire range. Fix the first syntax error shown and the overlay should narrow to the real error locations. | ||
| 59 | |||
| 60 | ## Development | ||
| 61 | |||
| 62 | 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`. | ||
| 63 | |||
| 64 | Rebuild the parser dylib: | ||
| 65 | |||
| 66 | ```sh | ||
| 67 | ./Scripts/build-parser.sh | ||
| 68 | ``` | ||
| 69 | |||
| 70 | Bump the vendored snapshot (and rebuild): | ||
| 71 | |||
| 72 | ```sh | ||
| 73 | ./Scripts/update-parser.sh # upstream HEAD | ||
| 74 | ./Scripts/update-parser.sh <ref> # specific tag, branch, or SHA | ||
| 75 | ``` | ||
| 76 | |||
| 77 | Validate the extension bundle: | ||
| 78 | |||
| 79 | ```sh | ||
| 80 | /Applications/Nova.app/Contents/SharedSupport/nova extension validate . | ||
| 81 | ``` | ||
| 82 | |||
| 83 | ## Attributions | ||
| 84 | |||
| 85 | The Zig logo is the work of the [Zig Software Foundation](https://ziglang.org) and is licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/). The zig-debug@2x.png is a derivative of the original logo, improving pixel alignment at 32px size. | ||
| 86 | |||
| 87 | The Tree-sitter grammar for Zig is sourced from [github.com/tree-sitter-grammars/tree-sitter-zig](https://github.com/tree-sitter-grammars/tree-sitter-zig). | ||
