davidlday / vscode-languagetool-linter

A from scratch redesign of LanguageTool integration for VS Code.
https://marketplace.visualstudio.com/items?itemName=davidlday.languagetool-linter
Apache License 2.0
149 stars 11 forks source link

Better Linux Installation Instructions #649

Open mslinn opened 9 months ago

mslinn commented 9 months ago

The Wiki says:

Linux
Use [LinuxBrew](https://docs.brew.sh/Homebrew-on-Linux) (now HomeBrew on Linux).

brew install languagetool
The LanguageTool server jar will be installed to:

/home/linuxbrew/.linuxbrew/opt/languagetool/libexec/languagetool-server.jar

Run a Local LanguageTool Service

I do not know anyone who uses LinuxBrew. The most popular Linux distro is Ubuntu, and it can use either PPA packages (installed using apt) and snaps.

The official snap package for languagetool is here: https://snapcraft.io/install/languagetool/ubuntu

You could just copy their installation instructions:

image

davidlday commented 8 months ago

Thanks for the feedback, @mslinn - I agree, my instructions are a bit outdated. My original thinking was to stick with relatively easy, cross-Linux instructions. LinuxBrew is no more, as it's been folded into Homebrew, which works on both MacOS and Linux.

I'll put this on my todo list. I'm reluctant to copy/paste from other sites as that means more work for keeping things updated, but I will link to instructions for some of the more popular distributions. I use Ubuntu as well as Homebrew. Alpine has come up as well in prior issues, and I suppose CentOS makes sense, too. If you have other distros you think would cover a broad group, let me know.

mslinn commented 8 months ago

CentOS has been discontinued. Linux is so diverse that it would be difficult to provide instructions for all distros. Just telling people the snap installation line, then providing a link to the Ubuntu page would likely be enough.

edouard-lopez commented 8 months ago

Thanks, for the time you spent on the project :heart:

Same here, I never used *brew and was surprised to see it in the wiki. When I set up the server locally I used LanguageTool doc on how to setup the server using the jar file (it was a few years back).

Now some distro have package for it. You can find package availability for other distros on:

ryan-carpenter commented 6 months ago

Configuring the linter was definitely confusing for me, but mostly because of gaps in the LanguageTool documentation (and in my knowledge about using java and .jar files).

To install on openSUSE Tumbleweed, this is what I did:

  1. Install LanguageTool from the official openSUSE repository.
zypper install languagetool

I did not know if this was the same as the "desktop version for offline use" available from https://dev.languagetool.org/http-server. The openSUSE package installed LanguageTool in /usr/share/languagetool/, which is where I found language-server.jar.

  1. Install fastText from openSUSE.
zypper install python311-fasttext

Again, I was not sure if this was what I needed, but it worked successfully and created a fasttext shell command. Note that the repo also includes python39-fasttext, python310-fastext, and python312-fasttext packages. I chose python311-fasttext to match the Python version (default) already on my system.

  1. Download the fastText language identification model.
cd /usr/bin/
wget https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin 

The instructions did not suggest where to save the model, so I used the same directory as the fastText executable.

  1. Create a server.properties file in with the following contents.
    fasttextModel=/usr/bin/lid.176.bin
    fasttextBinary=/usr/bin/fasttext

The instructions did not suggest where to create the properties file or explain how to use an 'external' directory, so I used the same directory as languagetool-server.jar (/usr/share/languagetool/)

  1. Start the LanguageTool server (from the usr/share/languagetool/ directory, as a regular user)

    java -cp languagetool-server.jar org.languagetool.server.HTTPServer --config server.properties --port 8081 --allow-origin "*"

    Note the asterisk, which is not shown in the LanguageTool documentation. The server failed to start until I added "*".

  2. Follow the rest of the vscode-languagetool-linter instructions.

Edit: corrected server.properties contents.