Git Product home page Git Product logo

vscode-languagetool-linter's Introduction

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.
  • Allow specific rules to be ignored for markdown (pandoc) and HTML

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.

Ignore rules inline

You have the chance to ignore specific rules inline to not bloat up your ignore list for single words:

<!-- @IGNORE:UPPERCASE_SENTENCE_START@ -->
soll heißen, dass die Nachricht von mir ist, die Koordinaten hat
ein kleiner Computer, den Sigrún mir zur Verfügung gestellt hat aus
dem irdischen
‚World Geodetic System 1984‘ <!-- @IGNORE:GERMAN_SPELLER_RULE(Geodetic)@ -->

This example will ignore the missing capital letter at the beginning (soll → Soll) and an unknown word ('Geodetic')

The optional match word is useful if the same rule is applied to several words in the sentence.

The rules can be applied to the current line (e.g. at the end) or at the line before.

Syntax:

@LT-IGNORE:<rulename>(<text-match>)@

The and the text-match is optional.

Note: Even in pandoc you have to handle the comment in html output. This can be done by using a filter.

Credits

The following projects provided excellent guidance on creating this project.

vscode-languagetool-linter's People

Contributors

davidlday avatar dependabot-preview[bot] avatar dependabot[bot] avatar jonasbb avatar shicholas avatar steven-r avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.