spell-fu is working to check the spelling in comments as expected on my system, but only in elsip-mode: is not working in any other prog-mode derivative on my system that I’ve checked.
What did you expect to happen?
I expected spell-fu to underline mispelled words in comments, and to find spelling errors when I run spell-fu-buffer.
Steps to reproduce
I have (spell +everywhere) configured.
I ensure spell-fu is running in the modes (e.g., python or ocaml) via SPC h m (and also that flyspell is not running).
Type some nonsense string in a comment in a buffer reading some Python or OCaml, and observe no overlay for the error, and no errors detected whenn running spull-fu-buffer.
But spelling in comments is checked in .el files running elsip-mode.
System information
Loading data dump...
Thanks in advance for any tips on how to debug here! I’ve tried looking at the doom config for the :checker spell setting, comparing spell-fu variables, running thru relevant advice in How to debug issues, updating, running doctor, etc. I’m not sure what else to do here to figure out what’s going wrong!
I got it: I am using tree-sitter based highlighting for most languages I work with these days, and they have a different font-face than what is expected by spell-fu in prog-mode. The default configuration is:
A fix (tho probably not the optimal one) is to add the following to my config:
(add-hook!
prog-mode
(after! spell-fu
;; Ensure spell-fu works in prog-modes
(setq spell-fu-faces-include
'(font-lock-comment-face
font-lock-doc-face
font-lock-string-face
tree-sitter-hl-face:comment
tree-sitter-hl-face:string
tree-sitter-hl-face:string.special))))
I think this is actually something missing in the doom config, and should be added automatically when both tree-sitter and spell-fu are working together…
Hopefully you’ve solved this by now. For the sake of others who happen upon this, I had the same problem and it was caused by spell-fu needing to be configured to work with tree-sitter. I fixed it by adding the needed faces:
Thank you for posting! I fixed this the same way right after posting, and I updated here with a reply, but my reply got trapped in moderation and was never published. That probably cost others lost time :(