tree-sitter / tree-sitter/java-tree-sitter

Why the behavior is different from python binding?

Open
#174 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
141
Forks
34
Avg merge
14d 2h
Merged PRs (30d)
2

Description

there is alternation pattern:

([
(jsx_text) @i18n_issue
(jsx_attribute
  (property_identifier) @attr_name
  (#match? @attr_name "^(alt|placeholder|aria-label|title)$")
  (string) @i18n_issue
)
])

It works in python binding, but (jsx_text) @i18n_issue is ignored in Java binding.

my Java code is:

try (var query = new Query(JsLanguage, source);
     var cursor = new QueryCursor(query)) {
   var items = cursor.findCaptures(tree.getRootNode()).toList();
   // dump each item in items
   // it proves "(jsx_text) @i18n_issue" never be used.
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Java code using Query, QueryCursor, and findCaptures, then reproduce the JSX query and compare its captures with the Python binding. The issue names no repository file or test; done means explaining or correcting why the jsx_text capture is omitted in Java and demonstrating the expected capture behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.