Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dschrempf opened this issue Feb 17, 2024 · 3 comments
Open

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

dschrempf opened this issue Feb 17, 2024 · 3 comments

Comments

@dschrempf
Copy link

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

@jcs090218
Copy link
Member

Maybe try tweak these variables:

lsp-ltex/lsp-ltex.el

Lines 95 to 105 in 84d9cd8

(defcustom lsp-ltex-disabled-rules '()
"Lists of rules that should be disabled (if enabled by default by
LanguageTool)."
:type 'list
:group 'lsp-ltex)
(defcustom lsp-ltex-enabled-rules '()
"Lists of rules that should be enabled (if disabled by default by
LanguageTool)."
:type 'list
:group 'lsp-ltex)

@dschrempf
Copy link
Author

dschrempf commented Feb 18, 2024

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 😄, another complication.

@jcs090218
Copy link
Member

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants