Indentation within "with clause" when using "Reformat Code"

Answered

What preference in Code Style -> SQL -> General controls the following:

  1. The indentation of the block of SQL within the with
  2. The location of the trailing parentheses

In the screenshot below, you can see my desired format at the top, and what actually happens when I use the "Reformat Code" menu item at the bottom.

 

4 comments
Comment actions Permalink

Please share the code as a text, so I could test it and provide you with a proofed answer. 

Btw, you can select a code fragment, hit Alt+Enter, and invoke the "Adjust Code Style" action to see all the settings applied in the region. 

0
Comment actions Permalink
with terr as (
select territory_number, territory_name, region_number, region_name
from territories
)
select *
from terr
order by 1;
0
Comment actions Permalink

To place closing bracket on new line: Preferences | Editor | Code Style | SQL | General | Queries | Subquery | Place the closing parenthesis | Unindented : https://i.imgur.com/EenE86Y.png

To place SELECT on new line: Preferences | Editor | Code Style | SQL | General | Queries | Subquery | Place subquery | Wrapped unindented https://i.imgur.com/9zchCmo.png

 

1
Comment actions Permalink

Thank you!!! That fixed my formatting problem!

0

Please sign in to leave a comment.