IntelliJ IDEA 2019.2 Help

Configuring the SQL code style

Change code style settings

Customize formatting rules for the SQL code: alignment, wrapping, and indentation.

  1. Click File | Settings | Editor | Code Style | SQL.

  2. Select all the necessary code style settings on the available tabs.

  3. Click Apply.

Create a code style for a dialect

  1. Open Settings | Editor | Code Style | SQL.

  2. Click the Gear icon (The Gear icon), and select Duplicate.

  3. Type a name for a new style, and press Enter.

  4. Select all the necessary code style settings, and click Apply.

Configure code styles per data source

After you created a style for a dialect, you can apply this style to the data source that uses this dialect.

  1. Right-click a data source and select Properties.

  2. Click the Options tab.

  3. In the Code style drop-down menu, select a style that you want to apply.

  4. Click Apply.

Apply the SQL style to a file from the context menu

You can format files from the context menu without opening them.

In the Files tool window (View | Tool Windows | Files), right-click a directory and select Reformat Code.

Apply the SQL style to a file from the context menu
Last modified: 23 August 2019