X Tutup
Skip to content

Add Erlang support#943

Open
robertoaloi wants to merge 1 commit intoast-grep:mainfrom
robertoaloi:erlang
Open

Add Erlang support#943
robertoaloi wants to merge 1 commit intoast-grep:mainfrom
robertoaloi:erlang

Conversation

@robertoaloi
Copy link

@robertoaloi robertoaloi commented Mar 5, 2026

Add support for Erlang to the playground. This requires ast-grep/ast-grep#2516

The playground itself is currently untested.

Summary by CodeRabbit

  • New Features
    • Added support for Erlang programming language, enabling syntax parsing and analysis for Erlang code.

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

📝 Walkthrough

Walkthrough

Support for the Erlang programming language is added across the WebAssembly language configuration system. The Erlang variant is registered in the language enum, its parser path is configured, and display name mapping is established for the interface.

Changes

Cohort / File(s) Summary
Erlang Language Support
src/wasm_lang.rs, website/_data/parsers.ts, website/src/components/astGrep/lang.ts
Added Erlang as a supported language variant with enum definition, FromStr parsing, expando character mapping ('à'), parser path configuration, and UI display name entry.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Erlang hops into view,
A new language joins the crew,
From parsing paths to displays bright,
Our AST tools now fit just right!
Three small changes, one grand goal—
Making Erlang support whole!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Erlang support' directly and accurately summarizes the main change: adding Erlang as a new supported language across three files in the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@website/_data/parsers.ts`:
- Line 12: The parserPaths object contains languages (e.g., erlang, elixir,
kotlin, nix, swift, yaml) that are missing corresponding keys in the repos and
versions objects, causing downloadParsers.mjs (which looks up each language in
repos and versions) to skip them; add entries for each missing language to both
the repos and versions objects using the same language keys as in parserPaths
(e.g., add "erlang", "elixir", "kotlin", "nix", "swift", "yaml" keys) and set
repos[LANG] to the correct tree-sitter repository identifier and versions[LANG]
to the desired release/tag string so downloadParsers.mjs can find the repo and
version for each parser.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b2026999-869f-4370-94a0-0a92eed5e626

📥 Commits

Reviewing files that changed from the base of the PR and between 1b1dfaf and d70e6f6.

⛔ Files ignored due to path filters (1)
  • website/public/parsers/tree-sitter-erlang.wasm is excluded by !**/*.wasm
📒 Files selected for processing (3)
  • src/wasm_lang.rs
  • website/_data/parsers.ts
  • website/src/components/astGrep/lang.ts

css: 'tree-sitter-css.wasm',
cpp: 'tree-sitter-cpp.wasm',
elixir: 'tree-sitter-elixir.wasm',
erlang: 'tree-sitter-erlang.wasm',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, locate and examine parsers.ts
find . -name "parsers.ts" -type f

Repository: ast-grep/ast-grep.github.io

Length of output: 97


🏁 Script executed:

# Also locate downloadParsers.mjs
find . -name "downloadParsers.mjs" -type f

Repository: ast-grep/ast-grep.github.io

Length of output: 115


🌐 Web query:

tree-sitter-erlang npm package latest version

💡 Result:

The latest version published on npm for tree-sitter-erlang is 0.0.1-security (a security holding package, not the actual Erlang grammar). [1]

Source: [1]


🏁 Script executed:

cat -n ./website/_data/parsers.ts

Repository: ast-grep/ast-grep.github.io

Length of output: 2832


🏁 Script executed:

cat -n ./website/public/parsers/downloadParsers.mjs

Repository: ast-grep/ast-grep.github.io

Length of output: 958


Missing repos and versions entries for Erlang and other languages.

The erlang entry is in parserPaths, but corresponding entries are missing from the repos and versions objects. The downloadParsers.mjs script iterates through parserPaths and looks up each language in both objects (lines 7-8); if either is missing, it logs an error and skips that language (lines 9-11), preventing the WASM file from being downloaded.

Additionally, elixir, kotlin, nix, swift, and yaml have the same issue—they're defined in parserPaths but missing from repos and versions.

Add entries for all missing languages to both objects:

 export const repos: Record<string, string> = {
   bash: 'https://unpkg.com/tree-sitter-bash',
+  elixir: 'https://unpkg.com/tree-sitter-elixir',
+  erlang: 'https://unpkg.com/tree-sitter-erlang',
+  kotlin: 'https://unpkg.com/tree-sitter-kotlin',
+  nix: 'https://unpkg.com/tree-sitter-nix',
+  swift: 'https://unpkg.com/tree-sitter-swift',
+  yaml: 'https://unpkg.com/tree-sitter-yaml',
   // ...
 }

 export const versions: Record<string, string> = {
   bash: '0.25.1',
+  elixir: '<version>',
+  erlang: '<version>',
+  kotlin: '<version>',
+  nix: '<version>',
+  swift: '<version>',
+  yaml: '<version>',
   // ...
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@website/_data/parsers.ts` at line 12, The parserPaths object contains
languages (e.g., erlang, elixir, kotlin, nix, swift, yaml) that are missing
corresponding keys in the repos and versions objects, causing
downloadParsers.mjs (which looks up each language in repos and versions) to skip
them; add entries for each missing language to both the repos and versions
objects using the same language keys as in parserPaths (e.g., add "erlang",
"elixir", "kotlin", "nix", "swift", "yaml" keys) and set repos[LANG] to the
correct tree-sitter repository identifier and versions[LANG] to the desired
release/tag string so downloadParsers.mjs can find the repo and version for each
parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

X Tutup