emacs-tree-sitter / elisp-tree-sitter

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

How to make spell-fu work with tree-sitter-hl? #64

Closed loafofpiecrust closed 3 years ago

loafofpiecrust commented 3 years ago

If I enable tree-sitter-hl-mode in a buffer, it gets highlighted correctly and my TODO and NOTE items still get highlighted (by the hl-todo minor mode) but the misspelled words in the buffer lose their red underline from spell-fu-mode. Related to #45?

ubolonton commented 3 years ago

This is probably unrelated to #45, as spell-fu-mode seems to use overlays.

ubolonton commented 3 years ago

spell-fu relies on spell-fu-faces-include, which defaults to '(font-lock-comment-face font-lock-doc-face font-lock-string-face). It probably needs a more generic mechanism to specify regions to spell-check. For now, this should be enough:

(setq-default spell-fu-faces-include
              '(tree-sitter-hl-face:comment
                tree-sitter-hl-face:doc
                tree-sitter-hl-face:string
                font-lock-comment-face
                font-lock-doc-face
                font-lock-string-face))
loafofpiecrust commented 3 years ago

That seems to do the trick, thanks!