Skip to content

Type to search extensions

LanguageTool

v0.2.1

Grammar and style checking for Zed using LanguageTool.

Updated 1 month ago
75 downloads 1 star Repository ↗

LanguageTool Zed Extension

LanguageTool integration for Zed. The Zed extension launches a Rust language server, which sends document text to a local or cloud LanguageTool HTTP API and publishes diagnostics and quick fixes through LSP.

Local Development

Run extension checks:

cargo make check

Run a LanguageTool server on localhost:8081, then build the language server from the sibling languagetool-lsp repository and add it to the PATH.

cargo build --manifest-path ../languagetool-lsp/Cargo.toml -p languagetool-lsp

Install this repository as a Zed dev extension. The extension prefers a languagetool-lsp on PATH, then a downloaded release binary.

Example Zed settings:

{
  "lsp": {
    "languagetool": {
      "initialization_options": {
        "backend": { "type": "local", "url": "http://localhost:8081" },
        "language": "en-US",
        "checkOnSave": true,
        "checkWhileTyping": false
      }
    }
  }
}

LanguageTool Backends

Local backend, default:

{
  "backend": { "type": "local", "url": "http://localhost:8081" }
}

Cloud backend:

{
  "backend": { "type": "cloud" },
  "language": "auto",
  "preferredVariants": ["en-US"]
}

Commands

cargo run --manifest-path ../languagetool-lsp/Cargo.toml -p languagetool-lsp -- --root . health
cargo run --manifest-path ../languagetool-lsp/Cargo.toml -p languagetool-lsp -- --root . check test-fixtures/plaintext/basic.txt

Project Config

Workspace quick fixes can create or update .zed/languagetool.json by default.

{
  "ignored_words": ["zed"],
  "disabled_rules": ["WHITESPACE_RULE"],
  "disabled_categories": ["TYPOGRAPHY"]
}

The LSP merges this file with Zed initialization_options. Values from both sources are kept for ignored words and disabled rules/categories.

The path can be changed with projectConfigPath for non-Zed workflows:

{
  "projectConfigPath": ".idea/languagetool.json"
}

Available command-backed quick fixes:

  • Ignore a single matched word in the workspace.
  • Disable a LanguageTool rule in the workspace.
  • Disable a LanguageTool category in the workspace.

After one of these commands updates .zed/languagetool.json, the server rechecks open documents.

Current Scope

  • Plain text, Markdown, MDX, HTML, and a conservative set of common code languages are registered in Zed.
  • Markdown and HTML are sent with LanguageTool data.annotation, marking code fences, inline code, links, tags, scripts, and styles as markup.
  • Code languages currently send comments as text annotations and code as markup, with Python triple-quoted strings treated as documentation.
  • Quick fixes are generated from LanguageTool replacements.
  • Ignore/disable actions persist to the configured project config path.
  • On-change checking is debounced when checkWhileTyping is enabled.
ZedExt An unofficial community project. Not affiliated with Zed Industries.

Data from Zed’s extension registry and GitHub · updated