VS Code TextMate Grammar Updater

1.1.0 · maintenance · verified Sun Apr 19

The `vscode-grammar-updater` package is a specialized utility designed by Microsoft to manage and synchronize TextMate grammars within Visual Studio Code language extensions. Its primary function is to update grammar definitions from their source repositories, ensuring that syntax highlighting and other language features in VS Code extensions remain current. The current stable version is 1.1.0, published approximately four years ago, indicating a maintenance-focused development cycle tied closely to VS Code's internal needs rather than an independent, rapid release schedule. This tool is a key differentiator for VS Code extension developers, providing a built-in mechanism for integrating external TextMate grammar updates directly into the extension ecosystem, which might otherwise require manual, error-prone synchronization processes.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates typical usage via an `npm` script in `package.json`, which is the most common way this utility is invoked for updating TextMate grammars within a VS Code extension project.

{
  "name": "my-vscode-extension",
  "version": "0.0.1",
  "description": "My VS Code language extension with a custom grammar.",
  "scripts": {
    "update-grammar": "vscode-grammar-updater --sourceRepoUrl https://github.com/my-org/my-lang-grammar --targetFilePath ./syntaxes/mylang.tmLanguage.json --cacheDir ./.grammar-cache"
  },
  "devDependencies": {
    "vscode-grammar-updater": "^1.1.0"
  }
}

// To run this, first save the above as `package.json` in your extension root,
// then install dependencies:
// npm install

// Then execute the update script:
// npm run update-grammar

// This script attempts to fetch and update the grammar from 'my-org/my-lang-grammar'
// and place it in './syntaxes/mylang.tmLanguage.json', using '.grammar-cache'
// for temporary files. Specific arguments might vary based on the grammar source.

view raw JSON →