Languages / Zig · Edit queries/tags.scm
Tier 2 · Declarative tags.scmZig
Declarative tree-sitter query plugin powered by QueryLanguagePlugin (rgctl-lang-runtime) and crates/rgctl-lang-zig/queries/tags.scm. Compiles once at startup, validates captures against the Tier-2 vocabulary gate, and extracts symbols, container hierarchy (Container::member), imports, and call edges.
- Grammar Crate
- tree-sitter-zig
- Plugin
- QueryLanguagePlugin (rgctl-lang-zig)
- Extensions
- .zig, .zon
- Discover
- rgctl discover . -l zig
- Function Kinds
- function_declaration
- Class / Container Kinds
- struct_declaration
Capture summary
| Capture | Patterns | Graph mapping |
|---|---|---|
| @_bi | 2 | Lexical scope capture. |
| @definition.class | 1 | Emits SymbolType::Class (acts as enclosing container). |
| @definition.constant | 1 | Emits SymbolType::Constant. |
| @definition.function | 1 | Emits SymbolType::Function (acts as caller scope & container). |
| @import | 1 | Lexical scope capture. |
| @import.path | 1 | Emits SymbolType::Import with normalized import_path metadata. |
| @name | 4 | Symbol identifier or target callee/type name. |
| @reference.call | 1 | Emits RelationType::Calls from innermost enclosing function to @name. |
Query source (crates/rgctl-lang-zig/queries/tags.scm)
; Tier-2 Zig tags for rgctl (`handler = "queries"`).
; Capture vocabulary: tree-sitter code-navigation + import.path.
(function_declaration
name: (identifier) @name) @definition.function
; Zig structs are typically `const Name = struct { ... }` — name is on the var decl.
(variable_declaration
(identifier) @name
(struct_declaration)) @definition.class
(variable_declaration
(identifier) @name
(builtin_function)) @definition.constant
(call_expression
function: (identifier) @name) @reference.call
(builtin_function
(builtin_identifier) @_bi
(#eq? @_bi "@import")
(arguments
(string
(string_content) @import.path)))
Related: Tier 2 language support · Tier 1 language support · Discovering and indexing