vscode-languagetool-linter icon indicating copy to clipboard operation
vscode-languagetool-linter copied to clipboard

A from scratch redesign of LanguageTool integration for VS Code.

LanguageTool Linter for Visual Studio Code

GitHub Workflow Status Visual Studio Marketplace Installs Visual Studio Marketplace Rating (Stars)

Grammar, Style and Spell Checking in VS Code via LanguageTool. Support Markdown, MDX, HTML, and plain text files.

In memory of Adam Voss, original creator of the LanguageTool for Visual Studio Code extension.

Features

  • Issue highlighting with hover description.
  • Replacement suggestions.
  • Checks plain text, Markdown, MDX, and HTML.
  • Smart format on type to replace quotes with smart quotes, multiple consecutive hyphens with em or en-dash, and three consecutive periods with ellipses.
    • Make sure 'Editor: Format On Type' is enabled or this feature won't work. You can enable it at the document format level as well in your settings.json.

Setup

The defaults are probably not going to work for you, but they are there to make sure using LanguageTool's Public API is done by choice. See this issue on the Atom LanguageTool Linter for an explanation why.

The defaults assume the following:

  1. You do not want to use the LanguageTool's Public API

  2. You're running LanguageTool HTTP Server on your machine using the default port of 8081.

  3. You do not want to have this extension manage your local LanguageTool HTTP Server service.

If this doesn't work for you, here are your options.

Option 1: Use an External Service

This could either be a locally running instance of LanguageTool, or the service running somewhere else.

  1. Set the URL in “LanguageTool Linter > External: URL” (i.e. http://localhost:8081).
  2. Set “LanguageTool Linter: Service Type” to external.

External URL

Option 2: Use an Extension-Managed Service

Works well if you're only using LanguageTool in Visual Studio Code.

  1. Install LanguageTool locally.
  2. Set “LanguageTool Linter > Managed: Jar File” to the location of the languagetool-server.jar file. The install doc has hints.
  3. Set “LanguageTool Linter: Service Type” to managed.

Managed Service

Option 3: Public API Service

Make sure you read and understand LanguageTool's Public API before doing this.

  1. Set “LanguageTool Linter: Service Type” to public.

Public API

Configuration Notes

Most configuration items should be safe, but there are three you should pay particular attention to:

  1. Public Api: This will use LanguageTool's Public API service. If you violate their conditions, they'll block your IP address.
  2. Lint on Change: This will make a call to the LanguageTool API on every change. If you mix this with the Public Api, you're more likely to violate their conditions and get your IP address blocked.
  3. LanguageTool: Preferred Variants: If you set this, then LanguageTool: Language must be set to auto. If it isn't, the service will throw an error.

Credits

The following projects provided excellent guidance on creating this project.