-
Notifications
You must be signed in to change notification settings - Fork 6
✨ Lua #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Lua #56
Conversation
WalkthroughThis pull request introduces Lua language support to the ast-grep project. It includes a new README detailing installation and usage, along with TypeScript definitions and an implementation file that exports Lua parser properties. A testing environment is established with Changes
Possibly related PRs
Suggested Reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
🚧 Files skipped from review as they are similar to previous changes (7)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
packages/lua/README.md (1)
1-24
: Documentation covers essential information.The README provides clear installation instructions and a practical usage example, which should help users get started quickly with the Lua language support.
Consider adding a brief introduction about what features this package provides and how it integrates with the broader ast-grep ecosystem.
packages/lua/nursery.js (1)
1-16
: Test harness validates basic functionality.The test setup correctly configures the nursery environment for Lua and includes a basic verification that the parser can identify a simple function call.
Consider adding more test cases to verify parsing of different Lua language constructs such as tables, functions, loops, and conditionals to ensure comprehensive coverage.
packages/lua/package.json (1)
1-47
: Package configuration needs some improvements.The package configuration is mostly complete, but there are several important fields missing:
- The
description
field is empty (line 4)- The
author
field is empty (line 22)- No
repository
field to link to the GitHub repository- No
bugs
orhomepage
fields to provide support informationI suggest adding these missing fields to improve package metadata:
{ "name": "@ast-grep/lang-lua", "version": "0.0.1", - "description": "", + "description": "Lua language support for ast-grep", "main": "index.js", "scripts": { "build": "tree-sitter build -o parser.so", "source": "node nursery.js source", "prepublishOnly": "node nursery.js source", "postinstall": "node postinstall.js", "test": "node nursery.js test" }, "files": [ "index.js", "index.d.ts", "type.d.ts", "postinstall.js", "src", "prebuilds" ], "keywords": ["ast-grep"], - "author": "", + "author": "NatoBoram", "license": "ISC", + "repository": { + "type": "git", + "url": "https://github.com/ast-grep/ast-grep.git", + "directory": "packages/lua" + }, + "homepage": "https://github.com/ast-grep/ast-grep/tree/main/packages/lua#readme", + "bugs": { + "url": "https://github.com/ast-grep/ast-grep/issues" + }, "dependencies": { "@ast-grep/setup-lang": "0.0.3" },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
packages/lua/README.md
(1 hunks)packages/lua/index.d.ts
(1 hunks)packages/lua/index.js
(1 hunks)packages/lua/nursery.js
(1 hunks)packages/lua/package.json
(1 hunks)packages/lua/postinstall.js
(1 hunks)
🔇 Additional comments (3)
packages/lua/postinstall.js (1)
1-4
: Implementation follows standard postinstall pattern.The postinstall script follows the expected pattern for language support in ast-grep, properly invoking the setup function with the current directory.
packages/lua/index.d.ts (1)
1-10
:✅ Verification successful
Type definition is well-structured.
The
LanguageRegistration
type properly defines the interface for the Lua language support with appropriate optional fields. This aligns well with the ast-grep type system.
🏁 Script executed:
#!/bin/bash # Check if there's a corresponding index.js file that implements this interface if [ -f "packages/lua/index.js" ]; then echo "index.js exists, showing its contents:" cat "packages/lua/index.js" else echo "index.js does not exist, which is unexpected since it's imported in nursery.js" exit 1 fiLength of output: 359
Interface & Implementation Verification Passed
TheLanguageRegistration
type inpackages/lua/index.d.ts
is well-structured and accurately captures the interface expected for Lua language support. The corresponding implementation inpackages/lua/index.js
provides the required fields—libraryPath
,extensions
,languageSymbol
, andexpandoChar
—which confirms consistency between the type definition and its usage. The exclusion of the optionalmetaVarChar
field in the implementation is acceptable.packages/lua/index.js (1)
1-9
: LGTM! This implementation properly exports the Lua language configuration.The code is clean and follows the expected pattern for language support in ast-grep. It correctly:
- Builds the path to the parser.so file
- Exports the necessary properties for Lua language integration
- Specifies the .lua extension and correct language symbol
f35b313
to
dc39243
Compare
Summary by CodeRabbit
@ast-grep/lang-lua
added with version0.0.1
.