-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add ember glimmer language parser (.gjs,.gts) extensions #154
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
Conversation
📝 WalkthroughWalkthroughAdds two new language packages: Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
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
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 |
0de3438 to
1e97ac4
Compare
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: 4
🤖 Fix all issues with AI agents
In `@packages/glimmer-javascript/README.md`:
- Around line 16-24: The example uses an invalid identifier name
"glimmer-javascript"; rename the import to a valid identifier (e.g.,
glimmerJavascript), update the object key passed to registerDynamicLanguage to
use that identifier (registerDynamicLanguage({ glimmerJavascript })), and ensure
the parse() call uses the matching language string/identifier
(parse('glimmerJavascript', `your code`)) so the import, registration, and parse
invocation all reference the same valid identifier and string.
In `@packages/glimmer-typescript/index.js`:
- Around line 21-30: The extensions list in module.exports currently registers
both "gjs" and "gts", which overlaps with glimmer-javascript; update the
extensions property in the module.exports object so this package only registers
TypeScript files (change extensions to include only "gts") to avoid ambiguous
language resolution; ensure you only modify the extensions array (referenced as
the extensions property on the exported object) and leave libraryPath,
languageSymbol, and expandoChar unchanged.
In `@packages/glimmer-typescript/README.md`:
- Around line 16-24: The example uses an invalid identifier
"glimmer-typescript"; change the import to a valid identifier (e.g.,
glimmerTypescript) and pass it into registerDynamicLanguage under the original
string key "glimmer-typescript" (use registerDynamicLanguage({
'glimmer-typescript': glimmerTypescript })); also update the parse call sample
to include non-empty example code (e.g., parse('glimmer-typescript', `your code
here`)). Ensure the unique symbols to change are the import line (currently
referencing glimmer-typescript), the registerDynamicLanguage call, and the parse
invocation.
- Around line 10-12: Update the README install command to reference the correct
NPM package name: replace the string "@tree-sitter/cli" with "tree-sitter-cli"
so the command becomes "pnpm install tree-sitter-cli --save-dev"; look for the
install line containing "@tree-sitter/cli" in README.md and change that token
only.
🧹 Nitpick comments (2)
packages/glimmer-javascript/nursery.js (1)
14-17: Incorrect regex pattern in test fixture.The regex
/^d+.d+.d+$/appears to intend matching semantic versions but is missing backslashes.dmatches literal 'd' and.matches any character.📝 Suggested fix
function isLatestVersion() { - const stableRegex = /^d+.d+.d+$/; + const stableRegex = /^\\d+\\.\\d+\\.\\d+$/; return !stableRegex.test(VERSION); }Note: Since this is test fixture code (not production logic), the incorrect regex doesn't affect actual functionality—just the realism of the test snippet.
packages/glimmer-typescript/nursery.js (1)
14-17: Same regex pattern issue as in glimmer-javascript.The regex
/^d+.d+.d+$/is missing backslashes for digit and dot escapes. Same fix as suggested for the JavaScript version.📝 Suggested fix
function isLatestVersion(): boolean { - const stableRegex = /^d+.d+.d+$/; + const stableRegex = /^\\d+\\.\\d+\\.\\d+$/; return !stableRegex.test(VERSION); }
| # install the tree-sitter-cli if no prebuild is available | ||
| pnpm install @tree-sitter/cli --save-dev | ||
| ``` |
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.
🧩 Analysis chain
🏁 Script executed:
# Find and check the package.json in glimmer-typescript directory
find . -path "*/glimmer-typescript/package.json" -type fRepository: ast-grep/langs
Length of output: 100
🏁 Script executed:
# Once we find package.json, let's check its contents related to tree-sitter
if [ -f "packages/glimmer-typescript/package.json" ]; then
echo "=== package.json devDependencies ==="
cat packages/glimmer-typescript/package.json | jq '.devDependencies // empty'
fiRepository: ast-grep/langs
Length of output: 205
🏁 Script executed:
# Check the README to confirm the reference mentioned in the review
if [ -f "packages/glimmer-typescript/README.md" ]; then
echo "=== README.md lines 10-12 ==="
sed -n '10,12p' packages/glimmer-typescript/README.md
echo ""
echo "=== Broader context around tree-sitter ==="
grep -n "tree-sitter" packages/glimmer-typescript/README.md
fiRepository: ast-grep/langs
Length of output: 341
🌐 Web query:
@tree-sitter/cli npm package registry
💡 Result:
There is no published scoped package named @tree-sitter/cli. The Tree-sitter CLI is published on npm as tree-sitter-cli (latest shown v0.25.0). Install with npm i tree-sitter-cli or use the GitHub releases/binary. [1][2]
Sources:
- npm package page for tree-sitter-cli. [1]
- tree-sitter project / CLI source on GitHub. [2]
🌐 Web query:
tree-sitter-cli npm package registry
💡 Result:
Summary for the npm package "tree-sitter-cli":
- Package: tree-sitter-cli.
- Latest published npm version (as shown on npm): 0.22.5. Install: npm install tree-sitter-cli (or npm i [email protected]). [1]
- Repository / homepage: github.com/tree-sitter/tree-sitter (official Tree-sitter project). [1]
- Install alternatives: cargo install tree-sitter-cli (Rust crate) or download prebuilt binaries from GitHub Releases. [2]
- License: MIT. Common commands: tree-sitter generate, test, build, parse, etc.; docs on usage available in the Tree-sitter docs. [1][2]
Sources: npm package page for tree-sitter-cli [1]; official Tree-sitter docs (install/CLI usage) [2].
Update README.md line 11 to use correct package name tree-sitter-cli instead of @tree-sitter/cli.
The README references the non-existent scoped package @tree-sitter/cli, while package.json correctly uses tree-sitter-cli. The official Tree-sitter CLI package on NPM is published as tree-sitter-cli (unscoped).
Suggested fix for line 11:
- pnpm install `@tree-sitter/cli` --save-dev
+ pnpm install tree-sitter-cli --save-dev📝 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.
| # install the tree-sitter-cli if no prebuild is available | |
| pnpm install @tree-sitter/cli --save-dev | |
| ``` | |
| # install the tree-sitter-cli if no prebuild is available | |
| pnpm install tree-sitter-cli --save-dev |
🤖 Prompt for AI Agents
In `@packages/glimmer-typescript/README.md` around lines 10 - 12, Update the
README install command to reference the correct NPM package name: replace the
string "@tree-sitter/cli" with "tree-sitter-cli" so the command becomes "pnpm
install tree-sitter-cli --save-dev"; look for the install line containing
"@tree-sitter/cli" in README.md and change that token only.
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.
You're absolutely right. I will fix it in other PRs
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.
@HerringtonDarkholme Thank you for confirming! I appreciate you noting this for the other PRs where the same issue may exist.
🧠 Learnings used
Learnt from: HerringtonDarkholme
Repo: ast-grep/langs PR: 65
File: packages/typescript/index.js:6-6
Timestamp: 2025-04-10T19:47:06.210Z
Learning: In ast-grep, TypeScript and TSX are treated as two separate languages, each with their own language package, rather than TypeScript supporting both .ts and .tsx extensions in a single package.
Learnt from: HerringtonDarkholme
Repo: ast-grep/langs PR: 73
File: packages/yaml/package.json:13-20
Timestamp: 2025-04-22T18:00:42.287Z
Learning: In ast-grep language packages, type.d.ts is a generated file that should be included in the package.json files array even though it's not directly committed to the repository.
Learnt from: HerringtonDarkholme
Repo: ast-grep/langs PR: 74
File: packages/all/src/langs.test.ts:0-0
Timestamp: 2025-04-25T19:31:36.345Z
Learning: The ast-grep/all-langs package uses ESM modules (has "type": "module" in package.json). In ESM, file extensions should be included in imports and should consistently use .js extensions (not .ts) since TypeScript transpiles to JavaScript.
Learnt from: HerringtonDarkholme
Repo: ast-grep/langs PR: 65
File: packages/typescript/package.json:17-17
Timestamp: 2025-04-10T19:46:48.394Z
Learning: In the ast-grep/langs repository, type.d.ts files are generated at build time and are intentionally ignored in git version control.
Learnt from: HerringtonDarkholme
Repo: ast-grep/langs PR: 43
File: packages/go/nursery.js:10-17
Timestamp: 2025-04-01T18:31:28.544Z
Learning: For ast-grep/lang packages, minimal test coverage that verifies basic functionality (like a simple function declaration test for Go) is considered sufficient, and extensive test coverage of language constructs is not required.
Learnt from: pelikhan
Repo: ast-grep/langs PR: 38
File: packages/python/package.json:22-22
Timestamp: 2025-03-27T03:50:42.436Z
Learning: Most packages in the ast-grep/langs repository use an empty author field in package.json files. Don't assume authorship information without clear evidence from the repository.
HerringtonDarkholme
left a comment
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.
Can you add README and fix linting? Thanks
|
Published! |
They're Ember.js component authoring and templating format.
Summary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.