gitnexus 1.6.11-rc.8 → 1.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -26
- package/dist/_shared/graph/types.d.ts +81 -2
- package/dist/_shared/graph/types.d.ts.map +1 -1
- package/dist/_shared/integrations/circuit-breaker.d.ts.map +1 -1
- package/dist/_shared/integrations/circuit-breaker.js.map +1 -1
- package/dist/_shared/integrations/resilient-fetch.d.ts.map +1 -1
- package/dist/_shared/integrations/resilient-fetch.js.map +1 -1
- package/dist/_shared/language-detection.d.ts.map +1 -1
- package/dist/_shared/language-detection.js +2 -0
- package/dist/_shared/language-detection.js.map +1 -1
- package/dist/_shared/languages.d.ts +2 -1
- package/dist/_shared/languages.d.ts.map +1 -1
- package/dist/_shared/languages.js +1 -0
- package/dist/_shared/languages.js.map +1 -1
- package/dist/_shared/lbug/schema-constants.d.ts +2 -2
- package/dist/_shared/lbug/schema-constants.d.ts.map +1 -1
- package/dist/_shared/lbug/schema-constants.js +4 -0
- package/dist/_shared/lbug/schema-constants.js.map +1 -1
- package/dist/_shared/scope-resolution/evidence-weights.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/finalize-algorithm.js +1 -0
- package/dist/_shared/scope-resolution/finalize-algorithm.js.map +1 -1
- package/dist/_shared/scope-resolution/language-classification.d.ts +3 -0
- package/dist/_shared/scope-resolution/language-classification.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/language-classification.js +4 -0
- package/dist/_shared/scope-resolution/language-classification.js.map +1 -1
- package/dist/_shared/scope-resolution/reference-site.d.ts +10 -0
- package/dist/_shared/scope-resolution/reference-site.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/registries/field-registry.js.map +1 -1
- package/dist/_shared/scope-resolution/registries/method-registry.js.map +1 -1
- package/dist/_shared/scope-resolution/scope-tree.d.ts.map +1 -1
- package/dist/_shared/scope-resolution/scope-tree.js.map +1 -1
- package/dist/_shared/scope-resolution/types.d.ts +15 -0
- package/dist/_shared/scope-resolution/types.d.ts.map +1 -1
- package/dist/cli/ai-context.d.ts +4 -0
- package/dist/cli/ai-context.js +90 -14
- package/dist/cli/analyze-config.js +14 -0
- package/dist/cli/analyze-options.d.ts +14 -0
- package/dist/cli/analyze-watch.d.ts +20 -0
- package/dist/cli/analyze-watch.js +434 -0
- package/dist/cli/analyze.js +27 -9
- package/dist/cli/auto-sync.d.ts +1 -0
- package/dist/cli/auto-sync.js +107 -0
- package/dist/cli/command-banner.d.ts +15 -0
- package/dist/cli/command-banner.js +42 -0
- package/dist/cli/detect-changes-format.js +21 -0
- package/dist/cli/doctor.d.ts +7 -0
- package/dist/cli/doctor.js +14 -0
- package/dist/cli/group.js +7 -1
- package/dist/cli/help-i18n.js +4 -0
- package/dist/cli/i18n/en.d.ts +18 -3
- package/dist/cli/i18n/en.js +18 -3
- package/dist/cli/i18n/resources.d.ts +33 -3
- package/dist/cli/i18n/zh-CN.d.ts +15 -0
- package/dist/cli/i18n/zh-CN.js +18 -3
- package/dist/cli/index.js +34 -7
- package/dist/cli/mcp.d.ts +15 -0
- package/dist/cli/mcp.js +44 -0
- package/dist/cli/optional-grammars.d.ts +3 -2
- package/dist/cli/optional-grammars.js +19 -3
- package/dist/cli/setup.js +41 -15
- package/dist/cli/update-notice.d.ts +34 -0
- package/dist/cli/update-notice.js +91 -0
- package/dist/cli/update.d.ts +21 -0
- package/dist/cli/update.js +93 -0
- package/dist/cli/watch.d.ts +1 -20
- package/dist/cli/watch.js +5 -371
- package/dist/core/analysis-feature-registry.d.ts +2 -0
- package/dist/core/analysis-feature-registry.js +15 -0
- package/dist/core/analyzer-identity.js +21 -3
- package/dist/core/auto-sync/analysis-worker-launch.d.ts +30 -0
- package/dist/core/auto-sync/analysis-worker-launch.js +166 -0
- package/dist/core/auto-sync/config.d.ts +33 -0
- package/dist/core/auto-sync/config.js +320 -0
- package/dist/core/auto-sync/index.d.ts +6 -0
- package/dist/core/auto-sync/index.js +6 -0
- package/dist/core/auto-sync/path-security.d.ts +9 -0
- package/dist/core/auto-sync/path-security.js +251 -0
- package/dist/core/auto-sync/repo.d.ts +1 -0
- package/dist/core/auto-sync/repo.js +6 -0
- package/dist/core/auto-sync/runner.d.ts +44 -0
- package/dist/core/auto-sync/runner.js +428 -0
- package/dist/core/auto-sync/starter.d.ts +50 -0
- package/dist/core/auto-sync/starter.js +497 -0
- package/dist/core/auto-sync/state.d.ts +37 -0
- package/dist/core/auto-sync/state.js +119 -0
- package/dist/core/group/config-parser.js +8 -1
- package/dist/core/group/cross-impact.d.ts +3 -0
- package/dist/core/group/cross-impact.js +36 -4
- package/dist/core/group/extractors/http-patterns/java.js +22 -8
- package/dist/core/group/extractors/http-patterns/kotlin.js +86 -31
- package/dist/core/group/extractors/http-patterns/node.js +145 -8
- package/dist/core/group/extractors/http-patterns/python.js +11 -7
- package/dist/core/group/extractors/http-route-extractor.js +63 -17
- package/dist/core/group/extractors/java-workspace-extractor.js +244 -31
- package/dist/core/group/group-lock.js +5 -6
- package/dist/core/group/normalization.d.ts +38 -1
- package/dist/core/group/normalization.js +59 -3
- package/dist/core/group/service.d.ts +11 -0
- package/dist/core/group/service.js +13 -1
- package/dist/core/group/storage.js +2 -2
- package/dist/core/group/sync.d.ts +24 -1
- package/dist/core/group/sync.js +46 -8
- package/dist/core/group/types.d.ts +13 -0
- package/dist/core/incremental/derived-writeback.d.ts +36 -0
- package/dist/core/incremental/derived-writeback.js +68 -0
- package/dist/core/incremental/spring-config-drift.d.ts +12 -0
- package/dist/core/incremental/spring-config-drift.js +46 -0
- package/dist/core/incremental/subgraph-extract.d.ts +7 -4
- package/dist/core/incremental/subgraph-extract.js +30 -5
- package/dist/core/ingestion/asyncapi/document.d.ts +226 -0
- package/dist/core/ingestion/asyncapi/document.js +758 -0
- package/dist/core/ingestion/asyncapi/protocol.d.ts +79 -0
- package/dist/core/ingestion/asyncapi/protocol.js +203 -0
- package/dist/core/ingestion/call-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/call-extractors/configs/zig.js +4 -0
- package/dist/core/ingestion/call-extractors/zig-static-gating.d.ts +100 -0
- package/dist/core/ingestion/call-extractors/zig-static-gating.js +319 -0
- package/dist/core/ingestion/call-processor.js +3 -1
- package/dist/core/ingestion/class-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/class-extractors/configs/zig.js +32 -0
- package/dist/core/ingestion/class-extractors/generic.js +4 -1
- package/dist/core/ingestion/class-types.d.ts +6 -2
- package/dist/core/ingestion/destination-key.d.ts +59 -0
- package/dist/core/ingestion/destination-key.js +61 -0
- package/dist/core/ingestion/entry-point-scoring.d.ts +6 -2
- package/dist/core/ingestion/entry-point-scoring.js +8 -44
- package/dist/core/ingestion/export-detection.d.ts +37 -0
- package/dist/core/ingestion/export-detection.js +60 -0
- package/dist/core/ingestion/field-extractors/configs/zig.d.ts +8 -0
- package/dist/core/ingestion/field-extractors/configs/zig.js +49 -0
- package/dist/core/ingestion/field-extractors/generic.d.ts +1 -1
- package/dist/core/ingestion/field-extractors/generic.js +12 -1
- package/dist/core/ingestion/frameworks/spring/actuator-runtime.d.ts +26 -0
- package/dist/core/ingestion/frameworks/spring/actuator-runtime.js +843 -0
- package/dist/core/ingestion/frameworks/spring/analysis-features.d.ts +5 -0
- package/dist/core/ingestion/frameworks/spring/analysis-features.js +9 -0
- package/dist/core/ingestion/frameworks/spring/annotation-arguments.js +8 -1
- package/dist/core/ingestion/frameworks/spring/argument-facts.d.ts +80 -0
- package/dist/core/ingestion/frameworks/spring/argument-facts.js +85 -0
- package/dist/core/ingestion/frameworks/spring/config-bindings.d.ts +1 -0
- package/dist/core/ingestion/frameworks/spring/config-bindings.js +2 -1
- package/dist/core/ingestion/frameworks/spring/destinations.d.ts +539 -0
- package/dist/core/ingestion/frameworks/spring/destinations.js +840 -0
- package/dist/core/ingestion/frameworks/spring/dynamic-lookups.d.ts +22 -0
- package/dist/core/ingestion/frameworks/spring/dynamic-lookups.js +124 -0
- package/dist/core/ingestion/frameworks/spring/message-producers.d.ts +78 -0
- package/dist/core/ingestion/frameworks/spring/message-producers.js +90 -0
- package/dist/core/ingestion/frameworks/spring/non-http-handlers.d.ts +29 -0
- package/dist/core/ingestion/frameworks/spring/vendor-prefixes.d.ts +7 -0
- package/dist/core/ingestion/frameworks/spring/vendor-prefixes.js +22 -0
- package/dist/core/ingestion/import-resolvers/configs/zig.d.ts +13 -0
- package/dist/core/ingestion/import-resolvers/configs/zig.js +26 -0
- package/dist/core/ingestion/import-resolvers/zig.d.ts +34 -0
- package/dist/core/ingestion/import-resolvers/zig.js +193 -0
- package/dist/core/ingestion/language-config.d.ts +177 -0
- package/dist/core/ingestion/language-config.js +719 -0
- package/dist/core/ingestion/language-provider.d.ts +178 -1
- package/dist/core/ingestion/language-provider.js +22 -0
- package/dist/core/ingestion/languages/csharp/razor-view-components.d.ts +62 -0
- package/dist/core/ingestion/languages/csharp/razor-view-components.js +954 -0
- package/dist/core/ingestion/languages/csharp/resolution-config.d.ts +3 -0
- package/dist/core/ingestion/languages/csharp/resolution-config.js +6 -1
- package/dist/core/ingestion/languages/csharp/scope-resolver.js +8 -0
- package/dist/core/ingestion/languages/index.d.ts +1 -0
- package/dist/core/ingestion/languages/index.js +2 -0
- package/dist/core/ingestion/languages/java/analysis-features.d.ts +1 -1
- package/dist/core/ingestion/languages/java/analysis-features.js +14 -6
- package/dist/core/ingestion/languages/java/capture-side-channel.d.ts +8 -0
- package/dist/core/ingestion/languages/java/capture-side-channel.js +34 -0
- package/dist/core/ingestion/languages/java/captures.js +22 -1
- package/dist/core/ingestion/languages/java/lombok-synthesizer.d.ts +42 -0
- package/dist/core/ingestion/languages/java/lombok-synthesizer.js +439 -0
- package/dist/core/ingestion/languages/java/scope-resolver.js +2 -0
- package/dist/core/ingestion/languages/java/spring-actuator.d.ts +2 -0
- package/dist/core/ingestion/languages/java/spring-actuator.js +62 -0
- package/dist/core/ingestion/languages/java/spring-di.d.ts +17 -1
- package/dist/core/ingestion/languages/java/spring-di.js +44 -2
- package/dist/core/ingestion/languages/java/spring-dynamic-lookup.d.ts +8 -0
- package/dist/core/ingestion/languages/java/spring-dynamic-lookup.js +62 -0
- package/dist/core/ingestion/languages/java/spring-message-producers.d.ts +20 -0
- package/dist/core/ingestion/languages/java/spring-message-producers.js +83 -0
- package/dist/core/ingestion/languages/java/spring-non-http-handlers.d.ts +11 -1
- package/dist/core/ingestion/languages/java/spring-non-http-handlers.js +13 -3
- package/dist/core/ingestion/languages/java.js +18 -8
- package/dist/core/ingestion/languages/jvm/accessor-synthesis.d.ts +99 -0
- package/dist/core/ingestion/languages/jvm/accessor-synthesis.js +173 -0
- package/dist/core/ingestion/languages/jvm/beanspec.d.ts +17 -0
- package/dist/core/ingestion/languages/jvm/beanspec.js +42 -0
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.d.ts +15 -0
- package/dist/core/ingestion/languages/kotlin/capture-side-channel.js +50 -0
- package/dist/core/ingestion/languages/kotlin/captures.js +24 -1
- package/dist/core/ingestion/languages/kotlin/lombok-synthesizer.d.ts +26 -0
- package/dist/core/ingestion/languages/kotlin/lombok-synthesizer.js +417 -0
- package/dist/core/ingestion/languages/kotlin/scope-resolver.js +4 -0
- package/dist/core/ingestion/languages/kotlin/spring-actuator.d.ts +4 -0
- package/dist/core/ingestion/languages/kotlin/spring-actuator.js +172 -0
- package/dist/core/ingestion/languages/kotlin/spring-config-bindings.d.ts +18 -0
- package/dist/core/ingestion/languages/kotlin/spring-config-bindings.js +411 -0
- package/dist/core/ingestion/languages/kotlin/spring-di.d.ts +51 -1
- package/dist/core/ingestion/languages/kotlin/spring-di.js +86 -6
- package/dist/core/ingestion/languages/kotlin/spring-dynamic-lookup.d.ts +8 -0
- package/dist/core/ingestion/languages/kotlin/spring-dynamic-lookup.js +77 -0
- package/dist/core/ingestion/languages/kotlin/spring-message-producers.d.ts +17 -0
- package/dist/core/ingestion/languages/kotlin/spring-message-producers.js +119 -0
- package/dist/core/ingestion/languages/kotlin/spring-non-http-handlers.d.ts +16 -0
- package/dist/core/ingestion/languages/kotlin/spring-non-http-handlers.js +77 -2
- package/dist/core/ingestion/languages/kotlin.js +24 -0
- package/dist/core/ingestion/languages/python.js +2 -0
- package/dist/core/ingestion/languages/rust/query.js +8 -8
- package/dist/core/ingestion/languages/zig/captures.d.ts +260 -0
- package/dist/core/ingestion/languages/zig/captures.js +2070 -0
- package/dist/core/ingestion/languages/zig/index.d.ts +4 -0
- package/dist/core/ingestion/languages/zig/index.js +4 -0
- package/dist/core/ingestion/languages/zig/interpret.d.ts +36 -0
- package/dist/core/ingestion/languages/zig/interpret.js +176 -0
- package/dist/core/ingestion/languages/zig/query.d.ts +3 -0
- package/dist/core/ingestion/languages/zig/query.js +426 -0
- package/dist/core/ingestion/languages/zig/range-binding.d.ts +37 -0
- package/dist/core/ingestion/languages/zig/range-binding.js +373 -0
- package/dist/core/ingestion/languages/zig/scope-resolver.d.ts +12 -0
- package/dist/core/ingestion/languages/zig/scope-resolver.js +58 -0
- package/dist/core/ingestion/languages/zig/simple-hooks.d.ts +25 -0
- package/dist/core/ingestion/languages/zig/simple-hooks.js +143 -0
- package/dist/core/ingestion/languages/zig.d.ts +32 -0
- package/dist/core/ingestion/languages/zig.js +130 -0
- package/dist/core/ingestion/method-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/method-extractors/configs/zig.js +120 -0
- package/dist/core/ingestion/method-extractors/generic.js +16 -4
- package/dist/core/ingestion/method-types.d.ts +10 -4
- package/dist/core/ingestion/model/field-registry.d.ts +3 -3
- package/dist/core/ingestion/model/field-registry.js +11 -7
- package/dist/core/ingestion/model/method-registry.d.ts +3 -3
- package/dist/core/ingestion/model/method-registry.js +13 -8
- package/dist/core/ingestion/model/registration-table.js +3 -0
- package/dist/core/ingestion/model/type-registry.js +8 -4
- package/dist/core/ingestion/pipeline-phases/di.js +47 -14
- package/dist/core/ingestion/pipeline-phases/index.d.ts +1 -0
- package/dist/core/ingestion/pipeline-phases/index.js +1 -0
- package/dist/core/ingestion/pipeline-phases/parse-impl.d.ts +7 -1
- package/dist/core/ingestion/pipeline-phases/parse-impl.js +79 -91
- package/dist/core/ingestion/pipeline-phases/parse.d.ts +17 -0
- package/dist/core/ingestion/pipeline-phases/processes.d.ts +2 -1
- package/dist/core/ingestion/pipeline-phases/processes.js +39 -4
- package/dist/core/ingestion/pipeline-phases/routes.js +27 -18
- package/dist/core/ingestion/pipeline-phases/runner.d.ts +4 -1
- package/dist/core/ingestion/pipeline-phases/runner.js +34 -14
- package/dist/core/ingestion/pipeline-phases/scan.js +82 -1
- package/dist/core/ingestion/pipeline-phases/spring-auto-configuration.d.ts +2 -0
- package/dist/core/ingestion/pipeline-phases/spring-auto-configuration.js +8 -0
- package/dist/core/ingestion/pipeline-phases/spring-destinations.d.ts +123 -0
- package/dist/core/ingestion/pipeline-phases/spring-destinations.js +688 -0
- package/dist/core/ingestion/pipeline.d.ts +30 -1
- package/dist/core/ingestion/pipeline.js +52 -14
- package/dist/core/ingestion/resolve-references.js +5 -0
- package/dist/core/ingestion/route-extractors/constant-resolver.d.ts +16 -0
- package/dist/core/ingestion/route-extractors/constant-resolver.js +10 -0
- package/dist/core/ingestion/route-extractors/java-const-resolver.d.ts +27 -1
- package/dist/core/ingestion/route-extractors/java-const-resolver.js +161 -13
- package/dist/core/ingestion/route-extractors/kotlin-const-resolver.d.ts +12 -18
- package/dist/core/ingestion/route-extractors/kotlin-const-resolver.js +214 -33
- package/dist/core/ingestion/route-extractors/kotlin-spring.d.ts +13 -0
- package/dist/core/ingestion/route-extractors/kotlin-spring.js +259 -0
- package/dist/core/ingestion/route-extractors/python-decorator-handler.d.ts +6 -0
- package/dist/core/ingestion/route-extractors/python-decorator-handler.js +16 -0
- package/dist/core/ingestion/route-extractors/spring-shared.d.ts +30 -1
- package/dist/core/ingestion/route-extractors/spring-shared.js +77 -9
- package/dist/core/ingestion/route-extractors/spring.js +9 -5
- package/dist/core/ingestion/scope-extractor.js +8 -0
- package/dist/core/ingestion/scope-resolution/contract/scope-resolver.d.ts +62 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.d.ts +4 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/edges.js +2 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/ids.js +28 -0
- package/dist/core/ingestion/scope-resolution/graph-bridge/node-lookup.js +11 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.d.ts +23 -2
- package/dist/core/ingestion/scope-resolution/graph-bridge/references-to-edges.js +24 -3
- package/dist/core/ingestion/scope-resolution/passes/callable-value-flow.d.ts +11 -1
- package/dist/core/ingestion/scope-resolution/passes/callable-value-flow.js +26 -6
- package/dist/core/ingestion/scope-resolution/passes/compound-receiver.d.ts +11 -0
- package/dist/core/ingestion/scope-resolution/passes/compound-receiver.js +29 -3
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.d.ts +8 -1
- package/dist/core/ingestion/scope-resolution/passes/free-call-fallback.js +35 -9
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.d.ts +1 -4
- package/dist/core/ingestion/scope-resolution/passes/receiver-bound-calls.js +277 -9
- package/dist/core/ingestion/scope-resolution/pipeline/registry.js +2 -0
- package/dist/core/ingestion/scope-resolution/pipeline/run.js +7 -3
- package/dist/core/ingestion/scope-resolution/scope/walkers.d.ts +43 -9
- package/dist/core/ingestion/scope-resolution/scope/walkers.js +71 -10
- package/dist/core/ingestion/tree-sitter-queries.d.ts +1 -0
- package/dist/core/ingestion/tree-sitter-queries.js +161 -0
- package/dist/core/ingestion/type-extractors/zig.d.ts +2 -0
- package/dist/core/ingestion/type-extractors/zig.js +17 -0
- package/dist/core/ingestion/utils/ast-helpers.d.ts +40 -1
- package/dist/core/ingestion/utils/ast-helpers.js +124 -6
- package/dist/core/ingestion/utils/callable-flow-captures.d.ts +9 -0
- package/dist/core/ingestion/utils/callable-flow-captures.js +75 -14
- package/dist/core/ingestion/utils/test-file-path.d.ts +28 -0
- package/dist/core/ingestion/utils/test-file-path.js +87 -0
- package/dist/core/ingestion/variable-extractors/configs/zig.d.ts +2 -0
- package/dist/core/ingestion/variable-extractors/configs/zig.js +71 -0
- package/dist/core/ingestion/workers/parse-worker.js +85 -14
- package/dist/core/install-context.d.ts +4 -0
- package/dist/core/install-context.js +152 -0
- package/dist/core/lbug/csv-generator.d.ts +10 -1
- package/dist/core/lbug/csv-generator.js +92 -22
- package/dist/core/lbug/graph-emit-sink.d.ts +3 -2
- package/dist/core/lbug/graph-emit-sink.js +4 -2
- package/dist/core/lbug/lbug-adapter.d.ts +100 -5
- package/dist/core/lbug/lbug-adapter.js +236 -24
- package/dist/core/lbug/schema.d.ts +6 -5
- package/dist/core/lbug/schema.js +84 -22
- package/dist/core/net/url-guard.d.ts +6 -0
- package/dist/core/net/url-guard.js +147 -0
- package/dist/core/package-version.d.ts +5 -0
- package/dist/core/package-version.js +10 -0
- package/dist/core/run-analyze.d.ts +21 -4
- package/dist/core/run-analyze.js +426 -117
- package/dist/core/search/fts-indexes.d.ts +19 -1
- package/dist/core/search/fts-indexes.js +28 -1
- package/dist/core/tree-sitter/parser-loader.js +16 -0
- package/dist/core/update-cache.d.ts +39 -0
- package/dist/core/update-cache.js +141 -0
- package/dist/core/update-check.d.ts +31 -0
- package/dist/core/update-check.js +274 -0
- package/dist/mcp/local/local-backend.d.ts +27 -13
- package/dist/mcp/local/local-backend.js +148 -60
- package/dist/mcp/repository-policy.d.ts +5 -1
- package/dist/mcp/repository-policy.js +48 -4
- package/dist/mcp/resources.js +10 -1
- package/dist/mcp/server.js +8 -9
- package/dist/mcp/tools.js +32 -22
- package/dist/server/analyze-launch.d.ts +2 -0
- package/dist/server/analyze-launch.js +2 -0
- package/dist/server/analyze-worker-protocol.d.ts +6 -1
- package/dist/server/analyze-worker.d.ts +1 -0
- package/dist/server/analyze-worker.js +38 -20
- package/dist/server/api.d.ts +5 -1
- package/dist/server/api.js +105 -88
- package/dist/server/git-clone.d.ts +40 -16
- package/dist/server/git-clone.js +253 -199
- package/dist/server/grep-params.d.ts +18 -0
- package/dist/server/grep-params.js +83 -0
- package/dist/server/grep-scan.d.ts +23 -0
- package/dist/server/grep-scan.js +107 -0
- package/dist/server/grep-worker.d.ts +1 -0
- package/dist/server/grep-worker.js +12 -0
- package/dist/server/mcp-http.d.ts +8 -0
- package/dist/server/mcp-http.js +16 -1
- package/dist/server/update-controller.d.ts +29 -0
- package/dist/server/update-controller.js +82 -0
- package/dist/storage/file-lock.d.ts +15 -0
- package/dist/storage/file-lock.js +155 -0
- package/dist/storage/fs-atomic.d.ts +24 -0
- package/dist/storage/fs-atomic.js +86 -2
- package/dist/storage/global-dir.d.ts +2 -0
- package/dist/storage/global-dir.js +6 -0
- package/dist/storage/parse-cache.d.ts +45 -7
- package/dist/storage/parse-cache.js +189 -42
- package/dist/storage/parsedfile-store.d.ts +41 -60
- package/dist/storage/parsedfile-store.js +247 -171
- package/dist/storage/repo-manager.d.ts +10 -4
- package/dist/storage/repo-manager.js +35 -25
- package/dist/storage/repo-meta.d.ts +34 -0
- package/dist/storage/v8-sidecar.d.ts +48 -0
- package/dist/storage/v8-sidecar.js +347 -0
- package/dist/types/pipeline.d.ts +14 -0
- package/dist/utils/process-identity.d.ts +2 -0
- package/dist/utils/process-identity.js +35 -0
- package/package.json +10 -4
- package/scripts/assert-web-assets.mjs +35 -0
- package/scripts/build-web.js +72 -0
- package/scripts/build.js +31 -28
- package/scripts/cross-platform-tests.ts +5 -0
- package/skills/gitnexus-cli.md +5 -1
- package/web/assets/ProcessFlowModal-DAeX2BHW.js +24 -0
- package/web/assets/{abnfDiagram-QNN2D4NM-Cq2djWWe.js → abnfDiagram-PAR5IXJI-J3OdeHLl.js} +1 -1
- package/web/assets/{agent-BWAXPjC5.js → agent-BMRqXorA.js} +6 -4
- package/web/assets/architecture-7GRP2DOG-M7G3SWCO-G3sWyX6M.js +1 -0
- package/web/assets/architectureDiagram-2PNWDENW-ysKcRlGT.js +36 -0
- package/web/assets/blockDiagram-PUWGUBOA-oLXTa1lY.js +129 -0
- package/web/assets/c4Diagram-3NLNHZP5-D3iu4eC0.js +38 -0
- package/web/assets/{chunk-2SREHG4O-Dip42xOq.js → chunk-2NMSUPJH-B24w-wng.js} +1 -1
- package/web/assets/{chunk-VJFVEZTB-CX66F2ep.js → chunk-32MCUW2P-ByUyt0Sa.js} +3 -3
- package/web/assets/{chunk-4RFN2BYJ-DHHWuC-n.js → chunk-3NPNU5GP-DocZ07Sg.js} +1 -1
- package/web/assets/{chunk-XNMVGMAZ-Cg_LnPtj.js → chunk-3SMGFRGC-CAu4JRLv.js} +1 -1
- package/web/assets/{chunk-W44A43WB-BN8EQc_u.js → chunk-4CAJECRU-DRYMwG9z.js} +1 -1
- package/web/assets/chunk-4OADUZ5Q-CxrSvOwZ.js +10 -0
- package/web/assets/{chunk-DMV4VAQV-Bn6WXDSX.js → chunk-5IQCK5RY-CCMhl4so.js} +2 -2
- package/web/assets/{chunk-RRFMTAIC-CMN0wcYA.js → chunk-5MVFYWFU-Db9KvrYO.js} +1 -1
- package/web/assets/chunk-CLS4B6BI-Uvx5QNsu.js +168 -0
- package/web/assets/chunk-DZP67EKU-B3Mt380j.js +70 -0
- package/web/assets/{chunk-6L755F7B-CMhLBxi2.js → chunk-EICP7K5X-CqwE9hui.js} +1 -1
- package/web/assets/{chunk-BI6VK774-D0oaWk8V.js → chunk-GDY2UAB4-CtQQR0a8.js} +1 -1
- package/web/assets/chunk-H7VHZCWX-CE1nAmt6.js +1 -0
- package/web/assets/chunk-IJBDOHL6-BUKtY6oF.js +1 -0
- package/web/assets/{chunk-OIYT25JQ-CQ6KOZGX.js → chunk-JFFVMJIA-0fJenqia.js} +1 -1
- package/web/assets/{chunk-HNC4WDU7-DoU3KnA7.js → chunk-JZGDI5JK-BeTMSSkJ.js} +1 -1
- package/web/assets/{chunk-EQFTRU2I-1ix7TzW9.js → chunk-KD6SPIPN-Qp1Pflah.js} +1 -1
- package/web/assets/chunk-NF366YI6-CpSpya3n.js +231 -0
- package/web/assets/chunk-NUDPKBEF-CU1-BQIW.js +34 -0
- package/web/assets/{chunk-SATU7PGQ-B1zhgOvc.js → chunk-OJINMHTS-zOCQe4eI.js} +1 -1
- package/web/assets/{chunk-E5QJAATJ-dh-5CtIV.js → chunk-Q6NGPIAH-yyBomb63.js} +1 -1
- package/web/assets/chunk-QJSWEUOL-D_rf9gPD.js +128 -0
- package/web/assets/chunk-R7JDMUKV-CRoqKpD6.js +1 -0
- package/web/assets/{chunk-VE5CLXGZ-C1vB7wpY.js → chunk-RCXAM2GK-CUqrWQDV.js} +1 -1
- package/web/assets/{chunk-66DQ2XMT-CM0xjFAN.js → chunk-RT4MAWR3-zXy9-Lvt.js} +1 -1
- package/web/assets/{chunk-TZUXEDM2-B7p9AcTw.js → chunk-SFMINX4W-J2UrvMpD.js} +1 -1
- package/web/assets/{chunk-LORZLZWG-B57uGw2N.js → chunk-SLDQ463B-CHY6e_bQ.js} +2 -2
- package/web/assets/{chunk-FWYVLQTC-BgDItRzJ.js → chunk-TCEHX7R3-CXPDEVbm.js} +1 -1
- package/web/assets/{chunk-224SPVON-B8gxtXpy.js → chunk-VQC2EELJ-Dc8fIy4R.js} +1 -1
- package/web/assets/chunk-VRZKL3EH-DB3KixTQ.js +1 -0
- package/web/assets/{chunk-A7VWPJGB-B4O3oQdQ.js → chunk-VTHDQ7BV-b7FsPQZO.js} +1 -1
- package/web/assets/chunk-VY2OSTJR-Dkgc3Brg.js +2 -0
- package/web/assets/chunk-WUBWJARI-7FwILJ3k.js +2 -0
- package/web/assets/{chunk-D6VWDJW2-BxcBdZ9c.js → chunk-YBMQ5JGJ-BSnyWZmd.js} +1 -1
- package/web/assets/chunk-YDMLL4PJ-IHhMngTz.js +2 -0
- package/web/assets/chunk-Z6V44ARX-BjCEsF0Q.js +62 -0
- package/web/assets/chunk-ZJJ7VQJP-Dz089b-K.js +321 -0
- package/web/assets/chunk-ZNLK7HRR-B0iFpmW4.js +1 -0
- package/web/assets/chunk-ZQN7UHIL-Cy7KAjQt.js +1 -0
- package/web/assets/{chunk-L5GCOVLC-CE2w8Nm_.js → chunk-ZS6VBONO-DBjJO0w9.js} +2 -2
- package/web/assets/{chunk-NV3KIAZN-5yvcpMiu.js → chunk-ZUNWM646-DNRJyNPe.js} +1 -1
- package/web/assets/classDiagram-FGAMPOII-C5Ibyode.js +1 -0
- package/web/assets/classDiagram-v2-AI5RJEK4-C5Ibyode.js +1 -0
- package/web/assets/{cose-bilkent-RZA4XIPR-BHpK4Crp.js → cose-bilkent-Q72C2OJ3-DMeFXnK8.js} +1 -1
- package/web/assets/cynefin-OW5HDTMX-6OCTWOGG-vlqakYcO.js +1 -0
- package/web/assets/{cynefinDiagram-TR7LZUCG-C3Iar9lZ.js → cynefinDiagram-2OOWUY4M-BY6DZkTt.js} +1 -1
- package/web/assets/dagre-MPVFI544-DWO70fy_.js +4 -0
- package/web/assets/diagram-AE4NWXFW-f7JRVRUL.js +24 -0
- package/web/assets/{diagram-L7DVE3PN-GIRyVUtt.js → diagram-BUJID5UG-BXZv1rCS.js} +2 -2
- package/web/assets/{diagram-JCD7PQ7C-DC5-9FRr.js → diagram-C44CZ5NI-CRNfvjCq.js} +1 -1
- package/web/assets/diagram-EYOLEXXS-DZOjKQVE.js +30 -0
- package/web/assets/diagram-P7B6PWOJ-D3SQmw3_.js +3 -0
- package/web/assets/{ebnfDiagram-DRHRQJWO-D8_CI4ZF.js → ebnfDiagram-FTPZ3PV6-jKWpIDN2.js} +1 -1
- package/web/assets/erDiagram-H3ERR26V-BqJntEuJ.js +99 -0
- package/web/assets/eventmodeling-NTZA5JFV-WKSWQHFS-Bq4FqtBL.js +1 -0
- package/web/assets/flowDiagram-YHGXBVSY-Dnlk2bEu.js +1 -0
- package/web/assets/ganttDiagram-RWFTB7ED-Bl6Y1K5T.js +292 -0
- package/web/assets/gitGraph-4MIJSDKK-JH2HKYUO-B3yc4GkH.js +1 -0
- package/web/assets/gitGraphDiagram-MAR6GKOP-CkNvsrdw.js +106 -0
- package/web/assets/{index-CJDpyH-n.css → index-C2_aej58.css} +1 -1
- package/web/assets/{index-DDRie6_8.js → index-Dj3vQOHK.js} +51 -51
- package/web/assets/info-A6RAGUB7-3TX3OFWW-BM3N5_Dv.js +1 -0
- package/web/assets/infoDiagram-LV547AFH-COkFutAf.js +2 -0
- package/web/assets/{ishikawaDiagram-4JDSWWDM-DmqWtjkl.js → ishikawaDiagram-PUJQGNDS-Bb8FylSR.js} +2 -2
- package/web/assets/{journeyDiagram-QUS3FAKT-XAzVzrQW.js → journeyDiagram-EW5QJT4W-BzoHUBhM.js} +4 -4
- package/web/assets/{kanban-definition-D4L7SQKK-YurRnmYn.js → kanban-definition-JSQERAZB-Uy2Pi0yQ.js} +4 -4
- package/web/assets/katex-CZ4GXH2S-C0Fcou7U.js +257 -0
- package/web/assets/{mindmap-definition-66QP5TD6-ChrWWnil.js → mindmap-definition-VBJCLQLM-B-CnOnt_.js} +3 -3
- package/web/assets/packet-AYTQ26CC-MKII6P3Y-Bd52ZE3V.js +1 -0
- package/web/assets/{pegDiagram-YKIO5C6U-QGeQLEq2.js → pegDiagram-7WILOQTJ-D9sneKXg.js} +1 -1
- package/web/assets/pie-WAS4IAKB-6B4OPMJ5-DW5Xy69Z.js +1 -0
- package/web/assets/pieDiagram-EFA7CBSB-Dx2NQofL.js +39 -0
- package/web/assets/{quadrantDiagram-VO5QLCXA-B7098wSc.js → quadrantDiagram-WARVYA7P-DPKL9_0A.js} +3 -3
- package/web/assets/radar-RG4KPBEZ-UPTR3XUL-CkzibT2h.js +1 -0
- package/web/assets/railroad-74A4TZTK-MEFUPFMS-D9zF-mDN.js +1 -0
- package/web/assets/railroad-abnf-HS5TGJTU-R5YG2S5D-ruacjUbX.js +1 -0
- package/web/assets/railroad-ebnf-LZEXJU2U-G5QEX2L6-S1zc5OiO.js +1 -0
- package/web/assets/railroad-peg-WCYAUIDC-H5I2ZRY2-Cbcr0XzY.js +1 -0
- package/web/assets/{railroadDiagram-M77LTMSB-AXu4vxk_.js → railroadDiagram-5NIQVNLQ-DsweTo14.js} +1 -1
- package/web/assets/{requirementDiagram-RASO5HTO-B-l8InpK.js → requirementDiagram-SXREGOKZ-CXwdNSVR.js} +4 -4
- package/web/assets/{sankeyDiagram-F32LOJ6L-Kd7zjJgX.js → sankeyDiagram-VV74M2VP-CA6jtP9P.js} +3 -3
- package/web/assets/{sequenceDiagram-URATNSBD-BlcdY9DS.js → sequenceDiagram-52ZFIFDL-k_5rEbzm.js} +15 -15
- package/web/assets/src-Df5C1Nz4.js +1 -0
- package/web/assets/stateDiagram-3QAKPIVI-BejHTf31.js +1 -0
- package/web/assets/stateDiagram-v2-HN2P4RDZ-BrfoRuOc.js +1 -0
- package/web/assets/swimlanes-QLVP42QD-CQSVO5D6.js +1 -0
- package/web/assets/swimlanesDiagram-JKPDBFCN-DrWB9kcD.js +8 -0
- package/web/assets/{timeline-definition-WJXWRH4I-DUfp1R3E.js → timeline-definition-GS45XAXW-C0Ks8rPP.js} +4 -4
- package/web/assets/treeView-Q6P3EWNA-ZRJGANNQ-DmKOCo6L.js +1 -0
- package/web/assets/treemap-WGGIJYW6-K64VN5AS-DO3xY92U.js +1 -0
- package/web/assets/{vennDiagram-K3VCMQLI-Bj-FN-XS.js → vennDiagram-QIQU2ZRJ-rgPiS837.js} +3 -3
- package/web/assets/wardley-WFR3VGLG-D67OWCCH-DiDPBNft.js +1 -0
- package/web/assets/wardleyDiagram-U6YNM66N-DRVr7SPi.js +78 -0
- package/web/assets/{xychartDiagram-5VRUVLCW-CK_rbSWE.js → xychartDiagram-XJAZEDNM-COtlZzYb.js} +3 -3
- package/web/index.html +19 -17
- package/web/assets/ProcessFlowModal-Badh2Pbg.js +0 -24
- package/web/assets/architecture-TIHT7OUA-V6N4J3SY-fTePvLoe.js +0 -1
- package/web/assets/architectureDiagram-OT7VKSJ7-mKEXxkeF.js +0 -36
- package/web/assets/blockDiagram-54WLDVWM-Dg_hrRWE.js +0 -132
- package/web/assets/c4Diagram-X2LASM7V-CnhoT4aV.js +0 -10
- package/web/assets/chunk-2AEHWXPW-CV4r6-1I.js +0 -127
- package/web/assets/chunk-5VCL7Z4A-CQ-2dYWj.js +0 -1
- package/web/assets/chunk-6BELYETK-ChsYtfHW.js +0 -1
- package/web/assets/chunk-7CWYLC5S-DRgGkkpF.js +0 -2
- package/web/assets/chunk-7FYTHRHK-CsmYIswB.js +0 -32
- package/web/assets/chunk-KRXBNO2N-C-UNuKKf.js +0 -1
- package/web/assets/chunk-LAHSG3N2-Bz4hcn0N.js +0 -321
- package/web/assets/chunk-LIEV3EAG-pyKGssV3.js +0 -1
- package/web/assets/chunk-NLANEA3F-XpH_NPA5.js +0 -62
- package/web/assets/chunk-PE7DX7ZZ-CCvRVj43.js +0 -10
- package/web/assets/chunk-Q67WD55A-BWCH2SVz.js +0 -156
- package/web/assets/chunk-SZD42YQK-ijyKKVr1.js +0 -70
- package/web/assets/chunk-TFPGFQPA-Dj6a-0pC.js +0 -231
- package/web/assets/chunk-TGVD4F4B-BMc31Gj2.js +0 -2
- package/web/assets/chunk-UAT7B5JY-DW-A_fpI.js +0 -1
- package/web/assets/chunk-VY5UBI4V-yxPQAWxw.js +0 -1
- package/web/assets/chunk-WJBAP47W-BckNkuEN.js +0 -1
- package/web/assets/classDiagram-VPOSVPXH-BjOiXA_C.js +0 -1
- package/web/assets/classDiagram-v2-5VFNUXQA-BjOiXA_C.js +0 -1
- package/web/assets/cynefin-VYW2F7L2-2VAHYKR6-DAsF6GZv.js +0 -1
- package/web/assets/dagre-K64A6Z3X-CUwi79mA.js +0 -4
- package/web/assets/diagram-2TLGJV2N-C2F5Nfym.js +0 -30
- package/web/assets/diagram-KFBZAVDW-Dfmf_4ti.js +0 -3
- package/web/assets/diagram-YP3FGXHI-CyNFYtkd.js +0 -24
- package/web/assets/erDiagram-SZLJLQMB-CohQjznC.js +0 -85
- package/web/assets/eventmodeling-45OFAUF4-AOUJWSLX-BvTc6iQi.js +0 -1
- package/web/assets/flowDiagram-BWE6NHOH-B6RnEvD9.js +0 -1
- package/web/assets/ganttDiagram-2QTCJSNI-Cks_mEcF.js +0 -292
- package/web/assets/gitGraph-TEB2WS4Q-U5VWYIBC-Dy7CCSZ5.js +0 -1
- package/web/assets/gitGraphDiagram-VVZAVV5G-CG41cIVc.js +0 -106
- package/web/assets/info-DKCQHKI2-DX6KST54-BLJg1ikX.js +0 -1
- package/web/assets/infoDiagram-FY4PZKRE-BJ3vPVwW.js +0 -2
- package/web/assets/katex-C5OPUE3Q-Bnbavtmu.js +0 -257
- package/web/assets/packet-7NZHBO7P-5WG45QPS-KUxcuvaA.js +0 -1
- package/web/assets/pie-RZYD4A2V-2OCZ2VTD-DPs08kJY.js +0 -1
- package/web/assets/pieDiagram-YPY3TKG5-BuT3MYzm.js +0 -39
- package/web/assets/radar-I7S5WNFK-EPLSA35B-w5F0K3a7.js +0 -1
- package/web/assets/railroad-3IZDKUUU-PWFQV6Y6-Bu668yqY.js +0 -1
- package/web/assets/railroad-abnf-AHOZXSZD-JYYJX3BS-B6ghpETS.js +0 -1
- package/web/assets/railroad-ebnf-EBAXGLYW-RBZ4ONAP-D-XmHh3M.js +0 -1
- package/web/assets/railroad-peg-LSFZ7HO6-KHNPXGPG-mhkrhzEn.js +0 -1
- package/web/assets/src-C5sx_gMp.js +0 -1
- package/web/assets/stateDiagram-DODFXNG5-DTdHc-fF.js +0 -1
- package/web/assets/stateDiagram-v2-JNMM5JRA-DioNLDDo.js +0 -1
- package/web/assets/swimlanes-OSWOYLSK-CA0ofdwY.js +0 -2
- package/web/assets/swimlanesDiagram-RHGX2RDE-PkwUdckC.js +0 -8
- package/web/assets/treeView-QDETBFTQ-EHYTSQNO-C5lpBgPm.js +0 -1
- package/web/assets/treemap-6X3UGDF4-CCWCF7EK-BB0ZyO-B.js +0 -1
- package/web/assets/wardley-OPB4EBWU-6OWERDVT-CEA3Nq0j.js +0 -1
- package/web/assets/wardleyDiagram-XK6FUAWV-CVV0dHFr.js +0 -78
- /package/web/assets/{sizeCapture-5GORAGP4-BEqQzsxs.js → sizeCapture-FGA5AGYP-BEqQzsxs.js} +0 -0
|
@@ -70,9 +70,10 @@ export declare function namesAtScope(scopeId: ScopeId, scopes: ScopeResolutionIn
|
|
|
70
70
|
* that collapses to `@scope.class` in the scope-extractor query contract.
|
|
71
71
|
*
|
|
72
72
|
* Semantics widened historically from `'Class' | 'Interface'` to cover
|
|
73
|
-
* C#-shape languages (struct, record, enum, trait)
|
|
74
|
-
*
|
|
75
|
-
*
|
|
73
|
+
* C#-shape languages (struct, record, enum, trait) and Zig tagged unions
|
|
74
|
+
* (`union(enum)` containers own methods like structs do). Languages that
|
|
75
|
+
* emit only `'Class'` are unaffected — the extra kinds never appear in
|
|
76
|
+
* their parsed output.
|
|
76
77
|
*/
|
|
77
78
|
export declare function isClassLike(t: string): boolean;
|
|
78
79
|
/**
|
|
@@ -95,12 +96,19 @@ export declare function isClassLike(t: string): boolean;
|
|
|
95
96
|
* `resolveInheritanceBaseInScope` and `resolveQualifiedInheritanceBase` are
|
|
96
97
|
* (2); receiver typing is (1).
|
|
97
98
|
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
99
|
+
* `Union` IS included, via `isClassLike`: Zig wires `union(enum)` as a member
|
|
100
|
+
* container (methods dispatched on a union receiver — see the `main → isEnergy`
|
|
101
|
+
* case in `test/integration/resolvers/zig.test.ts`), so it is a shape. It
|
|
102
|
+
* lives in `isClassLike` because that is the label set the ownership walkers
|
|
103
|
+
* consult, NOT because unions inherit: Zig has no inheritance and its scope
|
|
104
|
+
* resolver supplies no heritage hooks, so a `Union` never has supertypes and
|
|
105
|
+
* its MRO is just itself. C/C++ unions still do not emit `Union` defs on the
|
|
106
|
+
* scope side, so nothing changes for them.
|
|
107
|
+
*
|
|
108
|
+
* NOT YET INCLUDED, deliberately: `Typedef`. It belongs here conceptually but
|
|
109
|
+
* is not wired as a member container today, so adding it would widen a
|
|
110
|
+
* predicate nothing exercises. It joins when its container does, with
|
|
111
|
+
* fixtures.
|
|
104
112
|
*/
|
|
105
113
|
export declare function isShapeLike(t: string): boolean;
|
|
106
114
|
/**
|
|
@@ -507,3 +515,29 @@ export declare function findOwnedMember(ownerDefId: string, memberName: string,
|
|
|
507
515
|
* `findExportedDefByName`, which is dual-channel aware.
|
|
508
516
|
*/
|
|
509
517
|
export declare function findExportedDef(targetFile: string, memberName: string, index: WorkspaceResolutionIndex): SymbolDefinition | undefined;
|
|
518
|
+
/**
|
|
519
|
+
* `findExportedDef`, then — when the target file declares no such local — a
|
|
520
|
+
* name the target file IMPORTED and publishes as its own (a hub module).
|
|
521
|
+
*
|
|
522
|
+
* A Zig hub is a file made only of re-exports: `pub const Terminal =
|
|
523
|
+
* @import("Terminal.zig");`, `pub const Thing = @import("thing.zig").Thing;`.
|
|
524
|
+
* Its module scope owns NO local binding, so `findExportedDef` answers nothing
|
|
525
|
+
* for `terminal.Terminal.init()` or `t: stdx.Thing`, and the finalized channel
|
|
526
|
+
* (`lookupBindingsAt`) is the only place the published names exist — origin
|
|
527
|
+
* `import` / `namespace` / `reexport`, def already resolved to the declaring
|
|
528
|
+
* file. Measured on ghostty (788 Zig files) before and after this helper:
|
|
529
|
+
* CALLS into `src/terminal/` from outside that directory went from 46 to 253;
|
|
530
|
+
* on tigerbeetle, CALLS into its `stdx` hub from outside went from 837 to 1500.
|
|
531
|
+
*
|
|
532
|
+
* Opt-in per provider (`ScopeResolver.namespaceExportsIncludeImportedNames`):
|
|
533
|
+
* in most languages a module's imports are NOT its exports (a TypeScript
|
|
534
|
+
* `import { X }` publishes nothing), and the finalized edge cannot say whether
|
|
535
|
+
* the import was written `pub`. Zig opts in because a hub member a consumer
|
|
536
|
+
* can name through the hub IS public — a private import cannot be reached
|
|
537
|
+
* through the hub in code that compiles.
|
|
538
|
+
*
|
|
539
|
+
* Class-like defs win over anything else bound under the name (a re-exported
|
|
540
|
+
* type over a same-named value), and a name the finalized channel binds to
|
|
541
|
+
* several distinct defs is refused — never guess a namespace member.
|
|
542
|
+
*/
|
|
543
|
+
export declare function findExportedDefIncludingImportedNames(targetFile: string, memberName: string, index: WorkspaceResolutionIndex, scopes: ScopeResolutionIndexes): SymbolDefinition | undefined;
|
|
@@ -153,9 +153,10 @@ export function namesAtScope(scopeId, scopes) {
|
|
|
153
153
|
* that collapses to `@scope.class` in the scope-extractor query contract.
|
|
154
154
|
*
|
|
155
155
|
* Semantics widened historically from `'Class' | 'Interface'` to cover
|
|
156
|
-
* C#-shape languages (struct, record, enum, trait)
|
|
157
|
-
*
|
|
158
|
-
*
|
|
156
|
+
* C#-shape languages (struct, record, enum, trait) and Zig tagged unions
|
|
157
|
+
* (`union(enum)` containers own methods like structs do). Languages that
|
|
158
|
+
* emit only `'Class'` are unaffected — the extra kinds never appear in
|
|
159
|
+
* their parsed output.
|
|
159
160
|
*/
|
|
160
161
|
export function isClassLike(t) {
|
|
161
162
|
return (t === 'Class' ||
|
|
@@ -163,7 +164,8 @@ export function isClassLike(t) {
|
|
|
163
164
|
t === 'Struct' ||
|
|
164
165
|
t === 'Record' ||
|
|
165
166
|
t === 'Enum' ||
|
|
166
|
-
t === 'Trait'
|
|
167
|
+
t === 'Trait' ||
|
|
168
|
+
t === 'Union');
|
|
167
169
|
}
|
|
168
170
|
/**
|
|
169
171
|
* Does this label declare MEMBERS addressable by name?
|
|
@@ -185,12 +187,19 @@ export function isClassLike(t) {
|
|
|
185
187
|
* `resolveInheritanceBaseInScope` and `resolveQualifiedInheritanceBase` are
|
|
186
188
|
* (2); receiver typing is (1).
|
|
187
189
|
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
190
|
+
* `Union` IS included, via `isClassLike`: Zig wires `union(enum)` as a member
|
|
191
|
+
* container (methods dispatched on a union receiver — see the `main → isEnergy`
|
|
192
|
+
* case in `test/integration/resolvers/zig.test.ts`), so it is a shape. It
|
|
193
|
+
* lives in `isClassLike` because that is the label set the ownership walkers
|
|
194
|
+
* consult, NOT because unions inherit: Zig has no inheritance and its scope
|
|
195
|
+
* resolver supplies no heritage hooks, so a `Union` never has supertypes and
|
|
196
|
+
* its MRO is just itself. C/C++ unions still do not emit `Union` defs on the
|
|
197
|
+
* scope side, so nothing changes for them.
|
|
198
|
+
*
|
|
199
|
+
* NOT YET INCLUDED, deliberately: `Typedef`. It belongs here conceptually but
|
|
200
|
+
* is not wired as a member container today, so adding it would widen a
|
|
201
|
+
* predicate nothing exercises. It joins when its container does, with
|
|
202
|
+
* fixtures.
|
|
194
203
|
*/
|
|
195
204
|
export function isShapeLike(t) {
|
|
196
205
|
return isClassLike(t) || t === 'TypeAlias';
|
|
@@ -1916,3 +1925,55 @@ export function findExportedDef(targetFile, memberName, index) {
|
|
|
1916
1925
|
}
|
|
1917
1926
|
return undefined;
|
|
1918
1927
|
}
|
|
1928
|
+
/**
|
|
1929
|
+
* `findExportedDef`, then — when the target file declares no such local — a
|
|
1930
|
+
* name the target file IMPORTED and publishes as its own (a hub module).
|
|
1931
|
+
*
|
|
1932
|
+
* A Zig hub is a file made only of re-exports: `pub const Terminal =
|
|
1933
|
+
* @import("Terminal.zig");`, `pub const Thing = @import("thing.zig").Thing;`.
|
|
1934
|
+
* Its module scope owns NO local binding, so `findExportedDef` answers nothing
|
|
1935
|
+
* for `terminal.Terminal.init()` or `t: stdx.Thing`, and the finalized channel
|
|
1936
|
+
* (`lookupBindingsAt`) is the only place the published names exist — origin
|
|
1937
|
+
* `import` / `namespace` / `reexport`, def already resolved to the declaring
|
|
1938
|
+
* file. Measured on ghostty (788 Zig files) before and after this helper:
|
|
1939
|
+
* CALLS into `src/terminal/` from outside that directory went from 46 to 253;
|
|
1940
|
+
* on tigerbeetle, CALLS into its `stdx` hub from outside went from 837 to 1500.
|
|
1941
|
+
*
|
|
1942
|
+
* Opt-in per provider (`ScopeResolver.namespaceExportsIncludeImportedNames`):
|
|
1943
|
+
* in most languages a module's imports are NOT its exports (a TypeScript
|
|
1944
|
+
* `import { X }` publishes nothing), and the finalized edge cannot say whether
|
|
1945
|
+
* the import was written `pub`. Zig opts in because a hub member a consumer
|
|
1946
|
+
* can name through the hub IS public — a private import cannot be reached
|
|
1947
|
+
* through the hub in code that compiles.
|
|
1948
|
+
*
|
|
1949
|
+
* Class-like defs win over anything else bound under the name (a re-exported
|
|
1950
|
+
* type over a same-named value), and a name the finalized channel binds to
|
|
1951
|
+
* several distinct defs is refused — never guess a namespace member.
|
|
1952
|
+
*/
|
|
1953
|
+
export function findExportedDefIncludingImportedNames(targetFile, memberName, index, scopes) {
|
|
1954
|
+
const local = findExportedDef(targetFile, memberName, index);
|
|
1955
|
+
if (local !== undefined)
|
|
1956
|
+
return local;
|
|
1957
|
+
const moduleScope = index.moduleScopeByFile.get(targetFile);
|
|
1958
|
+
if (moduleScope === undefined)
|
|
1959
|
+
return undefined;
|
|
1960
|
+
let picked;
|
|
1961
|
+
for (const ref of lookupBindingsAt(moduleScope.id, memberName, scopes)) {
|
|
1962
|
+
if (ref.origin !== 'import' && ref.origin !== 'namespace' && ref.origin !== 'reexport')
|
|
1963
|
+
continue;
|
|
1964
|
+
if (picked === undefined) {
|
|
1965
|
+
picked = ref.def;
|
|
1966
|
+
continue;
|
|
1967
|
+
}
|
|
1968
|
+
if (picked.nodeId === ref.def.nodeId)
|
|
1969
|
+
continue;
|
|
1970
|
+
if (isClassLike(ref.def.type) && !isClassLike(picked.type)) {
|
|
1971
|
+
picked = ref.def;
|
|
1972
|
+
continue;
|
|
1973
|
+
}
|
|
1974
|
+
if (isClassLike(picked.type) && !isClassLike(ref.def.type))
|
|
1975
|
+
continue;
|
|
1976
|
+
return undefined; // two distinct defs under one published name → refuse
|
|
1977
|
+
}
|
|
1978
|
+
return picked;
|
|
1979
|
+
}
|
|
@@ -12,5 +12,6 @@ export declare const RUBY_QUERIES = "\n; \u2500\u2500 Modules \u2500\u2500\u2500
|
|
|
12
12
|
export declare const KOTLIN_QUERIES = "\n; \u2500\u2500 Interfaces \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; tree-sitter-kotlin (fwcd) has no interface_declaration node type.\n; Interfaces are class_declaration nodes with an anonymous \"interface\" keyword child.\n(class_declaration\n \"interface\"\n (type_identifier) @name) @definition.interface\n\n; \u2500\u2500 Classes (regular, data, sealed, enum) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; All have the anonymous \"class\" keyword child. enum class has both\n; \"enum\" and \"class\" children \u2014 the \"class\" child still matches.\n(class_declaration\n \"class\"\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Object declarations (Kotlin singletons) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(object_declaration\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Companion objects (named only) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(companion_object\n (type_identifier) @name) @definition.class\n\n; \u2500\u2500 Functions (top-level, member, extension) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_declaration\n (simple_identifier) @name) @definition.function\n\n; \u2500\u2500 Secondary constructors (F49 sibling F48, issue #1919) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; \"constructor(...) { }\" inside a class body is a secondary_constructor with\n; no name child \u2014 its only identity token is the anonymous \"constructor\"\n; keyword, captured here as @name so the node is named \"constructor\"\n; (matching kotlinMethodConfig.extractName). Multiple secondary constructors\n; share that name but get distinct ids via the worker's #<arity> suffix.\n(secondary_constructor\n \"constructor\" @name) @definition.constructor\n\n; \u2500\u2500 Properties \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(property_declaration\n (variable_declaration\n (simple_identifier) @name)) @definition.property\n\n; Lambda bindings: `val f = { x -> x }` binds a CALLABLE, so it emits Function\n; rather than Property, matching TS/JS. This aligns the LABEL only \u2014 call\n; resolution runs off the scope-resolution query, which still models the binding\n; as a value, so `f()` does not resolve here yet. Overlap with the property\n; pattern above is collapsed by the parse-worker dedup (#2687).\n(property_declaration\n (variable_declaration\n (simple_identifier) @name)\n (lambda_literal)) @definition.function\n\n; \u2500\u2500 Destructuring declarations (F51, issue #1919) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; \"val (a, b) = pair\" binds several names through a multi_variable_declaration\n; (NOT a variable_declaration), which the property rule above misses. Emit one\n; @definition.property per bound name \u2014 the SAME label every other Kotlin val/var\n; gets (KOTLIN_QUERIES has no @definition.variable rule, so a single \"val x\"\n; is already a Property; matching that keeps destructured names consistent and\n; out of the block-scope local-symbol pruner that drops Variable/Const/Static).\n; The Kotlin \"_\" discard placeholder is filtered out here via (#not-eq? @name \"_\")\n; \u2014 these locals have no enclosing class, so the field-extractor enrichment path\n; never runs and cannot do the filtering itself. Each rule is a standalone\n; pattern (NOT a top-level [...] alternation), so the predicate is safe under\n; tree-sitter 0.21.1 (no sibling-branch drop). Loop destructuring\n; \"for ((k, v) in m)\" nests the SAME multi_variable_declaration directly under the\n; for_statement (no property_declaration wrapper); the scope-path loop binding only\n; handles the single variable_declaration form, so this rule does not double-emit.\n((property_declaration\n (multi_variable_declaration\n (variable_declaration\n (simple_identifier) @name))) @definition.property\n (#not-eq? @name \"_\"))\n\n((for_statement\n (multi_variable_declaration\n (variable_declaration\n (simple_identifier) @name))) @definition.property\n (#not-eq? @name \"_\"))\n\n; Primary constructor val/var parameters (data class, value class, regular class)\n; binding_pattern_kind contains \"val\" or \"var\" \u2014 without it, the param is not a property\n(class_parameter\n (binding_pattern_kind)\n (simple_identifier) @name) @definition.property\n\n; \u2500\u2500 Enum entries \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(enum_entry\n (simple_identifier) @name) @definition.enum\n\n; \u2500\u2500 Type aliases \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(type_alias\n (type_identifier) @name) @definition.type\n\n; \u2500\u2500 Imports \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(import_header\n (identifier) @import.source) @import\n\n; \u2500\u2500 Function calls (direct) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n (simple_identifier) @call.name) @call\n\n; \u2500\u2500 Method calls (via navigation: obj.method()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(call_expression\n (navigation_expression\n (navigation_suffix\n (simple_identifier) @call.name))) @call\n\n; \u2500\u2500 Constructor invocations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(constructor_invocation\n (user_type\n (type_identifier) @call.name)) @call\n\n; \u2500\u2500 Infix function calls (e.g., a to b, x until y) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; tree-sitter-kotlin models infix_expression as three UNNAMED-FIELD children:\n; (operand) (operator) (operand) \u2014 all three are simple_identifier for\n; \"a to b\". The old rule \"(infix_expression (simple_identifier) @call.name)\"\n; matched EVERY simple_identifier child, so it captured the operands a/b as\n; spurious @call.name calls (F49, issue #1919). There is no operator: field to\n; anchor on, so anchor positionally: the operator is the middle child, flanked\n; by an operand on each side. End-anchored on both sides so only the lone\n; middle simple_identifier (the infix function) is captured; chained\n; \"a to b to c\" still matches each nested infix_expression's own operator.\n(infix_expression\n .\n (_)\n .\n (simple_identifier) @call.name\n .\n (_)\n .) @call\n\n; Write access: obj.field = value\n(assignment\n (directly_assignable_expression\n (_) @assignment.receiver\n (navigation_suffix\n (simple_identifier) @assignment.property))\n (_)) @assignment\n\n";
|
|
13
13
|
export declare const SWIFT_QUERIES = "\n; Classes\n(class_declaration \"class\" name: (type_identifier) @name) @definition.class\n\n; Structs\n(class_declaration \"struct\" name: (type_identifier) @name) @definition.struct\n\n; Enums\n(class_declaration \"enum\" name: (type_identifier) @name) @definition.enum\n\n; Extensions (mapped to class \u2014 no dedicated label in schema)\n(class_declaration \"extension\" name: (user_type (type_identifier) @name)) @definition.class\n\n; Actors\n(class_declaration \"actor\" name: (type_identifier) @name) @definition.class\n\n; Protocols (mapped to interface)\n(protocol_declaration name: (type_identifier) @name) @definition.interface\n\n; Type aliases\n(typealias_declaration name: (type_identifier) @name) @definition.type\n\n; Functions (top-level and methods)\n(function_declaration name: (simple_identifier) @name) @definition.function\n\n; Protocol method declarations\n(protocol_function_declaration name: (simple_identifier) @name) @definition.method\n\n; Initializers\n(init_declaration) @definition.constructor\n\n; Properties (stored and computed)\n(property_declaration (pattern (simple_identifier) @name)) @definition.property\n\n; Closure bindings: `let f = { ... }` binds a CALLABLE, so it emits Function\n; rather than Property, matching TS/JS. This aligns the LABEL only \u2014 call\n; resolution runs off the scope-resolution query, which still models the binding\n; as a value, so `f()` does not resolve here yet. Overlap with the property\n; pattern above is collapsed by the parse-worker dedup (#2687).\n(property_declaration\n name: (pattern (simple_identifier) @name)\n value: (lambda_literal)) @definition.function\n\n; Protocol property requirements (F75): \"var title: String { get }\" parses to a\n; protocol_property_declaration (NOT property_declaration). Its name is a\n; \"name:\" pattern field wrapping a value_binding_pattern + the bound\n; simple_identifier; match the inner identifier so the requirement is emitted\n; as a property symbol of the protocol.\n(protocol_property_declaration (pattern (simple_identifier) @name)) @definition.property\n\n; Enum cases\n(enum_entry (simple_identifier) @name) @definition.property\n\n; Imports\n(import_declaration (identifier (simple_identifier) @import.source)) @import\n\n; Calls - direct function calls\n(call_expression (simple_identifier) @call.name) @call\n\n; Calls - member/navigation calls (obj.method())\n(call_expression (navigation_expression (navigation_suffix (simple_identifier) @call.name))) @call\n\n; Write access: obj.field = value (tree-sitter-swift 0.7.1 uses named fields)\n(assignment\n target: (directly_assignable_expression\n (navigation_expression\n target: (_) @assignment.receiver\n suffix: (navigation_suffix\n suffix: (simple_identifier) @assignment.property)))\n result: (_)) @assignment\n\n";
|
|
14
14
|
export declare const DART_QUERIES = "\n; \u2500\u2500 Classes \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(class_definition\n name: (identifier) @name) @definition.class\n\n; \u2500\u2500 Mixins \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(mixin_declaration\n (identifier) @name) @definition.trait\n\n; \u2500\u2500 Extensions \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(extension_declaration\n name: (identifier) @name) @definition.class\n\n; \u2500\u2500 Enums \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(enum_declaration\n name: (identifier) @name) @definition.enum\n\n; \u2500\u2500 Type aliases \u2014 new-style (typedef Pred = bool Function(int);) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Anchor \"=\" after the name to avoid capturing the RHS type. The name is the\n; first type_identifier (the alias), the RHS function_type follows the \"=\".\n(type_alias\n (type_identifier) @name\n \"=\") @definition.type\n\n; \u2500\u2500 Type aliases \u2014 old-style (typedef int Cmp(int a, int b);) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; The old-style function typedef has NO \"=\" \u2014 it parses as a type_alias whose\n; children are: return type_identifier, NAME type_identifier, formal_parameter_list.\n; Anchor @name as the type_identifier immediately before the parameter list so we\n; capture the alias name (Cmp), not the leading return type (int).\n(type_alias\n (type_identifier) @name\n .\n (formal_parameter_list)) @definition.type\n\n; \u2500\u2500 Type aliases \u2014 generic old-style (typedef int Cmp<T>(T a, T b);) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; #1919 review CF2: a generic <T> inserts a type_parameters node between the\n; NAME and the parameter list, so the non-generic adjacency above misses it.\n; Standalone pattern (NOT an alternation arm) anchoring @name immediately before\n; type_parameters, which is immediately before the parameter list. The new-style\n; \"=\" rule above is unanchored and already covers generic new-style (Mapper<T>).\n(type_alias\n (type_identifier) @name\n .\n (type_parameters)\n .\n (formal_parameter_list)) @definition.type\n\n; \u2500\u2500 Top-level functions (parent is program, not method_signature) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(program\n (function_signature\n name: (identifier) @name) @definition.function)\n\n; \u2500\u2500 Abstract method declarations (function_signature inside class body declaration) \u2500\u2500\n(declaration\n (function_signature\n name: (identifier) @name)) @definition.method\n\n; \u2500\u2500 Methods (inside class/mixin/extension bodies) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(method_signature\n (function_signature\n name: (identifier) @name)) @definition.method\n\n; \u2500\u2500 Constructors \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(constructor_signature\n name: (identifier) @name) @definition.constructor\n\n; \u2500\u2500 Factory constructors (anchor before param list to capture variant name, not class) \u2500\u2500\n(method_signature\n (factory_constructor_signature\n (identifier) @name . (formal_parameter_list))) @definition.constructor\n\n; \u2500\u2500 Field declarations (String name = '', Address address = Address()) \u2500\u2500\u2500\u2500\u2500\u2500\n(declaration\n (type_identifier)\n (initialized_identifier_list\n (initialized_identifier\n (identifier) @name))) @definition.property\n\n; \u2500\u2500 Nullable field declarations (String? name) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(declaration\n (nullable_type)\n (initialized_identifier_list\n (initialized_identifier\n (identifier) @name))) @definition.property\n\n; \u2500\u2500 static const / static final / const class fields \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; A \"static const a = 1;\" / \"static final String b = ..., c = ...;\" field parses\n; with a static_final_declaration_list (NOT an initialized_identifier_list), so\n; the field rules above miss them. One @name per static_final_declaration, so a\n; multi-name declaration yields a Property per name. Anchored on declaration (not\n; class_body) so top-level final/const variables \u2014 whose\n; static_final_declaration_list is a direct child of program, not wrapped in a\n; declaration \u2014 never match here.\n(declaration\n (static_final_declaration_list\n (static_final_declaration\n (identifier) @name))) @definition.property\n\n; \u2500\u2500 Getters \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(method_signature\n (getter_signature\n name: (identifier) @name)) @definition.property\n\n; \u2500\u2500 Setters \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(method_signature\n (setter_signature\n name: (identifier) @name)) @definition.property\n\n; \u2500\u2500 Top-level variable declarations \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Top-level Dart variables are NOT wrapped in a declaration node (that wrapper\n; only occurs for class-body members). They sit as loose siblings under program:\n; var name = 'x'; int x = 5; \u2192 initialized_identifier_list\n; final int count = 3; const a = 1, b = 2; \u2192 static_final_declaration_list\n; Anchor both rules under (program) so class-body fields (which reuse the same\n; inner node types) are never matched here. One @name per declared name so\n; multi-name forms (const a = 1, b = 2;) yield a Variable per name.\n(program\n (initialized_identifier_list\n (initialized_identifier\n (identifier) @name)) @definition.variable)\n; Closure bindings: `var f = (x) => x;` binds a CALLABLE, so it emits Function\n; rather than Variable, matching TS/JS. Overlap with the pattern above is\n; collapsed by the parse-worker dedup (#2687). Since #2693 this node is also\n; what makes `f()` resolve: the scope-resolution query declares the binding as\n; a value, and callable-value-flow admits it as a call target precisely because\n; the node it resolves to is a Function.\n(program\n (initialized_identifier_list\n (initialized_identifier\n (identifier) @name\n (function_expression))) @definition.function)\n\n; \u2500\u2500 Top-level final/const closure bindings (#2693) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; `final handler = (x) => x;` parses as a static_final_declaration_list, not an\n; initialized_identifier_list, so the rules above never reach it \u2014 `final` is\n; the idiomatic top-level binding keyword and was the one closure form getting\n; neither the callable label nor resolution.\n(program\n (static_final_declaration_list\n (static_final_declaration\n (identifier) @name\n (function_expression))) @definition.function)\n\n; \u2500\u2500 Function-local closure bindings (#2693) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; `void m() { var f = (x) => x; }` \u2014 locals parse as initialized_variable_\n; definition, which the top-level rules above never reach, so a local closure\n; had no graph node at all and `f()` could not resolve. Restricted to a\n; function_expression value: ordinary locals stay unindexed, as before.\n(initialized_variable_definition\n name: (identifier) @name\n value: (function_expression)) @definition.function\n\n; Second and later declarators of a multi-name local (`var f = .., g = ..;`)\n; are initialized_identifier children NESTED INSIDE the same\n; initialized_variable_definition, which the `name:`/`value:` field rule above\n; only reaches for the FIRST name \u2014 so `g` silently had no node. Anchored on the\n; inner node so each name gets its own range; the top-level form lives under\n; initialized_identifier_list instead, so these never double-match.\n(initialized_variable_definition\n (initialized_identifier\n (identifier) @name\n (function_expression)) @definition.function)\n(program\n (static_final_declaration_list\n (static_final_declaration\n (identifier) @name)) @definition.variable)\n\n; \u2500\u2500 Imports \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(import_or_export\n (library_import\n (import_specification\n (configurable_uri) @import.source))) @import\n\n; \u2500\u2500 Calls: direct function/constructor calls (identifier immediately before argument_part) \u2500\u2500\n(expression_statement\n (identifier) @call.name\n .\n (selector (argument_part))) @call\n\n; \u2500\u2500 Calls: method calls (obj.method()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(expression_statement\n (selector\n (unconditional_assignable_selector\n (identifier) @call.name))) @call\n\n; \u2500\u2500 Calls: in return statements (return User()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(return_statement\n (identifier) @call.name\n (selector (argument_part))) @call\n\n; \u2500\u2500 Calls: in variable assignments (var x = getUser()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(initialized_variable_definition\n value: (identifier) @call.name\n (selector (argument_part))) @call\n\n; \u2500\u2500 Calls: member calls in variable assignments (var x = obj.method()) \u2500\u2500\u2500\u2500\u2500\u2500\n(initialized_variable_definition\n (selector\n (unconditional_assignable_selector\n (identifier) @call.name))\n (selector (argument_part))) @call\n\n; \u2500\u2500 Calls: await direct (await doSomething()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(await_expression\n (identifier) @call.name\n .\n (selector (argument_part))) @call\n\n; \u2500\u2500 Calls: await method chain (await obj.method()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Requires argument_part to distinguish method calls from field access (await obj.field)\n(await_expression\n (selector\n (unconditional_assignable_selector\n (identifier) @call.name))\n (selector (argument_part))) @call\n\n; \u2500\u2500 Calls: named argument (foo(child: buildX())) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(named_argument\n (identifier) @call.name\n .\n (selector (argument_part))) @call\n\n; \u2500\u2500 Calls: inside list literals ([buildA(), buildB()]) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(list_literal\n (identifier) @call.name\n .\n (selector (argument_part))) @call\n\n; \u2500\u2500 Calls: cascade (obj..add(x)..sort()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n; Note: cascade_selector contains identifier directly (no unconditional_assignable_selector\n; wrapper in Dart grammar), so inferCallForm() classifies these as free calls rather than\n; member calls. Cross-file resolution still benefits from the call being recorded.\n(cascade_section\n (cascade_selector (identifier) @call.name)\n (argument_part)) @call\n\n; \u2500\u2500 Calls: static final field initializers (static final _svc = MyService()) \u2500\u2500\n(static_final_declaration\n (identifier) @call.name\n .\n (selector (argument_part))) @call\n\n; \u2500\u2500 Calls: arrow function body (=> buildWidget()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_body \"=>\"\n (identifier) @call.name\n .\n (selector (argument_part))) @call\n\n; \u2500\u2500 Calls: lambda body (() => doSomething()) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(function_expression_body\n (identifier) @call.name\n .\n (selector (argument_part))) @call\n\n; \u2500\u2500 Re-exports (export 'foo.dart') \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(import_or_export\n (library_export\n (configurable_uri) @import.source)) @import\n\n; \u2500\u2500 Write access: obj.field = value \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(assignment_expression\n left: (assignable_expression\n (identifier) @assignment.receiver\n (unconditional_assignable_selector\n (identifier) @assignment.property))\n right: (_)) @assignment\n\n; \u2500\u2500 Write access: this.field = value \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n(assignment_expression\n left: (assignable_expression\n (this) @assignment.receiver\n (unconditional_assignable_selector\n (identifier) @assignment.property))\n right: (_)) @assignment\n";
|
|
15
|
+
export declare const ZIG_QUERIES = "\n; Functions (top-level + methods inside struct/enum/union containers)\n(function_declaration\n name: (identifier) @name) @definition.function\n\n; Struct: const Foo = struct { ... }\n(variable_declaration\n (identifier) @name\n (struct_declaration)) @definition.struct\n\n; Enum: const Foo = enum { ... }\n(variable_declaration\n (identifier) @name\n (enum_declaration)) @definition.enum\n\n; Union: const Foo = union { ... } (and tagged-union union(enum) { ... })\n(variable_declaration\n (identifier) @name\n (union_declaration)) @definition.union\n\n; File-struct: a file whose top level declares a container field IS a struct\n; named after the file (`Page.zig` declares `Page`; `@typeName` agrees).\n; The anchor is the whole file; the name comes from the class extractor\n; (`zigContainerName(source_file, filePath)` \u2014 the file stem), not from a\n; capture, since no node spells it. One match per top-level field \u2014 the\n; definition phase dedupes by (node, name). Namespace-only files (no fields)\n; never match and keep their Function ids.\n((source_file (container_field name: (identifier) @_field)) @definition.struct\n (#not-eq? @_field \"\"))\n; A FIELDLESS file-struct \u2014 `Empty.zig`: no field, but a top-level fn whose\n; first parameter is typed as the file's own type (`self: *@This()`, or\n; `self: *Self` beside `const Self = @This();`). Zero-sized types are still\n; constructed (`Empty{}`) and dispatched on, and keyed on fields alone the\n; file lost its Struct node and every `e.ping()` edge (PR #1432 review,\n; 8.12). The two rules over-match on purpose \u2014 any `@This` in a first\n; parameter, any top-level `@This()` alias \u2014 and the provider's\n; `shouldSkipDefinitionCapture` keeps only what `isZigFileStruct` (the\n; single predicate the owner walk and the scope side use) admits.\n((source_file (function_declaration (parameters . (parameter type: (_) @_recv))))\n @definition.struct\n (#match? @_recv \"@This\"))\n((source_file (variable_declaration (identifier) (builtin_function (builtin_identifier) @_this)))\n @definition.struct\n (#eq? @_this \"@This\"))\n\n; Opaque: const Handle = opaque { ... } \u2014 the FFI handle type. It is a\n; container (it may declare methods, never fields), so it is labelled Struct:\n; the owner of a HAS_METHOD edge must be class-like, and there is no closer\n; label. It is NOT a TypeAlias \u2014 an opaque type is a distinct nominal type,\n; deliberately incompatible with whatever it wraps.\n(variable_declaration\n (identifier) @name\n (opaque_declaration)) @definition.struct\n\n; Generic type constructors: `pub fn List(comptime T: type) type { return\n; struct { \u2026 }; }` \u2014 Zig's only spelling of a generic type. The returned\n; container is anonymous in the grammar; the definition anchor is the\n; container node and its name is the enclosing function's (`List`), which\n; is what every caller writes (`List(u8)`). Only the direct `return\n; <container>` of a fn whose return type is `type` qualifies (see\n; `zigTypeConstructorOf`). The Function node `List` coexists: `List` is\n; both a callable and a type.\n((function_declaration\n name: (identifier) @name\n type: (builtin_type) @_ret\n body: (block (expression_statement (return_expression\n (struct_declaration) @definition.struct))))\n (#eq? @_ret \"type\"))\n((function_declaration\n name: (identifier) @name\n type: (builtin_type) @_ret\n body: (block (expression_statement (return_expression\n (union_declaration) @definition.union))))\n (#eq? @_ret \"type\"))\n((function_declaration\n name: (identifier) @name\n type: (builtin_type) @_ret\n body: (block (expression_statement (return_expression\n (enum_declaration) @definition.enum))))\n (#eq? @_ret \"type\"))\n\n; Function-local and anonymous containers (F8): `fn string() { const R =\n; struct { fn get \u2026 }; }` (Lightpanda's reflection.zig declares one `R` per\n; builder fn), `std.sort.pdq(T, items, {}, struct { fn lessThan \u2026 }.lessThan)`,\n; `const cmp = struct { fn lt \u2026 }.lt;`, a field typed `?struct { min: u32 }`.\n; No name child spells their identity, so these rules match EVERY container\n; and the class extractor names the node from `zigContainerName` (`string$R`,\n; `build$1`) \u2014 the same function the owner walk uses for their fns, which\n; were ownerless, colliding Methods before. The bound shapes above match too;\n; the provider's `shouldSkipDefinitionCapture` keeps exactly one rule per\n; container (`zigContainerAnchor`).\n(struct_declaration) @definition.struct\n(enum_declaration) @definition.enum\n(union_declaration) @definition.union\n(opaque_declaration) @definition.struct\n\n; Container fields (struct fields, enum variants, union variants) \u2014 all are\n; `container_field` in the grammar and all become Property (C labels its\n; enumerators Const; Rust captures no variants; Zig's own vocabulary is\n; \"field\" for all three, so one label keeps the query honest).\n; #not-eq? guard: tree-sitter-zig 1.1.2 recovers an EMPTY container body\n; (`struct {}`, `opaque {}`) as a container_field whose identifier is a\n; zero-width MISSING placeholder \u2014 a parser artefact, not a field, and\n; without the guard it minted a Property with an empty name.\n((container_field\n name: (identifier) @name) @definition.property\n (#not-eq? @name \"\"))\n\n; Named tests: test \"description\" { ... }. The name is the string node WITH\n; its quotes, so `test \"add\"` next to `fn add` (the idiomatic layout) does\n; not collide on Function:<file>:add. Anonymous `test {}` and decl-tests\n; `test add {}` have no name of their own and are not graph nodes; their\n; bodies' calls attribute to the File.\n(test_declaration\n (string) @name) @definition.function\n\n; const / var bindings that are neither a container nor an @import (those two\n; are skipped by the provider's `shouldSkipDefinitionCapture` so the Struct /\n; import binding is the only node for that name). The literal keyword is\n; load-bearing: tree-sitter-zig 1.1.2 parses statement assignments (`x = 5;`,\n; `x += 1;`, `_ = expr;`) as `variable_declaration` WITHOUT a keyword\n; child, and a keyword-less rule would mint a Const per assignment and a\n; Variable named `_` per discard.\n(variable_declaration\n \"const\" . (identifier) @name) @definition.const\n(variable_declaration\n \"var\" . (identifier) @name) @definition.variable\n\n; @import(\"path\") \u2014 capture the string argument as @import.source, in\n; EVERY position: the value of a const/var (`const std = @import(\"std\")`),\n; a member chain (`const X = @import(\"x.zig\").X`), `pub usingnamespace\n; @import(\"path\")`, a tuple element (`pub const Interfaces = .{\n; @import(\"a.zig\"), @import(\"b.zig\") }`), a call argument, a comparison\n; operand, the receiver of a member call (`try @import(\"dump.zig\").root(...)`).\n; Zig has no import statement \u2014 the builtin IS the import, wherever it sits,\n; and every occurrence is a file dependency. The #eq? predicate keeps the\n; other builtins (@sizeOf, @TypeOf, @as, \u2026) out. One rule, one match per\n; builtin: the structure phase only skips import matches (IMPORTS edges come\n; from the scope phase \u2014 `emitZigScopeCaptures`, whose `@import.inline`\n; rule is this rule's twin, decides which occurrences bind a name).\n((builtin_function\n (builtin_identifier) @builtin\n (arguments\n (string) @import.source))\n (#eq? @builtin \"@import\")) @import\n\n; Free calls: foo(...)\n(call_expression\n function: (identifier) @call.name) @call\n\n; Member calls: obj.method(...) and namespace.fn(...) (e.g. std.debug.print).\n(call_expression\n function: (field_expression\n member: (identifier) @call.name)) @call\n";
|
|
15
16
|
import { SupportedLanguages } from '../../_shared/index.js';
|
|
16
17
|
export declare const LANGUAGE_QUERIES: Record<SupportedLanguages, string>;
|
|
@@ -2431,6 +2431,166 @@ export const DART_QUERIES = `
|
|
|
2431
2431
|
(identifier) @assignment.property))
|
|
2432
2432
|
right: (_)) @assignment
|
|
2433
2433
|
`;
|
|
2434
|
+
// ── Zig ──────────────────────────────────────────────────────────────────────
|
|
2435
|
+
// Verified against @tree-sitter-grammars/tree-sitter-zig 1.1.2.
|
|
2436
|
+
// Container declarations (struct/enum/union) are anonymous in the grammar; the
|
|
2437
|
+
// binding name lives on the parent variable_declaration's first identifier
|
|
2438
|
+
// child. Heritage queries are intentionally absent — Zig has no inheritance.
|
|
2439
|
+
export const ZIG_QUERIES = `
|
|
2440
|
+
; Functions (top-level + methods inside struct/enum/union containers)
|
|
2441
|
+
(function_declaration
|
|
2442
|
+
name: (identifier) @name) @definition.function
|
|
2443
|
+
|
|
2444
|
+
; Struct: const Foo = struct { ... }
|
|
2445
|
+
(variable_declaration
|
|
2446
|
+
(identifier) @name
|
|
2447
|
+
(struct_declaration)) @definition.struct
|
|
2448
|
+
|
|
2449
|
+
; Enum: const Foo = enum { ... }
|
|
2450
|
+
(variable_declaration
|
|
2451
|
+
(identifier) @name
|
|
2452
|
+
(enum_declaration)) @definition.enum
|
|
2453
|
+
|
|
2454
|
+
; Union: const Foo = union { ... } (and tagged-union union(enum) { ... })
|
|
2455
|
+
(variable_declaration
|
|
2456
|
+
(identifier) @name
|
|
2457
|
+
(union_declaration)) @definition.union
|
|
2458
|
+
|
|
2459
|
+
; File-struct: a file whose top level declares a container field IS a struct
|
|
2460
|
+
; named after the file (\`Page.zig\` declares \`Page\`; \`@typeName\` agrees).
|
|
2461
|
+
; The anchor is the whole file; the name comes from the class extractor
|
|
2462
|
+
; (\`zigContainerName(source_file, filePath)\` — the file stem), not from a
|
|
2463
|
+
; capture, since no node spells it. One match per top-level field — the
|
|
2464
|
+
; definition phase dedupes by (node, name). Namespace-only files (no fields)
|
|
2465
|
+
; never match and keep their Function ids.
|
|
2466
|
+
((source_file (container_field name: (identifier) @_field)) @definition.struct
|
|
2467
|
+
(#not-eq? @_field ""))
|
|
2468
|
+
; A FIELDLESS file-struct — \`Empty.zig\`: no field, but a top-level fn whose
|
|
2469
|
+
; first parameter is typed as the file's own type (\`self: *@This()\`, or
|
|
2470
|
+
; \`self: *Self\` beside \`const Self = @This();\`). Zero-sized types are still
|
|
2471
|
+
; constructed (\`Empty{}\`) and dispatched on, and keyed on fields alone the
|
|
2472
|
+
; file lost its Struct node and every \`e.ping()\` edge (PR #1432 review,
|
|
2473
|
+
; 8.12). The two rules over-match on purpose — any \`@This\` in a first
|
|
2474
|
+
; parameter, any top-level \`@This()\` alias — and the provider's
|
|
2475
|
+
; \`shouldSkipDefinitionCapture\` keeps only what \`isZigFileStruct\` (the
|
|
2476
|
+
; single predicate the owner walk and the scope side use) admits.
|
|
2477
|
+
((source_file (function_declaration (parameters . (parameter type: (_) @_recv))))
|
|
2478
|
+
@definition.struct
|
|
2479
|
+
(#match? @_recv "@This"))
|
|
2480
|
+
((source_file (variable_declaration (identifier) (builtin_function (builtin_identifier) @_this)))
|
|
2481
|
+
@definition.struct
|
|
2482
|
+
(#eq? @_this "@This"))
|
|
2483
|
+
|
|
2484
|
+
; Opaque: const Handle = opaque { ... } — the FFI handle type. It is a
|
|
2485
|
+
; container (it may declare methods, never fields), so it is labelled Struct:
|
|
2486
|
+
; the owner of a HAS_METHOD edge must be class-like, and there is no closer
|
|
2487
|
+
; label. It is NOT a TypeAlias — an opaque type is a distinct nominal type,
|
|
2488
|
+
; deliberately incompatible with whatever it wraps.
|
|
2489
|
+
(variable_declaration
|
|
2490
|
+
(identifier) @name
|
|
2491
|
+
(opaque_declaration)) @definition.struct
|
|
2492
|
+
|
|
2493
|
+
; Generic type constructors: \`pub fn List(comptime T: type) type { return
|
|
2494
|
+
; struct { … }; }\` — Zig's only spelling of a generic type. The returned
|
|
2495
|
+
; container is anonymous in the grammar; the definition anchor is the
|
|
2496
|
+
; container node and its name is the enclosing function's (\`List\`), which
|
|
2497
|
+
; is what every caller writes (\`List(u8)\`). Only the direct \`return
|
|
2498
|
+
; <container>\` of a fn whose return type is \`type\` qualifies (see
|
|
2499
|
+
; \`zigTypeConstructorOf\`). The Function node \`List\` coexists: \`List\` is
|
|
2500
|
+
; both a callable and a type.
|
|
2501
|
+
((function_declaration
|
|
2502
|
+
name: (identifier) @name
|
|
2503
|
+
type: (builtin_type) @_ret
|
|
2504
|
+
body: (block (expression_statement (return_expression
|
|
2505
|
+
(struct_declaration) @definition.struct))))
|
|
2506
|
+
(#eq? @_ret "type"))
|
|
2507
|
+
((function_declaration
|
|
2508
|
+
name: (identifier) @name
|
|
2509
|
+
type: (builtin_type) @_ret
|
|
2510
|
+
body: (block (expression_statement (return_expression
|
|
2511
|
+
(union_declaration) @definition.union))))
|
|
2512
|
+
(#eq? @_ret "type"))
|
|
2513
|
+
((function_declaration
|
|
2514
|
+
name: (identifier) @name
|
|
2515
|
+
type: (builtin_type) @_ret
|
|
2516
|
+
body: (block (expression_statement (return_expression
|
|
2517
|
+
(enum_declaration) @definition.enum))))
|
|
2518
|
+
(#eq? @_ret "type"))
|
|
2519
|
+
|
|
2520
|
+
; Function-local and anonymous containers (F8): \`fn string() { const R =
|
|
2521
|
+
; struct { fn get … }; }\` (Lightpanda's reflection.zig declares one \`R\` per
|
|
2522
|
+
; builder fn), \`std.sort.pdq(T, items, {}, struct { fn lessThan … }.lessThan)\`,
|
|
2523
|
+
; \`const cmp = struct { fn lt … }.lt;\`, a field typed \`?struct { min: u32 }\`.
|
|
2524
|
+
; No name child spells their identity, so these rules match EVERY container
|
|
2525
|
+
; and the class extractor names the node from \`zigContainerName\` (\`string$R\`,
|
|
2526
|
+
; \`build$1\`) — the same function the owner walk uses for their fns, which
|
|
2527
|
+
; were ownerless, colliding Methods before. The bound shapes above match too;
|
|
2528
|
+
; the provider's \`shouldSkipDefinitionCapture\` keeps exactly one rule per
|
|
2529
|
+
; container (\`zigContainerAnchor\`).
|
|
2530
|
+
(struct_declaration) @definition.struct
|
|
2531
|
+
(enum_declaration) @definition.enum
|
|
2532
|
+
(union_declaration) @definition.union
|
|
2533
|
+
(opaque_declaration) @definition.struct
|
|
2534
|
+
|
|
2535
|
+
; Container fields (struct fields, enum variants, union variants) — all are
|
|
2536
|
+
; \`container_field\` in the grammar and all become Property (C labels its
|
|
2537
|
+
; enumerators Const; Rust captures no variants; Zig's own vocabulary is
|
|
2538
|
+
; "field" for all three, so one label keeps the query honest).
|
|
2539
|
+
; #not-eq? guard: tree-sitter-zig 1.1.2 recovers an EMPTY container body
|
|
2540
|
+
; (\`struct {}\`, \`opaque {}\`) as a container_field whose identifier is a
|
|
2541
|
+
; zero-width MISSING placeholder — a parser artefact, not a field, and
|
|
2542
|
+
; without the guard it minted a Property with an empty name.
|
|
2543
|
+
((container_field
|
|
2544
|
+
name: (identifier) @name) @definition.property
|
|
2545
|
+
(#not-eq? @name ""))
|
|
2546
|
+
|
|
2547
|
+
; Named tests: test "description" { ... }. The name is the string node WITH
|
|
2548
|
+
; its quotes, so \`test "add"\` next to \`fn add\` (the idiomatic layout) does
|
|
2549
|
+
; not collide on Function:<file>:add. Anonymous \`test {}\` and decl-tests
|
|
2550
|
+
; \`test add {}\` have no name of their own and are not graph nodes; their
|
|
2551
|
+
; bodies' calls attribute to the File.
|
|
2552
|
+
(test_declaration
|
|
2553
|
+
(string) @name) @definition.function
|
|
2554
|
+
|
|
2555
|
+
; const / var bindings that are neither a container nor an @import (those two
|
|
2556
|
+
; are skipped by the provider's \`shouldSkipDefinitionCapture\` so the Struct /
|
|
2557
|
+
; import binding is the only node for that name). The literal keyword is
|
|
2558
|
+
; load-bearing: tree-sitter-zig 1.1.2 parses statement assignments (\`x = 5;\`,
|
|
2559
|
+
; \`x += 1;\`, \`_ = expr;\`) as \`variable_declaration\` WITHOUT a keyword
|
|
2560
|
+
; child, and a keyword-less rule would mint a Const per assignment and a
|
|
2561
|
+
; Variable named \`_\` per discard.
|
|
2562
|
+
(variable_declaration
|
|
2563
|
+
"const" . (identifier) @name) @definition.const
|
|
2564
|
+
(variable_declaration
|
|
2565
|
+
"var" . (identifier) @name) @definition.variable
|
|
2566
|
+
|
|
2567
|
+
; @import("path") — capture the string argument as @import.source, in
|
|
2568
|
+
; EVERY position: the value of a const/var (\`const std = @import("std")\`),
|
|
2569
|
+
; a member chain (\`const X = @import("x.zig").X\`), \`pub usingnamespace
|
|
2570
|
+
; @import("path")\`, a tuple element (\`pub const Interfaces = .{
|
|
2571
|
+
; @import("a.zig"), @import("b.zig") }\`), a call argument, a comparison
|
|
2572
|
+
; operand, the receiver of a member call (\`try @import("dump.zig").root(...)\`).
|
|
2573
|
+
; Zig has no import statement — the builtin IS the import, wherever it sits,
|
|
2574
|
+
; and every occurrence is a file dependency. The #eq? predicate keeps the
|
|
2575
|
+
; other builtins (@sizeOf, @TypeOf, @as, …) out. One rule, one match per
|
|
2576
|
+
; builtin: the structure phase only skips import matches (IMPORTS edges come
|
|
2577
|
+
; from the scope phase — \`emitZigScopeCaptures\`, whose \`@import.inline\`
|
|
2578
|
+
; rule is this rule's twin, decides which occurrences bind a name).
|
|
2579
|
+
((builtin_function
|
|
2580
|
+
(builtin_identifier) @builtin
|
|
2581
|
+
(arguments
|
|
2582
|
+
(string) @import.source))
|
|
2583
|
+
(#eq? @builtin "@import")) @import
|
|
2584
|
+
|
|
2585
|
+
; Free calls: foo(...)
|
|
2586
|
+
(call_expression
|
|
2587
|
+
function: (identifier) @call.name) @call
|
|
2588
|
+
|
|
2589
|
+
; Member calls: obj.method(...) and namespace.fn(...) (e.g. std.debug.print).
|
|
2590
|
+
(call_expression
|
|
2591
|
+
function: (field_expression
|
|
2592
|
+
member: (identifier) @call.name)) @call
|
|
2593
|
+
`;
|
|
2434
2594
|
import { SupportedLanguages } from '../../_shared/index.js';
|
|
2435
2595
|
export const LANGUAGE_QUERIES = {
|
|
2436
2596
|
[SupportedLanguages.TypeScript]: TYPESCRIPT_QUERIES,
|
|
@@ -2449,4 +2609,5 @@ export const LANGUAGE_QUERIES = {
|
|
|
2449
2609
|
[SupportedLanguages.Dart]: DART_QUERIES,
|
|
2450
2610
|
[SupportedLanguages.Vue]: TYPESCRIPT_QUERIES, // Vue <script> blocks are parsed as TypeScript
|
|
2451
2611
|
[SupportedLanguages.Cobol]: '', // Standalone regex processor — no tree-sitter queries
|
|
2612
|
+
[SupportedLanguages.Zig]: ZIG_QUERIES,
|
|
2452
2613
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zig type extraction — minimal v1 stub.
|
|
3
|
+
*
|
|
4
|
+
* Type-flow inference (constructor binding, for-loop element types, pattern
|
|
5
|
+
* binding, etc.) is intentionally out of scope for v1. The provider supplies
|
|
6
|
+
* an empty `declarationNodeTypes` set and no-op extractors to satisfy the
|
|
7
|
+
* `LanguageTypeConfig` contract; the central type-env builder will simply
|
|
8
|
+
* record nothing for Zig files. Receiver resolution today operates without
|
|
9
|
+
* type-env signal for languages that omit it.
|
|
10
|
+
*/
|
|
11
|
+
const noopDeclaration = () => { };
|
|
12
|
+
const noopParameter = () => { };
|
|
13
|
+
export const zigTypeConfig = {
|
|
14
|
+
declarationNodeTypes: new Set(),
|
|
15
|
+
extractDeclaration: noopDeclaration,
|
|
16
|
+
extractParameter: noopParameter,
|
|
17
|
+
};
|
|
@@ -183,6 +183,22 @@ export declare const CONTAINER_TYPE_TO_LABEL: Record<string, string>;
|
|
|
183
183
|
* matters for a null named child, which the fixture corpus never produces).
|
|
184
184
|
*/
|
|
185
185
|
export declare function walkNamedTree(node: SyntaxNode, cb: (node: SyntaxNode) => void): void;
|
|
186
|
+
/**
|
|
187
|
+
* True when a node is, or contains, tree-sitter error recovery.
|
|
188
|
+
*
|
|
189
|
+
* After a syntax error the parser keeps going by guessing node boundaries, so
|
|
190
|
+
* the surviving tree stays WELL FORMED while describing text that was never
|
|
191
|
+
* written that way: an unterminated argument list can absorb the source of the
|
|
192
|
+
* next declaration into an `ERROR` child, and an assignment with no right-hand
|
|
193
|
+
* side gets a `MISSING` value node whose text is invented. A capture that reads
|
|
194
|
+
* such a subtree emits facts that look ordinary and are false, which is worse
|
|
195
|
+
* than emitting nothing — so callers that record source text verbatim should
|
|
196
|
+
* check this first and fail closed.
|
|
197
|
+
*
|
|
198
|
+
* `hasError` covers the subtree; `isMissing` is checked as well because a node
|
|
199
|
+
* inserted by recovery is the one case where the node itself carries the flag.
|
|
200
|
+
*/
|
|
201
|
+
export declare function hasRecoveredSyntax(node: SyntaxNode): boolean;
|
|
186
202
|
/** Return the first matching ancestor unless a boundary ancestor is reached first. */
|
|
187
203
|
export declare function findAncestorBeforeBoundary(node: SyntaxNode, targetTypes: ReadonlySet<string>, boundaryTypes: ReadonlySet<string>): SyntaxNode | null;
|
|
188
204
|
/**
|
|
@@ -273,7 +289,30 @@ export declare const findEnclosingClassInfo: (node: SyntaxNode, filePath: string
|
|
|
273
289
|
* class-container branch to compute `qualifiedClassId` from the SAME function
|
|
274
290
|
* the node-id is built from, guaranteeing owner-id == node-id by construction.
|
|
275
291
|
*/
|
|
276
|
-
getQualifiedOwnerName?: (node: SyntaxNode, simpleName: string) => string | null
|
|
292
|
+
getQualifiedOwnerName?: (node: SyntaxNode, simpleName: string) => string | null,
|
|
293
|
+
/**
|
|
294
|
+
* Optional: the type the whole FILE declares (`LanguageProvider.resolveFileTypeOwner`).
|
|
295
|
+
* Consulted only when the walk reaches the tree root without meeting a
|
|
296
|
+
* container, so a member declared at file level can be owned by the file's
|
|
297
|
+
* own type (Zig file-structs). The name is what the definition phase names
|
|
298
|
+
* the class-like node, so owner id == node id by construction.
|
|
299
|
+
*/
|
|
300
|
+
resolveFileTypeOwner?: (root: SyntaxNode, filePath: string) => {
|
|
301
|
+
readonly name: string;
|
|
302
|
+
readonly label: NodeLabel;
|
|
303
|
+
} | null,
|
|
304
|
+
/**
|
|
305
|
+
* Optional: the type a CONTAINER node declares
|
|
306
|
+
* (`LanguageProvider.resolveContainerTypeOwner`). Consulted for every
|
|
307
|
+
* `CLASS_CONTAINER_TYPES` node the walk meets, before the generic name-child
|
|
308
|
+
* derivation, for languages whose containers are named from context (a
|
|
309
|
+
* binding wrapper, an enclosing callable, an anonymous ordinal). Null falls
|
|
310
|
+
* through to the generic derivation.
|
|
311
|
+
*/
|
|
312
|
+
resolveContainerTypeOwner?: (container: SyntaxNode, filePath: string) => {
|
|
313
|
+
readonly name: string;
|
|
314
|
+
readonly label: NodeLabel;
|
|
315
|
+
} | null) => EnclosingClassInfo | null;
|
|
277
316
|
/** Object literal binding info for TS/JS shorthand methods. */
|
|
278
317
|
export interface ObjectLiteralBindingInfo {
|
|
279
318
|
ownerId: string;
|