feat: add @ast-grep/lang-systemverilog package#165
feat: add @ast-grep/lang-systemverilog package#165babyworm wants to merge 2 commits intoast-grep:mainfrom
Conversation
Add SystemVerilog language support to the langs monorepo. Uses tree-sitter-systemverilog from GitHub (npm unpublished). Supports .v, .vh, .sv, .svh extensions with '_' expando char. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pin GitHub dependency to v0.3.1 tag for reproducible builds. Add assert.equal for node kind and always_ff pattern matching test. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR introduces SystemVerilog language support to ast-grep by adding a new language package with parser configuration, runtime initialization, TypeScript definitions, setup automation, and test coverage for SystemVerilog file extensions (.v, .vh, .sv, .svh). Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/systemverilog/package.json (1)
41-41: Consider pinningtree-sitter-systemverilogto a commit SHA instead of a tag.Git tags are mutable and can be force-pushed. For truly reproducible builds, a commit SHA (
github:gmlarumbe/tree-sitter-systemverilog#<SHA>) is immutable.♻️ Example
- "tree-sitter-systemverilog": "github:gmlarumbe/tree-sitter-systemverilog#v0.3.1" + "tree-sitter-systemverilog": "github:gmlarumbe/tree-sitter-systemverilog#<commit-sha-for-v0.3.1>"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/systemverilog/package.json` at line 41, The dependency "tree-sitter-systemverilog" in packages/systemverilog/package.json is using a mutable tag; change the value from "github:gmlarumbe/tree-sitter-systemverilog#v0.3.1" to the corresponding immutable commit SHA (e.g. "github:gmlarumbe/tree-sitter-systemverilog#<COMMIT_SHA>") so installs are reproducible—locate the package.json entry for "tree-sitter-systemverilog", replace the tag with the exact commit SHA that matches v0.3.1 (or the desired commit), and save/update lockfile.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/systemverilog/package.json`:
- Line 41: The dependency "tree-sitter-systemverilog" in
packages/systemverilog/package.json is using a mutable tag; change the value
from "github:gmlarumbe/tree-sitter-systemverilog#v0.3.1" to the corresponding
immutable commit SHA (e.g.
"github:gmlarumbe/tree-sitter-systemverilog#<COMMIT_SHA>") so installs are
reproducible—locate the package.json entry for "tree-sitter-systemverilog",
replace the tag with the exact commit SHA that matches v0.3.1 (or the desired
commit), and save/update lockfile.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
.changeset/add-systemverilog.mdpackages/systemverilog/README.mdpackages/systemverilog/index.d.tspackages/systemverilog/index.jspackages/systemverilog/nursery.jspackages/systemverilog/package.jsonpackages/systemverilog/postinstall.js
| "devDependencies": { | ||
| "@ast-grep/nursery": "0.0.9", | ||
| "tree-sitter-cli": "0.25.8", | ||
| "tree-sitter-systemverilog": "github:gmlarumbe/tree-sitter-systemverilog#v0.3.1" |
There was a problem hiding this comment.
can you release it on npm instead of github?
|
|
||
| node-gyp-build@4.8.4: {} | ||
|
|
||
| node-gyp@11.5.0: |
There was a problem hiding this comment.
node-gyp should not be added as dependencies.
I suspect tree-sitter-verilog is doing great here
As suggested in ast-grep/ast-grep#2477 (comment), adding the NAPI language package to langs.
Summary
@ast-grep/lang-systemverilogfor NAPI SystemVerilog support (.v, .vh, .sv, .svh)tree-sitter-systemverilogv0.3.1 via GitHub URL (not published on npm)expandoChar: '_'—$is reserved for SystemVerilog system tasks (IEEE 1800-2017 §5.6)Test plan
pnpm source/pnpm build/pnpm testall passmodule_declaration),$displayparsing,always_ffpatternoxlintclean (0 warnings, 0 errors)Summary by CodeRabbit