Skip to content

nagaokayuji/doma-sql-formatter-vscode

Repository files navigation

Doma SQL Formatter

license installs version

A simple SQL Formatter that supports Doma Framework.

Links

Usage

Files can be formatted by the Format Document (or Format Document With... and then select Doma SQL Formatter) option or keyboard shortcuts.

Default keyboard shortcuts:

  • MacOS: ⇧⌥F or Shift+Option+F
  • Windows: Shift+Alt+F
  • Linux: Ctrl+Shift+I

formatter

Force Format

You can choose Doma SQL Formatter: Force Format to force format as SQL.

Features

Supported dialects

  • Standard SQL
  • MariaDB
  • MySQL
  • PostgreSQL
  • DB2
  • PL/SQL
  • N1QL
  • Redshift
  • Spark
  • TSQL

example

Original file:

SELECT * FROM employee
WHERE /*%for name : names */
  employee_name LIKE /* name */'hoge'
  /*%if name_has_next */
  /*# "or" */
  /*%elseif condition */
  /*# hogehoge */
  /*%end */
  /*%end*/
OR salary > 1000

Will be formatted like:

SELECT
  *
FROM
  employee
WHERE
  /*%for name : names */
    employee_name LIKE /* name */'hoge'
    /*%if name_has_next */
      /*# "or" */
    /*%elseif condition */
      /*# hogehoge */
    /*%end */
  /*%end*/
  OR salary > 1000

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published