Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>pgFormatter2 - SQL FormatterNew to Visual Studio Code? Get it now.
pgFormatter2 - SQL Formatter

pgFormatter2 - SQL Formatter

Ninh Pham

|
2 installs
| (1) | Free
A VSCode ext that formats SQL using `pg_format` cli
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

pgFormatter2

A lightweight VS Code extension that integrates the powerful pg_format CLI for SQL formatting. No npm package dependencies, no abstraction, no magic. It simply runs pg_format with the arguments you configure. Automatically respects your IDE's tab and space size settings.

Overview

pgFormatter2 bridges VS Code and the pg_format CLI, enabling direct SQL formatting within the editor. The extension executes the pg_format command with your configured settings and applies the formatted result to your SQL selections.

Requirements

The pg_format command must be installed on your system. See pgFormatter documentation for installation instructions.

Installation

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for "pgFormatter"
  4. Click Install

Configuration

Configure pgFormatter behavior in VS Code settings under the pgFormatter section.

Core Settings

  • pgFormatter.pg_format_path - Path to the pg_format executable (default: pg_format)

Formatting Options

Full documentation: pgFormatter documentation.

Boolean options can be enabled/disabled individually. Set to null to omit from formatting.

  • pgFormatter.--anonymize - Obscure all literals in queries
  • pgFormatter.--debug - Enable debug mode
  • pgFormatter.--wrap-comment - Apply wrapping to comments
  • pgFormatter.--nogrouping - Do not group statements
  • pgFormatter.--keep-newline - Preserve empty lines in PL/pgSQL
  • pgFormatter.--no-extra-line - Do not add extra empty line at end
  • pgFormatter.--multiline - Enable multi-line search
  • pgFormatter.--nocomment - Remove comments
  • pgFormatter.--numbering - Add statement numbering
  • pgFormatter.--redshift - Enable Redshift keywords
  • pgFormatter.--format-type - Try alternative formatting type
  • pgFormatter.--no-rcfile - Do not read rc files automatically
  • pgFormatter.--no-space-function - Remove space before function parenthesis
  • pgFormatter.--redundant-parenthesis - Do not remove redundant parentheses
  • pgFormatter.--comma-start - Start list with comma
  • pgFormatter.--comma-end - End list with comma
  • pgFormatter.--comma-break - Break after each comma

Other Options

  • pgFormatter.--config - Path to configuration file
  • pgFormatter.--placeholder - Regex for protected code
  • pgFormatter.--separator - Dynamic code separator
  • pgFormatter.--extra-function - File containing extra functions
  • pgFormatter.--extra-keyword - File containing extra keywords
  • pgFormatter.--maxlength - Maximum query length
  • pgFormatter.--wrap-limit - Wrap queries at column width
  • pgFormatter.--wrap-after - Wrap lists after N columns
  • pgFormatter.--format - Output format: text or html (default: not set)
  • pgFormatter.--function-case - Function case: 0 (unchanged), 1 (lowercase), 2 (uppercase), 3 (capitalize)
  • pgFormatter.--keyword-case - Keyword case: 0 (unchanged), 1 (lowercase), 2 (uppercase), 3 (capitalize)
  • pgFormatter.--type-case - Type case: 0 (unchanged), 1 (lowercase), 2 (uppercase), 3 (capitalize)

Example Configuration

Add to your VS Code settings.json:

{
  "pgFormatter.--wrap-after": 2,
}

License

GNU Affero General Public License v3.0

Author

Ninh Pham (ReeganExE)

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft