fix(parse): zig symbol anchors never resolved — query targeted wrong grammar node names#33
Merged
Merged
Conversation
…grammar node names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Symbol-level anchors on
.zigfiles (drift link doc.md src/file.zig#Symbol) have never worked — every attempt fails withcannot compute fingerprint. The repo's owndrift.lockcontains zero#Symbolbindings, which is how this went unnoticed.Root cause:
src/queries/zig.scmtargets maxxnino-style node names (TopLevelDecl,FnDecl,VarDecl,IDENTIFIER), but the grammar we build against istree-sitter-grammars/tree-sitter-zigv1.1.1, which usesfunction_declaration,variable_declaration,identifier. The query never compiled — andfingerprintSymbolSyntaxswallowsts.Query.createfailures intonull(symbols.zig), so the compile error surfaced as a generic fingerprint failure.Fix
src/queries/zig.scmfor the actual grammar.variable_declarationhas noname:field, so the pattern anchors the first named child (. (identifier) @name) to avoid matching initializer identifiers on the RHS.error: cannot compute fingerprint for target: src/vcs.zig#noSuchSymbol(was:...for anchor in '<doc-path>'). Contextual printing moved intolink.zignext to the existingTargetNotFound/HeadingNotFoundmessages, covering both targeted and blanket relink paths.Tests
symbol queries compile for every supported language— compiles all six.scmqueries against their linked grammars; would have caught this bug and protects every future grammar bump.drift.lockgainsdocs/DESIGN.md -> src/vcs.zig#getRepoIdentityand#GitCatFile— the first symbol-level zig bindings in the repo, both genuinely described in DESIGN.md. Stale-doc relinks for the code edits reviewed per the drift skill (prose unaffected).Fixes DRIFT-ezbuwwor.