Closed pushqrdx closed 3 years ago
IIRC emacs-tree-sitter de-activates font-lock on purpose and takes care of the highlighting. What's your reasoning for wanting to keep font-lock and emacs-tree-sitter co-existing?
@shackra having the best of both worlds, for instance tree-sitter screws up c++ macros (no highlighting at all), also there are some issues with operator overloads, namespace highlighting, but on of the solid things that tree-sitter does is highlighting types so i wanted to augment emac's font-lock with tree-sitter
If you want to use the coloring provided by font-lock-keywords
, you need to set tree-sitter-hl-use-font-lock-keywords
as well, like this:
(add-hook 'c++-mode-hook
(lambda ()
(setq-local tree-sitter-hl-use-font-lock-keywords t)
(add-function :before-while (local 'tree-sitter-hl-face-mapping-function)
(lambda (capture-name)
(string= capture-name "type")))))
I only want tree-sitter to highlight c++ types, all the rest should be highlighted using emacs font-lock, i tried something like this but it everything other than types lose highlights (white/default)