Zig NEWS

loading...
Cover image for Zig Support for IntelliJ

Zig Support for IntelliJ

Mario Arias
・1 min read

For the last couple of months, I have been working on a plugin to add support for Zig in IntelliJ IDEA (and other JetBrains IDEs such as CLion).

This plugin is based on two previous plugins:

Consider the plugin to be of MVP-alpha-ish quality, there are still some issues with the parser, and it doesn't have many features yet.

My goal is to have a fully-featured IDE experience for JetBrains IDEs users.

Any feedback is welcome, as well as issues, ideas and PRs

Cheers

Discussion (7)

Collapse
kristoff profile image
Loris Cro

Maybe you've already thought of this, but my main recommendation would be to make sure to integrate with zig fmt.

WRT syntax coloring etc, is there a specific reason to prefer writing a grammar for intelliJ over using ZLS? Do language servers work at all with intelliJ?

Collapse
decoyrs profile image
Alexander

Language Servers don't work out of the box in IDEA and IDEA based parsers let you more control and optimizations for code processing in IDEA environment.
There are now multiple plugins for Zig language for IDEA, but they all stop at 2 problems - type resolution and project model integration.
Maybe I'm blind, but Zig Build doesn't have an option to spit out it's properties and dependency tree, making it really hard to extract any useful info about project configuration.

Collapse
kristoff profile image
Loris Cro

The command itself doesn't, but builds in Zig are expressed declaratively (by creating a build definition) and you can override the build runner. This way you could write a "gather info" runner that doesn't actually run the build commands but just outputs a serialized version of the build pipeline.

I don't have first hand experience doing that so you might want to talk with meghan and matt about this (the authors of zigmod and gyro, respectively).

Thread Thread
decoyrs profile image
Alexander

I originally started with Zig Discord where I've been told my only option was to parse the build code and interpret it, so I lost any interest pretty quickly, but if it's possible to tweak it's behaviour on the fly by overriding runner I might give it a second look, thank you!

Thread Thread
kristoff profile image
Loris Cro

Uh, if that's the case I'm sorry, you got bad information.

Collapse
marioariasc profile image
Mario Arias Author

I'll try to use zig fmt.

I only know about one plugin (Julia, IIRC) that is trying to integrate a language server for autocompletion.

Collapse
javier profile image
Javier

this is great news! intelliJ is my second option for development (Kate/KDevelop is the first, by far!), but on Zig it was seriously lacking.