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

Breaking changes in LanguageTool #110

Open
filmmakerto opened this issue Jan 5, 2023 · 9 comments
Open

Breaking changes in LanguageTool #110

filmmakerto opened this issue Jan 5, 2023 · 9 comments

Comments

@filmmakerto
Copy link

LanguageTool 6.0 was released on 2022-12-29. It no longer supports the "--api" command line option, which was already deprecated in 5.9. If vim-grammarous was installed after the 6.0 release, running :GrammarousCheck leads to the following error:

vim-grammarous: Grammar check failed: Unknown parameter: --api

I thought I could temporarily fix this by manually downloading v5.9 from https://languagetool.org/download/ and replacing the 6.0 files (which, in my case, because I installed the plugin via packer on Arch, are in ~/.local/share/nvim/site/pack/packer/start/vim-grammarous/misc/LanguageTool-6.0) with the 5.9 files, but this does not work: After doing this, the plugin runs without errors again, but it no longer detects any grammatical errors.

As I found out by checking on another computer, this is also true if the plugin was installed before the 6.0 release and no files have been manually replaced. So if I'm not missing something major here, it seems like there was a breaking change in the LanguageTool API that completely breaks this plugin, no matter what version of the LanguageTool cli is installed locally.

@ghost
Copy link

ghost commented Jan 5, 2023

I got the same error message both on dpelle/vim-LanguageTool and on this plugin.

For me, however, extracting LanguageTool-5.9.zip into $HOME/.local/share/nvim/plugged/vim-grammarous/misc made it work, but for my language, when I make a mistake, it shows what was the error, what is the context of it, but fails to underscore it correctly (I have exactly the same issue as this guy, though Russian is not my native language).

Anyway, are you sure that you used correct option for the --lang parameter? If it still doesn't work then maybe you should give vim-LanguageTool a try with the LanguageTool-5.9.

Note that I installed both this and the second plugin via vim-plug.

@rodolfoap
Copy link

rodolfoap commented Jan 8, 2023

Simple and temporary patch: I've created a fork and rolled it back to 5.9 (master...rodolfoap:vim-grammarous:master) so, I use:

use 'rodolfoap/vim-grammarous'

Seems working for now. Sorry, no time to address the real issue.

@rhysd
Copy link
Owner

rhysd commented Jan 8, 2023

From the changelog:

The --api parameter for the command-line version has been removed. It had long been deprecated and replaced by --json.

We need to replace --api with --json

@agherzan
Copy link

You don't need a fork. Just set the parameter:

let g:grammarous#jar_url = 'https://www.languagetool.org/download/LanguageTool-5.9.zip'

And reinstall the plugin.

@zampierilucas
Copy link

Workaround for neovim lua config:

vim.g.grammarous_jar_url = 'https://www.languagetool.org/download/LanguageTool-5.9.zip'

@borisdev
Copy link

borisdev commented Mar 14, 2023

Four steps that fixed the bug on my mac

Context: As others have pointed out, Grammarous depends on the java Language Tool, and when Language Tool 6.0 changed their API, deprecating the use of --api, it broke Grammarous for its new users. Grammarous's developers have not gotten around to change this part of the code.

Step 1: Manually download https://www.languagetool.org/download/LanguageTool-5.9.zip.

Step 2: Move LanguageTool to your Grammarous plugin's misc directory.

cp -rf ~/Downloads/LanguageTool-5.9 .local/share/nvim/plugged/vim-grammarous/misc/

Remember, your misc dir and mine might be in different locations.

Step 3: Remove the recent Language Tool, which breaks, and use the older one now.

rm -rf .local/share/nvim/plugged/vim-grammarous/misc/LanguageTool-6.0

Step 4: Clean up your init.vim or lua.init. Mine required nothing to get Grammarous working with the defaults.

wsdjeg added a commit to SpaceVim/SpaceVim that referenced this issue Mar 28, 2023
@stelgenhof
Copy link

Can confirm @borisdev steps solved the issue for me (Linux). Although of course this just a band-aid and hopefully the maintainers will adjust the code to make it work with Language Tool 6.

@ThiagoMowszet
Copy link

Thanks @borisdev, works for me! 🥇

@ivanalejandro0
Copy link

Workaround for neovim lua config:

vim.g.grammarous_jar_url = 'https://www.languagetool.org/download/LanguageTool-5.9.zip'

You need to keep the "#" part for the plugin to find it, in lua you have to set it like so:

vim.g["grammarous#jar_url"] = 'https://www.languagetool.org/download/LanguageTool-5.9.zip'

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

9 participants