A VS Code extension that checks selected English paragraphs in Markdown and LaTeX files using either Trinka or Sapling grammar APIs, shows suggestions as diagnostics, and provides quick fixes to apply or reject suggestions.
Features
Select a paragraph in a Markdown or LaTeX file and run a grammar check.
Choose between two providers: trinka or sapling.
Status bar shows the current provider and allows toggling.
Suggestions appear in Problems as diagnostics with quick actions to apply or reject.
Configurable supported languages, file extensions, default provider, API keys, and default keybindings.
Quick Start
Build and run the extension in the Extension Development Host:
npm install
npm run build
# Press F5 in VS Code to launch the extension host
Configure API keys (Settings -> Extensions -> Grammar Extension Settings):
grammer.trinkaApiKey — your Trinka API key
grammer.saplingApiKey — your Sapling API key
Optionally set default provider:
grammer.defaultProvider — sapling or trinka (default: sapling)
Select a paragraph in a .md or .tex file and run the command:
Command Palette: Grammar: Check Selection (or use the status bar button)
Commands
Grammar: Check Selection (grammer.checkSelection) — Run grammar check using the configured default provider.
Grammar: Toggle Provider (grammer.toggleProvider) — Toggle between Trinka and Sapling and update the setting.
API keys are stored in workspace/user settings as plain text in this implementation. For improved security, consider storing them in context.secrets and use a command to set them securely.
The Sapling API response parsing attempts to compute absolute offsets. Some edge cases (sentence offsets vs paragraph offsets) may produce slightly off ranges; if so, check the suggestions list and apply manually.
Development
The source code is in src/. TypeScript is used; build with npm run build.