Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>SQL WeaverNew to Visual Studio Code? Get it now.
SQL Weaver

SQL Weaver

rkab

| (0) | Free
Highlight and format inline SQL inside host language files.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SQL Weaver

!!!This extension is fully vibecoded, it only tested more or less with golang and sqruff. Use with care

SQL Weaver highlights SQL embedded inside other source files, adds parser-backed SQL semantic coloring inside matched regions, and can format the matched SQL without touching the surrounding code.

Features

The default configuration recognizes:

  • JavaScript and TypeScript tagged templates like sql\select * from users``.
  • JavaScript and TypeScript strings marked with /* sql */.
  • Python triple-quoted strings preceded by # sql.

Use the command palette or editor context menu:

  • SQL Weaver: Format SQL at Cursor
  • SQL Weaver: Format All SQL in Document

Configuration

Matching SQL

sqlweaver.patterns is an array of regex matchers. Each matcher highlights and formats one capture group.

Default configuration:

{
  "sqlweaver.enabled": true,
  "sqlweaver.languages": [
    "go",
    "python",
    "typescript",
    "typescriptreact",
    "javascript",
    "javascriptreact"
  ],
  "sqlweaver.patterns": [
    {
      "name": "go const Query raw string",
      "regex": "\\bconst\\s+\\w*Query\\s*=\\s*`([\\s\\S]*?)`",
      "captureGroup": 1
    },
    {
      "name": "sql tagged template",
      "regex": "\\bsql\\s*`([\\s\\S]*?)`",
      "captureGroup": 1
    },
    {
      "name": "comment marked template",
      "regex": "/\\*\\s*sql\\s*\\*/\\s*`([\\s\\S]*?)`",
      "captureGroup": 1
    },
    {
      "name": "comment marked string",
      "regex": "/\\*\\s*sql\\s*\\*/\\s*([\"'])([\\s\\S]*?)\\1",
      "captureGroup": 2
    },
    {
      "name": "python sql comment triple quote",
      "regex": "#\\s*sql\\s*\\r?\\n\\s*[rRuUfF]*([\"']{3})([\\s\\S]*?)\\1",
      "captureGroup": 2,
      "flags": "m"
    }
  ],
  "sqlweaver.dialect": "postgresql",
  "sqlweaver.formatterCommand": "sqruff",
  "sqlweaver.formatterArgs": ["fix", "--config", "${workspaceFolder}/.sqruff", "-"],
  "sqlweaver.highlightBackground": null,
  "sqlweaver.highlightBorder": null
}

Formatting

SQL Weaver formats through an external command. Configure the formatter executable and arguments:

{
  "sqlweaver.formatterCommand": "sql-formatter",
  "sqlweaver.formatterArgs": ["--language", "postgresql"]
}

SQL Weaver sends the SQL region to the formatter on stdin and replaces it with stdout. Formatter commands run from the current workspace folder. formatterArgs supports ${workspaceFolder} and ${file}.

Sqruff example:

{
  "sqlweaver.formatterCommand": "sqruff",
  "sqlweaver.formatterArgs": ["fix", "--config", "${workspaceFolder}/.sqruff", "-"]
}

Minimal .sqruff for PostgreSQL and :project placeholders:

[sqruff]
dialect = postgres
templater = placeholder
max_line_length = 40

[sqruff:templater:placeholder]
param_style = colon

Dialects

Inline highlighting is powered by node-sql-parser. Configure the SQL dialect with sqlweaver.dialect:

{
  "sqlweaver.dialect": "postgresql"
}

Supported values include mysql, postgresql, sqlite, bigquery, mariadb, transactsql, snowflake, trino, and others exposed by node-sql-parser.

Settings

  • sqlweaver.enabled: Enable or disable highlighting.
  • sqlweaver.languages: VS Code language IDs to scan. Empty means all languages.
  • sqlweaver.patterns: Regex matchers for inline SQL regions.
  • sqlweaver.dialect: SQL dialect used by node-sql-parser.
  • sqlweaver.formatterCommand: External formatter executable.
  • sqlweaver.formatterArgs: Arguments for the external formatter.
  • sqlweaver.highlightBackground: Optional decoration background. Defaults to no background.
  • sqlweaver.highlightBorder: Optional decoration border. Defaults to no border.

Known Limitations

  • Inline syntax coloring is semantic-token based, not full TextMate grammar injection.
  • Regex matchers do not parse the host language, so tune patterns for your project style.
  • Formatting requires an external formatter command such as Sqruff or sql-formatter.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft