minad / jinx

🪄 Enchanted Spell Checker
GNU General Public License v3.0
433 stars 22 forks source link

I don't seem to get spell-checking for a few modes #88

Closed anonimitoraf closed 1 year ago

anonimitoraf commented 1 year ago

Thanks for this nice package. I've noticed that for js2-mode, clojure, elisp, txt and other modes spellcheck works fine but not for typescript-mode and js-mode.

I've tried disabling LSP (in case it's interfering). Is there a way I can access any logging of some sort to diagnose the issue?

My config (Doom) is simply:

(use-package! jinx
  :hook (emacs-startup . global-jinx-mode)
  :config
  (map! :map evil-normal-state-map
    "z g" #'jinx-correct))

Thanks!

minad commented 1 year ago

Hi! Jinx works for me in the builtin js-mode. I suspect that some additional configuration from Doom may interfere here. Can you make a list of modes which don't work and ideally also test them in emacs -Q with just Jinx enabled? This would help me debugging the problem.

js-mode is derived from prog-mode. Jinx uses the variable jinx-include-faces to only check comments and strings. You can check the faces at point with C-u C-x =. Maybe font-lock-comment-face is not present there? If that's not the cause, something else may interfere with the font locking mechanism used by Jinx. You can for example M-x trace-function RET jinx--check-region RET. Usually this function is executed during font locking, e.g., while editing text.

If this also doesn't yield some clue you can copy jinx--check-region to the scratch buffer and add some message calls or debug the function. The code which checks each word (including subwords) is here:

https://github.com/minad/jinx/blob/7ebd7e3218cc427c99bf38adf3278f1ef85aa0f3/jinx.el#L421-L447

You can for example debug which words are checked and the return value of jinx--predicates:

(run-hook-with-args-until-success 'jinx--predicates word-start)

I hope this helps debugging the issue in your setup. If you figure something out please let me know, in particular if some changes in Jinx are needed to make it work better out of the box.

anonimitoraf commented 1 year ago

Thanks for all that info @minad! I'll try those out and report back

anonimitoraf commented 1 year ago

Cool, got it. I had to add these into jinx-include-faces

    (typescript-mode tree-sitter-hl-face:comment
                     tree-sitter-hl-face:string)
    (typescript-tsx-mode web-mode-javascript-comment-face
                         web-mode-javascript-string-face)
minad commented 1 year ago

These are non-standard faces, right? Afaik the Emacs 29 treesitter support uses the normal font locking faces.

anonimitoraf commented 1 year ago

Ah yea I think non-standard. I haven't updated to the built-in treesitter (I'm still using https://github.com/tree-sitter/tree-sitter)