Skip to content

Releases: andrelopes-code/sql-format-and-highlight

v0.2.0 — Per-block dialect via --sql@<alias> + 5 new formatter knobs

22 May 17:44

Choose a tag to compare

Highlights

  • --sql@<alias> for per-block dialect override. Tag a template literal with --sql@rm and the extension resolves the dialect via sqlFormatAndHighlight.databases:

    "sqlFormatAndHighlight.dialect": "transactsql",
    "sqlFormatAndHighlight.databases": {
      "rm": "transactsql",
      "pesagem": "postgresql"
    }

    Each block is formatted using its alias's dialect. Unmapped aliases fall back to the global dialect silently. The @alias token is compatible with other tools that already use --sql@db for routing — same marker, complementary purposes.

  • Five new settings covering the rest of the sql-formatter surface:

    • dataTypeCaseupper/lower/preserve for INT, VARCHAR, etc. in DDL. Fixes a regression where varchar lowercase leaked through even with keywordCase: upper.
    • useTabs — tab-indented output.
    • expressionWidth — line-wrap threshold.
    • linesBetweenQueries — blank lines between ;-separated statements.
    • newlineBeforeSemicolon — closing ; on its own line.
  • README revamped with a multi-database recipe and a stronger 'set your dialect once' opening — the generic default rejects vendor-specific syntax silently.

  • 12 new T-SQL robustness tests covering bracketed identifiers, DECLARE @var, CTE with ;WITH, MERGE, TOP (N), OUTPUT INTO, @@vars, CROSS APPLY, IDENTITY_INSERT, BEGIN TRY/CATCH, EXEC sp_executesql, and OVER (PARTITION BY). Plus 7 detector tests for @<alias> extraction and 4 for the resolver.

Compatibility

Fully backwards compatible with 0.1.0. The new @<alias> syntax is opt-in; existing markers (--sql, --sql:flag, --sql:rm:verbose) keep working exactly as before.

See CHANGELOG.md for the full detail.

v0.1.0 — Native formatter + interpolation support

22 May 17:03

Choose a tag to compare

Highlights

  • Native formatter provider. Shift+Alt+F (Format Document) and Format Selection now work. Configure as editor.defaultFormatter per language for clean Prettier coexistence.
  • Template literal interpolation preserved. ${expr} (with nested braces and quoted strings) survives formatting via sentinel substitution.
  • Error visibility. Parse failures surface in the SQL Format output channel instead of being swallowed.
  • Consolidated TextMate grammars. A single injection into L:string.template replaces the fragile two-grammar setup.
  • Marketplace metadata. Publisher, license, repository, keywords, icon-ready package layout.
  • Lower engine requirement. engines.vscode dropped from ^1.110.0 to ^1.75.0.

Fixes

  • paramTypes runtime default now matches the schema default ([":"]).
  • Compiled tests no longer ship inside the .vsix.

See CHANGELOG.md for the full list.