emacs-languagetool / lsp-ltex

lsp-mode ❤️ LTEX
GNU General Public License v3.0
54 stars 9 forks source link

Possibility to disable rules on a per-mode basis #40

Open dschrempf opened 9 months ago

dschrempf commented 9 months ago

For example, the WHITESPACE_RULE is useful many times, but not in a Git commit buffer.

jcs090218 commented 9 months ago

Maybe try tweak these variables:

https://github.com/emacs-languagetool/lsp-ltex/blob/84d9cd89dfb2856d3566ed1930a78dc039b19ab4/lsp-ltex.el#L95-L105

dschrempf commented 9 months ago

Thanks. I was assuming these are global variables. I mean we could set them buffer-locally when entering the respective text-based mode.

It would be nice to have this feature available from the LSP action. That is, disable this rule for this major mode.

I tried doing the following:

(add-hook 'git-commit-mode-hook
            (lambda () (set (make-local-variable 'lsp-ltex-disabled-rules)
                            '(:en-US ("WHITESPACE_RULE")))))

But that doesn't really work, I think because lsp-ltex--combined-disabled-rules is not updated accordingly.

Also, I would actually like to disable this rule for all languages :smile:, another complication.

jcs090218 commented 9 months ago

Yeah, you are right. I haven't looked at the code for a long time, so it will take me some time to rework this. 🤔

BTW, PRs are always welcome!