Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>DLH.io SQL OptimizerNew to Visual Studio Code? Get it now.
DLH.io SQL Optimizer

DLH.io SQL Optimizer

DLH.io

|
13 installs
| (1) | Free
DLH.io SQL Formatter and Optimizer extension for VS Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

DLH.io SQL Optimizer

A powerful VS Code extension for formatting and optimizing SQL queries using the @dlh.io/dlh-sql-formatter package.

Features

1. SQL Formatter Panel

Open a dedicated panel to paste and format SQL with full control over all formatting options.

  • Command: DLH SQL: Open SQL Formatter Panel
  • Keyboard Shortcut: Ctrl+Shift+Q (Windows/Linux) / Cmd+Shift+Q (Mac)

SQL Formatter Panel

2. Format SQL Queries in Files

Format individual SQL queries or entire SQL files with a single command.

  • Format Selection/File: DLH SQL: Format SQL Query
  • Format Each Query: DLH SQL: Format Each SQL Query in File
  • Keyboard Shortcut: Ctrl+Shift+F (Windows/Linux) / Cmd+Shift+F (Mac) in SQL files

3. CodeLens Buttons (Inline Actions)

Clickable buttons appear above each SQL query, allowing you to format or optimize queries with a single click.

CodeLens Buttons

  • ⚡ Optimize SQL - Optimize the query (coming soon)
  • 📄 Format SQL - Format the query using your configured options

CodeLens works in:

  • SQL files (.sql, .mysql, .postgres, etc.)
  • Embedded SQL in TypeScript, JavaScript, Python, Java, C#, Go, Rust, PHP, Ruby

Supported SQL Dialects

  • Standard SQL
  • BigQuery
  • DB2 / DB2i
  • Hive
  • MariaDB
  • MySQL
  • N1QL (Couchbase)
  • PL/SQL (Oracle)
  • PostgreSQL
  • Amazon Redshift
  • SingleStoreDB
  • Snowflake
  • Spark SQL
  • SQLite
  • Transact-SQL (SQL Server)
  • Trino

Configuration Options

Configure formatting options in VS Code settings (Preferences > Settings > Extensions > DLH SQL Optimizer):

Option Default Description
language sql SQL dialect to use
tabWidth 2 Spaces per indentation level
useTabs false Use tabs instead of spaces
keywordCase upper Case for keywords (preserve/upper/lower)
identifierCase preserve Case for identifiers
dataTypeCase upper Case for data types
functionCase upper Case for function names
indentStyle standard Indentation style
commaPosition trailing Position of comma
logicalOperatorNewline before AND/OR placement
expressionWidth 50 Max inline expression width
linesBetweenQueries 2 Blank lines between queries
denseOperators false Remove operator spacing
newlineBeforeSemicolon false Semicolon on new line
enableCodeLens true Show CodeLens buttons

Usage Examples

Using the Formatter Panel

  1. Open Command Palette (Ctrl+Shift+P)
  2. Run "DLH SQL: Open SQL Formatter Panel"
  3. Paste your SQL in the input area
  4. Adjust formatting options as needed
  5. Click "Format SQL" or press Ctrl+Enter
  6. Copy the result or insert directly into your editor

Using CodeLens

  1. Open a SQL file or a file with embedded SQL
  2. Look for the "⚡ Optimize SQL" and "📄 Format SQL" buttons above queries
  3. Click to format or optimize the specific query

Keyboard Shortcuts

Shortcut Command
Ctrl+Shift+Q Open SQL Formatter Panel
Ctrl+Shift+F Format SQL (in SQL files)

Installation

From VSIX

  1. Download the .vsix file
  2. Open VS Code
  3. Run "Extensions: Install from VSIX..." from Command Palette
  4. Select the downloaded file

From Source

git clone https://github.com/datalakehouse/dlh-sql-optimizer-vscode.git
cd dlh-sql-optimizer-vscode
npm install

Then press F5 to run the extension in development mode. To get the .vsix file and install it as extension, use the command below and follow vsix installation.

vsce package

In case of errors run npm run clean and then run the above command.

Requirements

  • VS Code 1.75.0 or higher
  • Node.js 16+ (for development)

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

  • Report Issues
  • DLH.io Website
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft