site  contact  subhomenews

Zig development in Scarthgap devx

October 27, 2024 — BarryK

Zig was introduced a few days ago:

Fascinating language; decided to go with it and Zig development support will be in the "devx" SFS in Easy Scarthgap 6.4 (coming very soon).

The devx SFS will have Zig version 0.13.0, which is the current stable release. It will also have VSCode text editor with Zig syntax highlighting. Also there is 'zls' language server, which can be used with VSCode.

Note that VSCode also supports Nim language syntax highlighting. Geany text editor does support Nim but not Zig -- there is an experimental Zig support in a branch of the Geany source repository; however, it doesn't work.

There are several text editors with Zig support. Here are some that I found:

Helix
https://helix-editor.com/
https://github.com/helix-editor/helix

Lapce
https://lapce.dev/

micro
https://micro-editor.github.io/
https://github.com/squeek502/micro-zigfmt

Sublime
https://www.sublimetext.com/
https://github.com/ziglang/sublime-zig-language
https://github.com/aidenfoxivey/sublime-zig-unofficial --i'm using this

Zag
https://github.com/seanpm2001/Zag

Zenith
https://codeberg.org/zenith-editor/zenith

VSCode
https://code.visualstudio.com/
https://github.com/ziglang/vscode-zig

Sublime is a commercial product, supposedly free for a limited time; yet no cutout date is published for the free personal usage. I have made it into a PET and it will be installable via PKGget.

ZLS is a Zig Language Server, which I have also made into a PET, which will be builtin to the devx. ZLS project:

https://zigtools.org/zls/

A language server does more than just syntax highlighting; such as code completion. See the Wikipedia:

https://en.wikipedia.org/wiki/Language_Server_Protocol

I don't know if VSCode will automatically use it, if found in the $PATH.

So, after Easy Scarthgap 6.4 is released, install the 'devx' SFS and you are good-to-go with learning Zig. The previous blog post has links to some getting-started tutorials. I also found a superb YouTube channel, by "Dude the Builder":

Zig in Depth (50 videos)
https://www.youtube.com/playlist?list=PLtB7CL7EG7pCw7Xy1SQC53Gl8pI7aDg9t

Zig Master (24 videos)
https://www.youtube.com/playlist?list=PLtB7CL7EG7pDKdSBA_AlNYrEsISOHBOQL

... the first series was done with Zig 0.11.0, latter with 0.12.0 (current release is 0.13.0). Dude the Builder uses NeoVim, which is another editor that supports Zig.    

Tags: easy