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

已回答

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.

 

2

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
with terr as (
select territory_number, territory_name, region_number, region_name
from territories
)
select *
from terr
order by 1;
0

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

 

2

Thank you!!! That fixed my formatting problem!

1

请先登录再写评论。