2 years ago

#36271

test-img

Francois Evert

toad formatter starts next line under trailing comments

I find that toad formatter starts the next line of code under trailing comments. Is there a way to change this. This happens regardless of wrapping/stacking options.

e.g. Original SQL:

SELECT C1, C2, C3, C4, C5 FROM DUAL 

Now I add a trailing comment after C3:

SELECT C1, C2, C3 -- this is a test
, C4, C5 FROM DUAL

Result of formatting - C4 starts below the trailing comment:

SELECT C1, C2, C3 -- this is a test
                 , C4, C5 FROM DUAL

Preferred solution - Stack the columns:

SELECT C1
     , C2
     , C3 -- this is a test
     , C4
     , C5
  FROM DUAL

Is there a setting I can use to change this?

Kind regards

fe

Decided to add another example where the comment is in the WHERE clause:

Original SQL:

SELECT C1
     , C2
     , C3
  FROM DUAL
 WHERE C1 = 1 AND C2 = 2 AND C3 = 3

Adding comment and formatting:

SELECT C1
     , C2
     , C3
  FROM DUAL
 WHERE C1 = 1 AND C2 = 2 -- this is a test
                         AND C3 = 3

Preferred solution :

SELECT C1
     , C2
     , C3
  FROM DUAL
 WHERE C1 = 1 
   AND C2 = 2 -- this is a test
   AND C3 = 3

fe

formatting

comments

toad

trailing

0 Answers

Your Answer

Accepted video resources