emacs-tree-sitter / elisp-tree-sitter

Emacs Lisp bindings for tree-sitter

Home Page:https://emacs-tree-sitter.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

c++ struct array member identifier not highlighted

ville-h opened this issue · comments

c++ struct array member identifier not highlighted:
emacs_tree_sitter_struct_array_member_highlight_bug

int xs[2]; // <-- identifier is highlighted


struct aa {
    int x;  // <-- identifier is highlighted
    int xs[2]; // <-- identifier does not get highlighted
};


auto main() -> int {
    int xs[2]; // <-- identifier is highlighted
    (void)xs;
    return 0;
}

Feel free to pass it on to whatever project is responsible in case this is the wrong one. It's rather opaque to an outsider which project is responsible for what functionality.

Here are the steps that can help troubleshooting this:

  • Check whether tree-sitter-mode is on.
  • Check whether there's an error node in the syntax tree: M-x tree-sitter-debug.
  • Check whether tree-sitter-hl-mode is on.
  • Check what faces are being used to highlight a piece of text, by putting the cursor on the text and evaluate (get-text-property (point) 'face), or C-u M-x what-cursor-position.

To determine where the unexpected behavior lies:

  • If the minor modes are not on, it can be an issue this package (tree-sitter).
  • If there are errors in the syntax tree, the issue can be:
    • An outdated grammar binary (from tree-sitter-langs, or another distribution mechanism).
    • A grammar bug, which should be reported to the grammar project itself (usually beloning to the org https://github.com/tree-sitter).
  • Otherwise, it can be an issue with highlighting queries, which usually come from the package tree-sitter-langs, but can also come from elsewhere.

Feel free to pass it on to whatever project is responsible in case this is the wrong one.
It's rather opaque to an outsider which project is responsible for what functionality.

Please study the docs. If it's still not clear after that, please open a discussion on https://github.com/emacs-tree-sitter/elisp-tree-sitter/discussions.