emacs-tree-sitter / elisp-tree-sitter

Emacs Lisp bindings for tree-sitter
https://emacs-tree-sitter.github.io
MIT License
816 stars 73 forks source link

enabling tree-sitter-hl-mode results in incorrect highlighting #228

Open ville-h opened 2 years ago

ville-h commented 2 years ago

There appears to be difference between only enabling tree-sitter-hl-mode or enabling tree-sitter-mode and then tree-sitter-hl-mode from the init file.

(add-hook 'c++-mode-hook
    (lambda()
        ;; setup packages:
        ;;(tree-sitter-mode t)
        (tree-sitter-hl-mode t)
    )
)

Above doesn't call tree-sitter-mode explicitly. Open main.cxx:

#include "iostream"

// namespace incorrect
// new incorrect
// operator incorrect

auto main() -> int {
    return 0;
}

And the commented out lines have issues with the words following the c++ language keywords. Inspecting the variable tree-sitter-mode indicates its value is t. Whilst not very harmful it's still somewhat surprising that there would be a difference.