(14.0.15.577) Code formatter, Lists formatting with inline comments

Hi,
Ive configured the code formatter to use "Stacked on overflow or more than..." to format lists. This works as long as the list does not contain any inline comments:

SELECT *
  FROM DUAL
 WHERE dummy IN ('X', 'Y');

As soon as there are inline comments this becomes:

SELECT *
  FROM DUAL
 WHERE dummy IN ('X', -- Option 1
                      'Y' -- Option 2
                         );

Is there any way to configure the formatter to get a correct alignment in this case?

BR
Dirk

1 Like

Hi Dirk,

Formatter wants to output 'X', 'Y' on a single line, but can't do that due to the inline comments. So it continues with 'Y' at the same horizontal position as would have been without end-of-line comments. That's how it works.
Having said that, it could be an idea to have the formatter automatically stack the items in case of one or more end-of-line comments found in between the list. That may be what you prefer, correct?

I created an issue for that, but without any guarantee on when it would become available. (QP-3751)

Thanks,
Andre

1 Like

Hi Andre,

Many thanks for the explanation. This corresponds to what I already suspected.

I think we agree that the behaviour is not helpful in this way :wink:

My expectation would be that the formatter automatically stacks the entries as soon as a new line is necessary due to a comment.

BR
Dirk

Dirk,

I'll first assess how large the fix could be. If within hours then I'll do it asap. It looks a good enhancement, and I'm even wondering why it took that long before someone came up with it. :slight_smile: Thanks!

Andre

1 Like

Eventually you begin to just accept things :wink: Would also love to see this get fixed.