No description
Find a file
FalsePattern 3fbd9c7e50
backport: 12.0.0
ci: 12.0.0

(cherry picked from commit 2f80528cb46ee5a13dd5cb960d361c41d62c7e28)
(cherry picked from commit 87d7db94410dd30be154e585138498c67c262db8)

chore: Isolate C++ toolchain into separate package to fix verifier error

(cherry picked from commit c393120bf24c40d5fc5e8ce41dacc560bcb29ae8)

chore: Forgot to bump gradle version in properties

(cherry picked from commit b8639b0e8dc7d4e8177339d5466d98af9b87c900)

fix(zig): Make go to references non-blocking

(cherry picked from commit a1cee2b1ea399776f5d4bbf33c2403a9c4bf9b03)

feat(zig)!: Go to declaration/usages and go to definition are now separate actions

(cherry picked from commit 18e130cc52e78b69dfdd08e5f160e82d3215deb2)

fix(zig): Refresh syntax highlighting after running code edits

(cherry picked from commit 64eba369d61073f1dd57c999449e9ee7b914bd49)

chore: Cleanup dependencies

(cherry picked from commit baabbb030dc8ad729f5a1f82c523c1d6da27489b)

docs: Extra information about module tree

(cherry picked from commit 12ad175f510124353fd9cc6b8994355e44965161)

feat(zig)!: Autogenerate zls config if not specified, based on project toolchain

(cherry picked from commit 59a56b67646b0253734130a84d8d9d825effe114)

feat(debugger): Library frame filter

(cherry picked from commit 4e3336add808801097acc792fa3e899b26cbdaee)

docs: update changelog

(cherry picked from commit 7db1c621288ba1cac25e85b682d981fd8cc2d4b8)

feat!: Reimplemented go to declaration/usages to replace the built-in action

Also removed mouse handling, no longer needed

(cherry picked from commit 6f481ac844f80701f22d9383a3ff228ea3ee440d)

feat(debugger): Detect C++ debugger toolchains

(cherry picked from commit 6df7cb6dc059c622a0e06ace38558c8b495bd91e)

fix(zig): Add proper lang key for notification group

(cherry picked from commit b8f64ac0062847279b6c85b00083711900e8f7cf)

chore(buildscript): Update gradle and gradle plugins

(cherry picked from commit 45ab2d9bb7834be9bc2914f962d3a21bef494fbd)

fix(lsp): Force always creating a new DocumentEventManager

34b29ee729
(cherry picked from commit 59c1f4612d353de3230419d005206dada4900a7f)

fix(lsp): unregisterManager method's cleanup

bc9c5ea31c
(cherry picked from commit 14a1a9d79f09573d3d7c8cfb27bb008cb63ca38b)

chore(lsp): Extract shared logic

75a5fd8919
(cherry picked from commit 857a0224897e27968fa03f93b0f9a02bc109f0b0)

fix(lsp): Remove duplicated changedConfiguration calls

9b2b0557c9
(cherry picked from commit ceb347d8723130c8ee4097a78fed5f14615805ee)

chore(lsp): Small code cleanup

8c1e6736df
(cherry picked from commit 1e1b4aaaeafabfe76abad22cc18aa51629098012)

fix(lsp): Code action annotations lose range

00bbd6ff45
(cherry picked from commit d920fa37f32549d7d7419fa07e478b94cc8ae8ba)

fix(lsp): Request code actions immediately after diagnostics arrive

0fe2cf98fe
(cherry picked from commit 36138213ba878eaf97e9c7f0642b9927672d2e59)
2024-02-29 20:41:56 +01:00
.github chore: update funding.yml 2023-09-06 16:15:17 +02:00
.idea/codeStyles Initial Commit 2023-07-29 12:22:51 +02:00
art/zig feat: Modularize whole project 2023-08-18 23:58:54 +02:00
gradle/wrapper backport: 12.0.0 2024-02-29 20:41:56 +01:00
modules backport: 12.0.0 2024-02-29 20:41:56 +01:00
plugin/src/main/resources backport: 12.0.0 2024-02-29 20:41:56 +01:00
.gitattributes chore: Enforce LF line endings 2023-08-02 22:08:36 +02:00
.gitignore backport: 11.1.0 2024-02-21 14:52:53 +01:00
build.gradle.kts backport: 12.0.0 2024-02-29 20:41:56 +01:00
CHANGELOG.md backport: 12.0.0 2024-02-29 20:41:56 +01:00
CONTRIBUTING.md backport: 12.0.0 2024-02-29 20:41:56 +01:00
gradle.properties backport: 12.0.0 2024-02-29 20:41:56 +01:00
gradlew Filter run configuration to only Zig files 2023-09-28 09:34:15 +01:00
gradlew.bat Initial Commit 2023-07-29 12:22:51 +02:00
LICENSE copyright: 2024 2024-01-25 20:39:56 +01:00
MODULE_TREE.md backport: 12.0.0 2024-02-29 20:41:56 +01:00
README.md backport: 12.0.0 2024-02-29 20:41:56 +01:00
settings.gradle.kts feat: Modularize whole project 2023-08-18 23:58:54 +02:00

ZigBrains

Developer guide

All platforms

After importing the gradle project, you need to run the build setup -> generateSources tasks.

NixOS

In addition to the generated sources, you also need to run the build setup -> nixos_jbr task, otherwise java will complain about missing files

Special Thanks

  • HTGAzureX1212 for developing intellij-zig, which served as a fantastic reference for deep IDE integration features

  • The members of the Zig Programming Language discord server's #tooling-dev channel for providing encouragement and feedback

  • The Ballerina Platform developers for lsp4intellij, the language server connector between the IntelliJ platform and the Eclipse LSP4J project

  • All the people who have generously funded the project

    • gree7
    • xceno
    • AnErrupTion
  • Every contributor who helped with bugfixes and extra features

  • And everyone who actively reported issues and helped ironing out all the remaining problems

Versioning scheme

To reduce confusion and to better utilize semver, the plugin uses the following versioning scheme:

X - Major version, incremented any time a relatively large features is added or removed Y - Minor version, incremented for smaller features or large refactors that don't change user-perceived behaviour Z - Patch version, incremented only when a fix is purely an internal change and doesn't exceed an arbitrary threshold of complexity (determined at the discretion of FalsePattern)

Note: before version 11, the version scheme used was 0.X.Y, without separate patch versions. As this plugin will constantly be evolving together with the zig language, it makes not sense to keep the 0 prefix, and might as well utilize the full semver string for extra information.

Description

A multifunctional Zig Programming Language plugin for the IDEA platform.

Core features:

  • Uses ZLS (Zig Language Server) for code assistance, syntax highlighting, and anything to do with coding assistance
  • Supports build.zig.zon files with autocomplete
  • Per-project Zig toolchain integration
  • Debugging support for CLion (builtin), and IDEA Ultimate With this plugin
  • Gutter icon for running main(), tests, and build

Setting up the language server

If you have zls available on PATH, ZigBrains will automatically discover it. If not, follow this guide:

  1. Download or compile the ZLS language server, available at https://github.com/zigtools/zls
  2. Go to Settings -> Languages & Frameworks -> ZLS -> ZLS path -> set the path to the zls executable you downloaded or compiled
  3. Open a .zig file, and wait for the circle in the bottom status bar to turn Green (empty). See below for an explanation on what the circle means.

LSP status icon explanation

Red (X symbol): LSP server is stopped. You either don't have a proper ZLS path set, or you don't have a .zig file open.

Yellow ("refresh arrow" symbol): LSP server is starting, please be patient.

Green (empty): LSP server is running.

Debugging

ZigBrains uses the CLion C++ toolchains (Settings | Build, Execution, Deployment | Toolchains) for debugging purposes, and it is fully compatible with both GDB and LLDB debuggers.

Additionally, ZigBrains will prioritize a toolchain if it is called Zig, otherwise it will use the default toolchain.

If no toolchain is available, ZigBrains will attempt to use the bundled LLDB debugger, and if that is not available either, an error popup will be shown when you try to run with debugging.

Note: There is a small issue with the LLDB debugger which does not happen with GDB: The debugger will pause on the first instruction (usually, deep inside the zig standard library's startup code). Unfortunately, we have not found a fix for this yet, but fortunately it doesn't break anything, just a bit of inconvenience.

Feature tracker:

.zig files:

  • Code completion

  • Code folding

  • Code formatting

  • Syntax highlighting

  • Inlay hints

  • Basic error diagnostics

  • Go to definition

  • Rename symbol

  • Hover documentation

  • Go to implementations / find usages

  • Brace/Parenthesis/Bracket matching

  • Debugging (CLion/CLion Nova)

  • File creation prompt

  • Gutter launch buttons

  • Commenter (thanks @MarioAriasC !)

  • TODO:

    • Workspace Symbols

.zon files:

  • Syntax highlighting
  • Formatting and indentation
  • Code completion
  • Brace folding
  • Automatic brace and quote pairing

Toolchain:

  • Basic per-project toolchain management
  • Run configurations
  • Debugging (CLion/IDEA Ultimate)
  • Project generation (thanks @JensvandeWiel !)

Licenses

All code in this project, unless specified differently, is licensed under the Apache 2.0 license.

The code inside the lsp package is derived from the LSP4IntelliJ project, with various modifications, fixes, and additions to fix any outstanding issues i was having with the original code. (https://github.com/ballerina-platform/lsp4intellij)

The original code is Copyright WSO2 Inc., licensed under the Apache 2.0 license.

The art assets inside src/art/zig, and all copies of them, are derived from the official Zig Programming Language logo, which are the property of the Zig Software Foundation. (https://github.com/ziglang/logo) These art assets are licensed under Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0).

Parts of this codebase are based on the intellij-zig plugin, developed by HTGAzureX1212, licensed under the Apache 2.0.