aboutsummaryrefslogtreecommitdiff
path: root/Zig.novaextension/README.md
blob: f91bd81ef367308531fa1132650433c80b2ffa4c (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Zig ⚡️ Nova

**Write, build, test and debug Zig projects natively in Nova**

- Grammar, syntax highlighting, folding, navigation
- Language intelligence provided by ZLS
- Nova tasks for building, running, testing and debugging Zig code
- Auto-detection of build steps in `build.zig`
- Debugging provided by LLDB

This is a personal project to learn Zig, but using Nova to do so. Feedback and problem reports are greatly appreciated, you can send them to bugs@dcz<!--.example-->.at. If something doesn’t work for you, please let me know.

## Installation

- [Zig](https://ziglang.org)
- [ZLS](https://github.com/zigtools/zls)\* for language intelligence
- [Xcode Command line tools](https://developer.apple.com/documentation/xcode/installing-the-command-line-tools/#Install-the-Command-Line-Tools-package-in-Terminal)\* for debugging

\* optional but recommended for full experience

The extension resolves the executables automatically via the PATH environment variable or `xcrun`. But you can also manually configure them in the extension settings (global) or workspace settings (which overrides the extension settings so you can have different Zig versions for different projects).

## Features

### Code Editing

- **Syntax highlighting** for `.zig` and `.zon` files
- [**Completions**](https://help.nova.app/editor/overview/#completions)
- [**Code folding**](https://help.nova.app/editor/overview/#code-folding)
- [**Code structure headers**](https://help.nova.app/editor/overview/#code-structure-headers)
- **Type and function separators**
- [**Path bar**](https://help.nova.app/editor/overview/#path-bar)
- **Compiler issues and warnings** displayed inline upon compilation
- **Language intelligence** via ZLS:
    - [Completions](https://help.nova.app/editor/overview/#completions)
    - [Hovers](https://help.nova.app/editor/language-servers/#hovers)
    - [Signature help](https://help.nova.app/editor/language-servers/#signature-help)
    - [Issues and Warnings](https://help.nova.app/editor/issues-and-warnings/)

### Building & Testing

- [**Tasks templates**](https://help.nova.app/tasks/task-templates/#task-templates): compile, debug, run, test
- **Current Zig file** – compile and run the active `.zig` file
- **Auto-discovery of build steps** via `zig build --list-steps`

### Debugging

- **Debug** with the **Zig Debug** task template via LLDB (Xcode Command line tools required)
- [**Breakpoints**](https://help.nova.app/debugging/debug-sidebar/#setting-breakpoints)
- [**Execution control**](https://help.nova.app/debugging/debug-sidebar/#execution-controls)
- [**Variable inspection**](https://help.nova.app/debugging/debug-sidebar/#inspecting-variables)
- **Performance information**
- **Manual lldb commands**

### Configuration

The extension strives to keep the configuration options as short as possible but as flexible as needed. If you are missing a configuration option, please let me know.

## Troubleshooting

### Auto-discovered tasks wont’t open the report automatically

The _Current Zig file_ and auto-discovered `zig build` tasks are created programmatically. Nova’s API doesn’t support auto-opening the report for them at the moment.

### ZLS isn’t working

- Confirm ZLS is installed: `which zls`
- Configure the path to ZLS manually
- Check the extension console for errors
- Confirm ZLS and Zig are version-compatible

### Debugging isn’t working

Make sure that the [Xcode Command line tools](https://developer.apple.com/documentation/xcode/installing-the-command-line-tools/) are installed or set the path to `lldb-dap` manually in the extension or workspace settings.

## License

This extension is a personal project and is not endorsed by or affiliated with the [Zig Software Foundation](https://ziglang.org/zsf/).

The extension’s source code is licensed under the BSD 2-Clause License.

The Zig logo is the original work of the [Zig Software Foundation](https://ziglang.org). It and the icon assets derived from it remain licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).

The bundled 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) and is distributed under the MIT License.