tree-sitter / tree-sitter/tree-sitter-cpp

bug: Incorrect HIGHLIGHT_QUERY in rust bindings

Open
#336 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
453
Forks
185
PR merge metrics
No merged PRs in 30d

Description

Did you check existing issues?
  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues of tree-sitter-cpp
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

HIGHLIGHT_QUERY in rust bindings for the library only contains content of file queries/highlights.scm, but not the highlights query of tree-sitter-c library which it extends. Therefore only C++-specific parts of code are highlighted when using the parser through rust bindings.

Steps To Reproduce/Bad Parse Tree

Not sure what kind of reproducibility is needed here, but a simple program like this:

fn main() {
    println!("{}", tree_sitter_cpp::HIGHLIGHT_QUERY);
}

Shows that the variable is wrong

Expected Behavior/Parse Tree

The HIGHLIGHT_QUERY variable should contain concatenated highlight queries from tree-sitter-c parser and queries/highlights.scm file

Repro

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 queries/highlights.scm and the Rust binding that defines HIGHLIGHT_QUERY, then compare the exported value with the tree-sitter-c highlights query it extends. Verify the result using the Rust program in the issue; done means the exported query includes both the C and C++ highlight rules.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.