Is anybody using the Helix text editor with zig?

I don’t know much about Zig (yet), except that I have read about it a couple of times.
Is anybody familiar with the Helix text editor?
The two things which make it interesting for me are:

  1. Tree-sitter a parser generator tool and an incremental parsing library and

  2. The usage of the Language Server Protocol

Once you installed zig and its LSP zls you are ready to roll (:roller_coaster:) …

% hx --health zig    
Configured language server: zls
Binary for language server: /Users/jan/zls/zls
Configured debug adapter: None
Highlight queries: ✓
Textobject queries: ✘
Indent queries: ✓

Try hx --tutor first to get an impression about the text editing first, but I think it’s a very cool tool to check out the supported language servers and learn more about those languages.

Let me know if there are others out there interested in this topic and/or Helix :+1:

1 Like

Paging @kristoff who has been using it in his livestreams, maybe he has some ideas to share!

I do use helix. Actually I maintain the tree-sitter config for zig, let me know if You encounter any misbehavior :slight_smile:

1 Like

Hello @voroskoi :wave:

Good to know. I did see some strange behavior of helix, e.g. that I couldn’t save or leave the editor in case there were problems reported by the language server, but I guess that’s rather a problem of the editor. Zig’s syntax still seems to change a lot from release to release, so it will be important to update things (like the language server) accordingly. Otherwise, if you save the file while the syntax is OK, it’s really fun to play with Helix and zig. I’m also playing with the same language servers (for e.g. other languages) in Emacs (via lsp-mode and eglot), and it’s fun to see how the same messages can be used for different feedback to the user (interface wise). Helix is a good starting point to see what language server(s) are out there for different languages. I also like that you can turn language server support on and off (probably easier in Emacs, for Helix you have to make sure that the language server is not found in the $PATH to turn it off).

How about tree-sitter? Is it always on? Do you have to change the config for each zig release (I assume so), and where does it go?

Anyway, it would be good to hear back from more helix/zig/emacs users about this topic :ear:

Hi,

I also encounter this “slow save on quit” problem sometimes. The reason behind this that zls is a bit fragile and when it fails helix tries waiting for a while for its reply (which never comes).
I have read somewhere from @andrewrk that zig will have its own official lsp implementation, in the meantime You can contribute to zls.

I have not tried to switch off tree-sitter in helix, no idea how to do that. The heavy lifting of writing the tree-sitter grammar for zig happens in this repo: GitHub - maxxnino/tree-sitter-zig
I just ported the nvim-based highlighting rules to helix. Which is about how to represent a type, not about the what to represent (and that changes more often). So it is not a big deal, You can find my patches in helix repo if You are interested in the details.

Have a nice day!

1 Like

Thanks @voroskoi … I will have a look.

I just published a short overview of my tests with Helix (and Emacs) here:

Just to remember all the things I have done/investigated over the last couple of days. There might be more in the future (about this topic), but for me it’s just handy to have all the related links in one place. The only programming language I mentioned was zig :zap: