Skip to content

Add support for JavaScript#593

Open
gkorland wants to merge 2 commits intostagingfrom
backend/add-javascript-support
Open

Add support for JavaScript#593
gkorland wants to merge 2 commits intostagingfrom
backend/add-javascript-support

Conversation

@gkorland
Copy link
Contributor

Migrated from falkordb/code-graph-backend#59

Summary

Add support for JavaScript code analysis using tree-sitter.

Changes:

  • New JavaScriptAnalyzer class using tree-sitter for JavaScript
  • Extracts functions and classes from JavaScript code
  • First and second pass analysis methods
  • Updated source_analyzer.py to include JavaScript
  • Added tree-sitter-javascript dependency

Resolves #540


Originally authored by @gkorland in falkordb/code-graph-backend#59

Migrated from FalkorDB/code-graph-backend PR #59.
Original issue: FalkorDB/code-graph-backend#51
Resolves #540

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vercel
Copy link

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
code-graph Error Error Mar 10, 2026 8:58am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

Warning

Rate limit exceeded

@gkorland has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 21 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2990d2a7-c119-45ba-b915-eadd5ba79694

📥 Commits

Reviewing files that changed from the base of the PR and between 887b82f and 849ffb1.

📒 Files selected for processing (4)
  • api/analyzers/javascript/__init__.py
  • api/analyzers/javascript/analyzer.py
  • api/analyzers/source_analyzer.py
  • pyproject.toml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch backend/add-javascript-support
📝 Coding Plan
  • Generate coding plan for human review comments

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.

heritage = entity.node.child_by_field_name('body')
if heritage is None:
return
superclass_node = entity.node.child_by_field_name('name')
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds JavaScript language support to the backend source analysis pipeline by introducing a Tree-sitter-based analyzer and wiring it into SourceAnalyzer, enabling JS projects to be parsed into the graph model.

Changes:

  • Added JavaScriptAnalyzer (Tree-sitter JavaScript) to extract JS entities (functions/classes/methods).
  • Wired .js into SourceAnalyzer’s analyzer registry and file discovery.
  • Added tree-sitter-javascript as a Python dependency.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

File Description
pyproject.toml Adds the tree-sitter-javascript dependency required for JS parsing.
api/analyzers/source_analyzer.py Registers .js analyzer, includes JS files in discovery, and includes a JS LSP placeholder in second pass.
api/analyzers/javascript/analyzer.py Implements Tree-sitter-based JavaScript entity extraction and symbol collection/resolution hooks.
api/analyzers/javascript/__init__.py Declares the new analyzer package.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"tree-sitter-c>=0.24.1,<0.25.0",
"tree-sitter-python>=0.25.0,<0.26.0",
"tree-sitter-java>=0.23.5,<0.24.0",
"tree-sitter-javascript>=0.23.0",
def analyze_sources(self, path: Path, ignore: list[str], graph: Graph) -> None:
path = path.resolve()
files = list(path.rglob("*.java")) + list(path.rglob("*.py")) + list(path.rglob("*.cs"))
files = list(path.rglob("*.java")) + list(path.rglob("*.py")) + list(path.rglob("*.cs")) + list(path.rglob("*.js"))
Comment on lines +64 to +69
captures = query.captures(entity.node)
if 'reference.call' in captures:
for caller in captures['reference.call']:
entity.add_symbol("call", caller)
query = self.language.query("(formal_parameters (identifier) @parameter)")
captures = query.captures(entity.node)
Comment on lines +52 to +55
heritage = entity.node.child_by_field_name('body')
if heritage is None:
return
superclass_node = entity.node.child_by_field_name('name')
Comment on lines 25 to +31
analyzers: dict[str, AbstractAnalyzer] = {
# '.c': CAnalyzer(),
# '.h': CAnalyzer(),
'.py': PythonAnalyzer(),
'.java': JavaAnalyzer(),
'.cs': CSharpAnalyzer()}
'.cs': CSharpAnalyzer(),
'.js': JavaScriptAnalyzer()}
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.

Add support for JavaScript

2 participants