Editor Support

Zirric provides syntax highlighting and language features for modern editors using Tree-sitter and LSP.

The official Tree-sitter grammar lives in the separate repository:
zirric-lang/tree-sitter-zirric and provides the core grammar and queries.

The LSP server is built into the Zirric itself.

For the installation of Zirric, please refer to the installation instructions.

Helix setup

Add a Zirric entry to ~/.config/helix/languages.toml:

[[language]]
name = "zirric"
scope = "source.zirric"
grammar = "zirric"
language-servers = ["zirric"]
file-types = [
  "zirr",
  { glob = "Cavefile" },
]

[[grammar]]
name = "zirric"
source = { git = "https://code.knabel.dev/zirric-lang/tree-sitter-zirric", rev = "v0.2.0" }

[language-server.zirric]
command = "zirric"
args = ["lsp", "stdio"]

Fetch and build the grammar:

hx --grammar fetch
hx --grammar build

Download the queries into your Helix runtime directory:

mkdir -p ~/.config/helix/runtime/queries/zirric && curl -L https://code.knabel.dev/zirric-lang/tree-sitter-zirric/archive/main:queries.tar.gz | tar -xz --strip-components=1 -C ~/.config/helix/runtime/queries/zirric

Neovim setup

With nvim-treesitter, add this to your config:

local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.zirric = {
  install_info = {
    url = "https://code.knabel.dev/zirric-lang/tree-sitter-zirric",
    files = { "src/parser.c", "src/scanner.c" },
  },
  filetype = "zirric",
}

Then install the parser:

:TSInstall zirric

Download the queries into your Neovim config directory:

mkdir -p ~/.config/nvim/queries/zirric && curl -L https://code.knabel.dev/zirric-lang/tree-sitter-zirric/archive/main:queries.tar.gz | tar -xz --strip-components=1 -C ~/.config/nvim/queries/zirric

Add filetype detection (example for init.lua):

vim.filetype.add({
  extension = { zirr = "zirric" },
  filename = { ["cavefile"] = "zirric" },
})

Configure LSP (example with lspconfig):

require("lspconfig").zirric.setup({
  cmd = { "zirric", "lsp", "stdio" },
  filetypes = { "zirric" },
})