dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.48k stars 1.43k forks source link

Language for languagetool should be taken from spelllang #3360

Open bratekarate opened 3 years ago

bratekarate commented 3 years ago

The language for the languagetool spellcheck should be taken form &spelllang, or at least be configurable through another option. It should be quite simple in most cases; If spelllang has 2 characters, just pass them to languagetool. If it has 5, uppercase the last two.

Another variable g:ale_languagetool_lang could override the language, if user's spelllang is not supported by languagetool or differs from their vim spelllang. A Hashmap with languagecode mappings would be another option. Probably more reliable but a little more boilerplate. That is how I did it with textidote, when I adapted the existing PR for my own needs locally.

If using spellang seems to complicated, the variable g:ale_languagetool_lang would be much appreciated.

oblitum commented 3 years ago

Hey @bratekarate, I see you commit on TeXtidote, are you planning to pick on the work of the stale PRs to add support for it? That would be great as the current support for LanguageTool in ALE is simply not good as LanguageTool standalone isn't correct for checking LaTeX/Markdown. While at that, it would also be great to simply remove markdown from default LanguageTool linter filetype list (simply leaving languagetool for plain text).

bratekarate commented 3 years ago

@oblitum I actually made some changes to the PR already in my fork of ale to make textidote work.

Shall I open a new PR for this one?

bratekarate commented 3 years ago

I opened #3376 for this issue. It's a draft, feedback is welcome. Also have some issues with the linter on the doc files.

The solution works also for the multiple &spelllang case you mentioned in the closed PR. I would rather not get rid of it, as I think that it simplifies configuration in most cases. It is still overridable if you don't want spelllang to be used.