Skip to main content

LanguageTool Linter In Docker

VS Code LanguageTool Linter

GitHub.com: VS Code Languagetool Linter

First, install the VS Code LanguageTool extension (Grammar, Style and Spell Checking in VS Code via LanguageTool (languagetool.org). Support Markdown, MDX, HTML, and plain text files.):

marketplace.visualstudio.com: Languagetool Linter

Install Docker software

Then you need to install Docker software on your system.

Run Container in Shell

GitHub.com: Docker Languagetool

Pull the Dockerfile (to get the languagetools running on a system without java):

docker pull silviof/docker-languagetool

Run it:

docker run --rm -p 8010:8010 silviof/docker-languagetool

Run Container in VS-Code

gnulinux.ch: Languagetool In VS Code

Install the Docker extension.

To install the extension, open the Extensions view, search for docker to filter results and select Docker extension authored by Microsoft.

The extension recognizes workspaces that use most popular development languages (C#, Node.js, Python, Ruby, Go, and Java) and customizes generated Docker files accordingly.

Open the Docker view. Click on languagetool image. Right-click on latest. Select Run.

Docker Extension Settings

Open VS-Code settings with Ctrl+,. In the Extensions -> LanguageTool Linter submenu find the External: Url field and insert the server IP-address and the port of your previously configured Docker container. In my case: 192.168.99.100:8010.

LanguageTool Linter Settings

caution

If Docker container was launched on the local computer, not on a server, you need to use the address http://localhost:8010 (or http://127.0.0.1:8010).

Auto run

Add this code to the end of the Microsoft.PowerShell_profile.ps1 file (to open it, run in PowerShell: notepad $profile)

PowerShell
# Preferable alternative: Start-ThreadJob 1
$job = Start-Job { docker-machine start default3}

$Env:DOCKER_TLS_VERIFY = "1"
$Env:DOCKER_HOST = "tcp://192.168.99.101:2376"
$Env:DOCKER_CERT_PATH = "C:\Users\parsh\.docker\machine\machines\default3"
$Env:DOCKER_MACHINE_NAME = "default3"
$Env:COMPOSE_CONVERT_WINDOWS_PATHS = "true"
# Run this command to configure your shell:
& "C:\ProgramData\chocolatey\lib\docker-machine\bin\docker-machine.exe" env default3 | Invoke-Expression

# Preferable alternative: Start-ThreadJob 2
$job = Start-Job { docker run --rm -p 8010:8010 silviof/docker-languagetool }

After that, when you start PowerShell, it first starts the docker-machine and then languagetool linter container in the background.