languagetool-org / languagetool

Style and Grammar Checker for 25+ Languages
https://languagetool.org
GNU Lesser General Public License v2.1
12.36k stars 1.39k forks source link

Option to specify preferredVariants from commandline #4309

Open javiertury opened 3 years ago

javiertury commented 3 years ago

For many languages, languagetool-commandline.jar --autoDetect provides significantly fewer suggestions. The documentation says that preferredVariants must be somehow specified to solve this problem, but currently there is no way to specify this option from the command line.

jaumeortola commented 3 years ago

Autodetect on the command line doesn't seem a usual use case. Do you really need to do it? preferredVariants is not implemented, but it could be done. Now, you could check a paragraph, extract the language and then run again with the full language code you want.

javiertury commented 3 years ago

I'm not sure what to answer. I use coc-diagnostic for vim which calls languagetool, which is just a wrapper for languagetool-commandline.jar.

https://github.com/iamcco/coc-diagnostic/blob/47dee895252dfbf0b35b9658cd2aee1d8393d9e0/src/config.ts#L95-L111

I wanted the linter to work with three languages, so I added --autoDetect ("args": ["--autoDetect","-"]). But maybe you are right and I should use another LSP client that works with languagetool-server instead of languagetool-commandline.