Conversation
Add tree-sitter-zig v1.0 for Zig language support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add Zig language struct with .zig extension support - Register Zig in all_languages() list - Implement comment node validation for Zig 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Implement ZigExtractor with query patterns for functions, structs, enums, and unions - Add support for extracting code blocks (loops, conditionals, etc.) - Register Zig parser in ParserRegistry 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add Zig colors to dark, light, and ascii themes - Add lang_zig field to ColorScheme struct - Implement Colors::lang_zig() method 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add test cases for function, struct, and mixed code extraction - Add snapshot tests for validation - Register Zig in test helper functions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add Zig to --langs option help text - Add Zig to trending command supported languages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add Zig to README features list - Add Zig language details to supported-languages.md - Add Zig to usage.md trending languages - Update CONTRIBUTING.md with current architecture for adding languages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
WalkthroughAdds Zig language support across the codebase: language model and registration, tree-sitter dependency and Zig extractor/parser, color scheme entries and accessor, CLI/help and docs updates, and integration tests. Assets updated for Zig colors. Test harness extended to recognize Zig. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant CLI as CLI
participant PR as ParserRegistry
participant ZE as ZigExtractor
participant TS as tree-sitter-zig
participant CH as Chunker
CLI->>PR: request parser for "zig"
PR-->>CLI: Zig parser factory
CLI->>ZE: create_parser()
ZE->>TS: set_language(zig)
TS-->>ZE: language set (ok/error)
ZE-->>CLI: Parser (or error)
CLI->>ZE: parse(source.zig)
ZE->>TS: parse + run queries (decls/comments)
TS-->>ZE: AST + captures
ZE->>CH: map captures to ChunkType
CH-->>CLI: chunks (functions/structs/enums/unions, blocks)
Note over CLI,ZE: Error paths return ExtractionFailed on setup/parse failure
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (53.84%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #279 +/- ##
==========================================
+ Coverage 24.59% 24.71% +0.12%
==========================================
Files 195 197 +2
Lines 21743 21834 +91
==========================================
+ Hits 5347 5396 +49
- Misses 16396 16438 +42
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
Cargo.toml (1)
49-49: Update tree-sitter-zig dependency to 1.1.2
Thetree-sitter-zigcrate is currently pinned at"1.0", but the latest stable release is"1.1.2". Please bump the version in Cargo.toml.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
Cargo.lockis excluded by!**/*.locktests/integration/languages/snapshots/r#mod__integration__languages__extractor__test_zig_function_extraction.snapis excluded by!**/*.snaptests/integration/languages/snapshots/r#mod__integration__languages__extractor__test_zig_mixed_extraction.snapis excluded by!**/*.snaptests/integration/languages/snapshots/r#mod__integration__languages__extractor__test_zig_struct_extraction.snapis excluded by!**/*.snap
📒 Files selected for processing (20)
Cargo.toml(1 hunks)README.md(1 hunks)assets/languages/lang_ascii.json(1 hunks)assets/languages/lang_dark.json(1 hunks)assets/languages/lang_light.json(1 hunks)docs/CONTRIBUTING.md(1 hunks)docs/supported-languages.md(3 hunks)docs/usage.md(1 hunks)src/domain/models/color_scheme.rs(2 hunks)src/domain/models/language.rs(2 hunks)src/domain/models/languages/mod.rs(2 hunks)src/domain/models/languages/zig.rs(1 hunks)src/domain/services/source_code_parser/parsers/mod.rs(3 hunks)src/domain/services/source_code_parser/parsers/zig.rs(1 hunks)src/presentation/cli/args.rs(2 hunks)src/presentation/ui/colors.rs(1 hunks)tests/integration/languages/mod.rs(1 hunks)tests/integration/languages/zig/extractor.rs(1 hunks)tests/integration/languages/zig/mod.rs(1 hunks)tests/integration/mod.rs(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/domain/models/languages/zig.rs (2)
src/domain/models/language.rs (6)
hash(155-157)name(11-11)extensions(19-19)color(40-42)display_name(14-16)is_valid_comment_node(45-45)src/presentation/ui/colors.rs (1)
lang_zig(156-158)
src/domain/services/source_code_parser/parsers/zig.rs (1)
src/domain/services/source_code_parser/parsers/mod.rs (9)
tree_sitter_language(32-32)query_patterns(36-36)comment_query(34-34)capture_name_to_chunk_type(37-37)extract_name(38-38)middle_implementation_query(40-40)middle_capture_name_to_chunk_type(41-41)create_parser(101-108)new(53-89)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Coverage
🔇 Additional comments (26)
docs/usage.md (1)
124-124: Documentation update looks good.Zig is correctly added to the supported languages list with proper capitalization and formatting, consistent with the existing entries.
docs/supported-languages.md (3)
23-23: Language table entry is well-formatted.The Zig entry follows the established pattern with correct extension (
.zig) and tree-sitter grammar reference (tree_sitter_zig).
161-165: Extraction features are clearly documented.The documented Zig extraction features (functions, structs, enums, unions) are well-described with their corresponding tree-sitter node types, consistent with documentation patterns for other languages.
183-183: Configuration example is updated correctly.Zig is appropriately added to the default language filter list.
src/presentation/cli/args.rs (2)
45-45: CLI help text updated correctly.The addition of "zig" to the supported languages list maintains the correct lowercase format and follows the established pattern.
84-84: Trending command help updated properly."Zig" is correctly added in title case, consistent with how other language names are displayed in the trending command's help text.
docs/CONTRIBUTING.md (1)
296-442: Excellent documentation for language support.The updated guide for adding language support is comprehensive and well-structured. It provides:
- Clear step-by-step instructions with code examples
- Consistent placeholder naming (newlang/NewLang)
- All necessary integration points (dependency, extractor, tests, docs, colors)
- Query writing guidelines
This will significantly help contributors add new language support.
tests/integration/languages/mod.rs (1)
18-18: Test module registration is correct.The
zigmodule is properly declared and placed in alphabetical order aftertypescript.assets/languages/lang_ascii.json (1)
18-18: ASCII color mapping added correctly.The
lang_zigentry is properly formatted and uses "yellow", which is consistent with other languages like Rust and Python in this theme.assets/languages/lang_dark.json (1)
18-18: Dark theme color added successfully.The Zig color entry uses RGB values (249, 169, 60), creating a distinctive orange/amber color that's visually appropriate and consistent with the dark theme's color palette.
assets/languages/lang_light.json (1)
18-18: LGTM!The Zig color entry follows the same pattern as other language colors and is correctly positioned in the JSON structure.
README.md (1)
15-15: LGTM!Zig is correctly added to the supported languages list in the README, maintaining consistency with the existing documentation style.
tests/integration/mod.rs (1)
69-69: LGTM!The Zig mapping in the test helper follows the established pattern and is correctly positioned alphabetically.
tests/integration/languages/zig/mod.rs (1)
1-1: LGTM!The module declaration follows the standard pattern used for other language test modules.
src/presentation/ui/colors.rs (1)
156-158: LGTM!The
lang_zig()accessor follows the same pattern as other language color methods, maintaining consistency across the public API.src/domain/models/languages/mod.rs (2)
17-17: LGTM!The Zig module declaration follows the established pattern and is correctly positioned alphabetically.
35-35: LGTM!The Zig re-export is consistent with other language re-exports and properly positioned.
src/domain/models/language.rs (2)
3-3: LGTM!Zig is correctly added to the imports, maintaining consistency with the existing import pattern.
75-75: LGTM!Zig is properly added to the
all_languages()catalog, making it available throughout the application.src/domain/models/color_scheme.rs (2)
149-149: LGTM!The
lang_zigfield is correctly added to theColorSchemestruct, following the same pattern as other language color fields.
324-327: LGTM!The Zig color initialization follows the established pattern, with appropriate fallback to yellow and consistent HashMap lookup.
src/domain/services/source_code_parser/parsers/mod.rs (3)
3-3: LGTM!Zig is correctly added to the language imports alongside other supported languages.
29-29: LGTM!The Zig module is properly declared and exposed publicly, consistent with other language modules.
86-86: LGTM!Zig is correctly registered using the
register_language!macro, following the same pattern as all other supported languages.src/domain/models/languages/zig.rs (1)
1-28: LGTM!The Zig language model implementation is clean and correct:
- Properly implements all required
Languagetrait methods- Uses appropriate derives for the type
- Comment node validation is correctly implemented
- Follows the same pattern as other language implementations in the codebase
src/domain/services/source_code_parser/parsers/zig.rs (1)
1-89: LGTM!The ZigExtractor implementation is well-structured and follows the established patterns from other language extractors:
- Tree-sitter query patterns correctly capture Zig functions, structs, enums, and unions
- Comment extraction is properly configured
- Chunk type mappings are appropriate
- Middle-level construct extraction (loops, conditionals, blocks) is comprehensive
- Name extraction logic correctly walks the AST to find identifiers
- Parser factory includes proper error handling
The implementation should correctly extract typing challenges from Zig source files.
| total_chunks: 3, | ||
| chunk_counts: { | ||
| File: 1, | ||
| Function: 0, | ||
| } |
There was a problem hiding this comment.
Incomplete chunk_counts specification.
The total_chunks expects 3, but chunk_counts only accounts for File:1 + Function:0 = 1. Since the source contains 2 structs (Point and Config), the counts should include Struct: 2.
Apply this diff to correct the chunk counts:
total_chunks: 3,
chunk_counts: {
File: 1,
- Function: 0,
+ Struct: 2,
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| total_chunks: 3, | |
| chunk_counts: { | |
| File: 1, | |
| Function: 0, | |
| } | |
| total_chunks: 3, | |
| chunk_counts: { | |
| File: 1, | |
| Struct: 2, | |
| } |
🤖 Prompt for AI Agents
In tests/integration/languages/zig/extractor.rs around lines 38 to 42, the
chunk_counts map is incomplete: total_chunks is 3 but chunk_counts only lists
File:1 and Function:0 (sum 1); add an entry for Struct: 2 so chunk_counts sums
to 3 and matches total_chunks. Ensure formatting matches existing map style and
ordering if needed.
| total_chunks: 5, | ||
| chunk_counts: { | ||
| File: 1, | ||
| Function: 3, | ||
| } |
There was a problem hiding this comment.
Incomplete chunk_counts specification.
The total_chunks expects 5, but chunk_counts only accounts for File:1 + Function:3 = 4. Since the source contains the Vector struct in addition to 3 functions, the counts should include Struct: 1.
Apply this diff to correct the chunk counts:
total_chunks: 5,
chunk_counts: {
File: 1,
+ Struct: 1,
Function: 3,
}🤖 Prompt for AI Agents
In tests/integration/languages/zig/extractor.rs around lines 70 to 74, the
chunk_counts map is missing the Struct entry causing total_chunks (5) to not
match the summed counts; add "Struct: 1" to chunk_counts so File:1 + Function:3
+ Struct:1 = 5, keeping the existing formatting and comma placement.
close: #275
Summary
Changes
.zigextension supportTest plan
Acceptance Criteria (from #275)
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation