reddit / emacs

Tree-sitter syntax highlighting issues (C++)

RepublicWorried · 2022-12-10 14:18
I am on emacs 29 and the latest commit on the 29 branch. After following the install instructions form [https://emacs-tree-sitter.github.io/](https://emacs-tree-sitter.github.io/) I enabled tree-sitter-hl-mode and the syntax highlighting changed from the default major mode one to the one below. However, this does not look consistent at all. I thought that tree-sitter would put a focus on giving e.g. local variables like v below the same color throughout the entire scope. but this does not seem to be the case. Am I missing sth here? because like this I dont see any merit over the ordinary highlighting ​ ​ https://preview.redd.it/fclidwrjx25a1.png?width=417&format=png&auto=webp&s=8700e5574b90d77177700a6a14352d7e11f33ed6
TrisMcC · 2022-12-10 14:27
Just so you know, the tree-sitter support that is built into emacs29 is different from "emacs-tree-sitter", which is an elisp implementation that works on emacs28.
weineng96 · 2022-12-10 18:05
Which is better?
badmaxton · 2022-12-10 18:32
The built-in one is integrated inside emacs' default modes for the supported languages, instead of an external mode. See https://git.savannah.gnu.org/cgit/emacs.git/tree/admin/notes/tree-sitter/starter-guide?h=feature/tree-sitter on how to use the built-in support.
RepublicWorried · 2022-12-10 19:00
Still, the behaviour looks not right does it?
Pay08 · 2022-12-11 02:45
Does treesitter use local variable colourization?