You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a fast analyzer-level ZLS bulk exporter with partial authority; and
the final strict path, a versioned exporter added inside the Zig compiler at
the Sema/Zcu/InternPool boundary and connected to Zig's incremental
build/watch state.
The ZLS milestone improves speed and navigation but cannot close this issue.
Current master baseline
No strict Zig provider is registered. PR #147 investigated the compiler's
autodoc output and intentionally declined to register a containment-only
producer because it would displace the generic ZLS lane that can answer
references. There is no committed strict Zig timing cell.
This is not an unimplemented use of an existing Sema export. Zig PR #19208 removed the old
compiler-produced ZIR-derived JSON and redesigned autodoc around source plus a
Wasm analyzer that reparses pre-semantic data. Current -femit-docs does not
publish compiler Sema facts.
Therefore the final route requires a real compiler change, not a wrapper around
autodoc.
Phase A: ZLS analyzer exporter
ZLS is consumable as a pinned Zig module and owns:
build-runner/module discovery;
DocumentStore source/dependency state;
scope/declaration and type-analysis helpers; and
cross-file reference machinery.
Build a small Zig executable or narrow ZLS command that opens one resident
workspace, awaits readiness, walks declarations/AST/VM state once and emits
changed Graph Snapshot Protocol shards. Do not call the external LSP once per
symbol.
This provider may claim only analyzer-proven facts. Literal @import, lexical
containment, source declarations, references and some resolved calls/accesses
are useful. Comptime-generated declarations, full generic instantiation,
target-dependent evaluation and compiler diagnostics remain partial or
unsupported. ZLS itself documents semantic/comptime limitations and is not
compiler authority.
Pin Zig and ZLS as a compatible pair and record both commits. A ZLS source
object/AST index is not a persistent identity; synthesize source identities from
module/file, semantic owner path, declaration kind/name and structural
signature, with explicit instability for anonymous/generated entities.
Phase B: compiler Sema exporter
Maintain an upstreamable narrow Zig compiler patch that:
observes resolved declarations, types, functions and expressions at Sema;
maps compiler interned identities back to source/module/build evidence;
records direct dependency/invalidation keys from Zcu/InternPool;
emits diagnostics and unresolved comptime/generated sites; and
participates in the incremental build-server/watch generation rather than
launching a separate full compiler.
The exact internal hook names are version-sensitive. The protocol handshake
must state Zig commit, exporter schema and supported fact families; an unknown
compiler build declines rather than loading an ABI-compatible-looking patch.
Do not reconstruct typed facts from ZIR/autodoc. The redesign explicitly moved
autodoc away from unavailable semantic data, and pre-Sema source/ZIR cannot
prove resolved calls or comptime effects.
Facts and limits
The strict compiler path should cover:
declarations, containers, namespaces/modules, visibility and exports;
literal/resolved imports and build-module dependencies;
resolved calls, field accesses, construction/init expressions and type refs;
compile-time-generated declarations with origin/evaluation evidence;
tests and compiler diagnostics; and
references from compiler dependency/use data.
Zig has no class inheritance/interface/decorator model. Mark extends, implements, overrides, decorates and renders unsupported instead of
fabricating analogies. Hand-rolled *anyopaque/function-pointer vtables do not
yield an exact runtime dispatch target; record dynamic candidates/unresolved
sites only when the compiler proves them.
Computed @import, reflection builtins, generated declarations and target/
comptime branches carry explicit dynamic, macro-or-generated or conditional-build coverage.
Identity and universe
The universe includes Zig compiler/exporter commit, build graph/module,
target/CPU/features, optimization mode, build options, package dependencies,
global cache identity, build runner, compiler flags, generated inputs and
environment used by build.zig.
Persistent declarations use package/module coordinate, owner path, kind/name
and structural type/signature. Compiler interned IDs may be used only inside one
generation unless upstream guarantees cross-run stability. Exact fixtures
cover same-named declarations in scopes, anonymous structs, generic/comptime
specializations and generated declarations.
Incremental and performance behavior
Phase A keeps one ZLS DocumentStore; source/config changes use ZLS
invalidation and re-export affected files/modules.
Phase B connects to Zig's incremental compiler/build-server/watch state:
no-op: validated shard manifest, no semantic rerun;
body edit: compiler invalidates and re-exports the affected declaration/module
closure;
Outcome
Deliver two explicitly different Zig providers:
the
Sema/Zcu/InternPoolboundary and connected to Zig's incrementalbuild/watch state.
The ZLS milestone improves speed and navigation but cannot close this issue.
Current master baseline
No strict Zig provider is registered. PR #147 investigated the compiler's
autodoc output and intentionally declined to register a containment-only
producer because it would displace the generic ZLS lane that can answer
references. There is no committed strict Zig timing cell.
This is not an unimplemented use of an existing Sema export. Zig PR
#19208removed the oldcompiler-produced ZIR-derived JSON and redesigned autodoc around source plus a
Wasm analyzer that reparses pre-semantic data. Current
-femit-docsdoes notpublish compiler Sema facts.
Therefore the final route requires a real compiler change, not a wrapper around
autodoc.
Phase A: ZLS analyzer exporter
ZLS is consumable as a pinned Zig module and owns:
DocumentStoresource/dependency state;Build a small Zig executable or narrow ZLS command that opens one resident
workspace, awaits readiness, walks declarations/AST/VM state once and emits
changed Graph Snapshot Protocol shards. Do not call the external LSP once per
symbol.
This provider may claim only analyzer-proven facts. Literal
@import, lexicalcontainment, source declarations, references and some resolved calls/accesses
are useful. Comptime-generated declarations, full generic instantiation,
target-dependent evaluation and compiler diagnostics remain partial or
unsupported. ZLS itself documents semantic/comptime limitations and is not
compiler authority.
Pin Zig and ZLS as a compatible pair and record both commits. A ZLS source
object/AST index is not a persistent identity; synthesize source identities from
module/file, semantic owner path, declaration kind/name and structural
signature, with explicit instability for anonymous/generated entities.
Phase B: compiler Sema exporter
Maintain an upstreamable narrow Zig compiler patch that:
Zcu/InternPool;launching a separate full compiler.
The exact internal hook names are version-sensitive. The protocol handshake
must state Zig commit, exporter schema and supported fact families; an unknown
compiler build declines rather than loading an ABI-compatible-looking patch.
Do not reconstruct typed facts from ZIR/autodoc. The redesign explicitly moved
autodoc away from unavailable semantic data, and pre-Sema source/ZIR cannot
prove resolved calls or comptime effects.
Facts and limits
The strict compiler path should cover:
Zig has no class inheritance/interface/decorator model. Mark
extends,implements,overrides,decoratesandrendersunsupported instead offabricating analogies. Hand-rolled
*anyopaque/function-pointer vtables do notyield an exact runtime dispatch target; record dynamic candidates/unresolved
sites only when the compiler proves them.
Computed
@import, reflection builtins, generated declarations and target/comptime branches carry explicit
dynamic,macro-or-generatedorconditional-buildcoverage.Identity and universe
The universe includes Zig compiler/exporter commit, build graph/module,
target/CPU/features, optimization mode, build options, package dependencies,
global cache identity, build runner, compiler flags, generated inputs and
environment used by
build.zig.Persistent declarations use package/module coordinate, owner path, kind/name
and structural type/signature. Compiler interned IDs may be used only inside one
generation unless upstream guarantees cross-run stability. Exact fixtures
cover same-named declarations in scopes, anonymous structs, generic/comptime
specializations and generated declarations.
Incremental and performance behavior
Phase A keeps one ZLS
DocumentStore; source/config changes use ZLSinvalidation and re-export affected files/modules.
Phase B connects to Zig's incremental compiler/build-server/watch state:
closure;
Cold strict overhead is compared with the identical native Zig semantic build.
There must be no second compiler invocation for graph work.
Implementation map
protocol/hook where possible.
packaging pass.
Acceptance
fan-out.
Sema, not ZIR/autodoc guesses.
generics, comptime, tests, target branches, build options and generated
declarations.
crash and retry are atomic and incremental.
separate.
pnpm build,pnpm test, andpnpm coveragepass.Primary references