Datagrip SQL Code Formatting: JOIN / ON / AND Indention

I would like the `and` in the join below to indent in alignment with `on`, but cannot locate the appropriate setting. Any suggestions?

Expected

left join b
  on b.id = a.id
  and b.line_id = a.line_id

Actual

left join b
  on b.id = a.id
and b.line_id = a.line_id
0
5 comments

You need to play around with the following setting in File | Settings | Editor | Code Style | SQL | General:

0

I already have that set to `JOIN continuously indented`. The `on` is indented correctly, but the `and` is not. 

If I change to `JOIN indented`, as you have, the `on` is no longer indented. It looks like the following.

left join b
on b.id = a.id
and b.line_id = a.line_id

 

Settings:

0

There is no option to indent the AND clause I'm afraid, but you can achieve the desired result using the following settings:

0

How do you get the “AND” part of the join to go onto a new line? I have tried using the settings suggested in this thread, and they all result in the “AND” being included on the same line as the “ON”. If I manually move the “AND” onto a new line and then reformat, it gets moved back onto the same line as “ON”.

0

Hi Fergus A Mcglynn,

This formatting style has not been implemented. You can follow this feature request to stay updated on the progress. 

0

Please sign in to leave a comment.