Datagrip expand column list to new line with comma at beginning

42 Views Asked by At

In DataGrip, I want to expand the column list of a SELECT * and put every item onto a new line with a comma at the beginning. This would involve a combination of code style settings.

However, when setting the "Place comma" style to "To beginning", the items in the list no longer appear on a new line each - they appear in one line.

Is it possible in DataGrip for each expanded item to appear on a new line prefixed with a comma?

2

There are 2 best solutions below

3
Tim Biegeleisen On

Assuming you have regex replacement available, you could try something as simple as:

Find:    ,\s*
Replace: ,\n

But you would need to make sure that you are only targeting the SELECT clause. If there were other CSV lists of columns, the above would replace those too. Check the demo here.

0
moscas On