Kami
  • Posts: 1
  • Joined: 9/8/2014
Hello There,

I've some Suggestions to make.

I have this code:

SELECT
	a.col1,
	a.col2,
	b.col1,
	c.col1
FROM
	table1 a
	INNER JOIN table2 b ON a.col1 = b.col1
	INNER JOIN table3 c on a.col1 = c.col1 AND b.col1 = c.col2
WHERE
	(
		a.col1 = '1'
		OR a.col1 = '2'
	)
	AND b.col2 = 3


Which is fine for me.
So i tried to format this from an unformatted form, with your formatter...
SELECT a.col1, a.col2, b.col1, c.col1 FROM table1 a INNER JOIN table2 b ON a.col1 = b.col1 INNER JOIN table3 c on a.col1 = c.col1 AND b.col1 = c.col2 WHERE (a.col1 = '1' OR a.col1 = '2') AND b.col2 = 3


and got this one:

SELECT
	a.col1,
	a.col2,
	b.col1,
	c.col1
FROM
	table1 a
	INNER JOIN table2 b ON a.col1 = b.col1
	INNER JOIN table3 c on a.col1 = c.col1 AND b.col1 = c.col2
WHERE
	(a.col1 = '1' OR a.col1 = '2') AND b.col2 = 3


So basicly it's fine. Except that if i have long tablenames and long joins with "AND" it will do a linebreak eventually and put it into the next line.
But i can't design the format for brackets and where statements. So it will not intend like i want it.

Next problem: brackets..
If you implement formatting please make sure that this:

WHERE
	(col1 = 1)
	AND 
	(
		(col2 = 2)
		OR (col2 = 3)
	)
	AND col3 = 4


doesn't get you this:

WHERE
	(
		col1 = 1
	)
	AND 
	(
		(
			col2 = 2
		)
		OR 
		(
			col2 = 3
		)
	)
	AND col3 = 4


That would be great! Thanks.
Andrei
  • Posts: 398
  • Joined: 7/1/2012
Thanks, will be considered !
GrahamWade
  • Posts: 1
  • Joined: 9/29/2014
I would like the option to indent "Try/ Catch" blocks and also "begin transaction"/ "commit transaction" blocks. The block indent doesn't seem to work for these.
kuark7
  • Posts: 2
  • Joined: 11/11/2014
I agree with GrahamWade - it's problematic to not have options for formatting try-catch blocks. Would like the ability to indent them.

Thank you for considering.
ikjeft01
  • Posts: 2
  • Joined: 9/12/2014
I agree with Kami on the nested AND/OR example.

I want to suggest that code like "WHERE userID in (1,2,3,4,5)" doesn't reformat to
"WHERE userID IN (
1
, 2
, 3
, 4
, 5
)
"

but it is ok for

"WHERE userName IN (
'Alice'
, 'Bob'
, 'Carol'
)
"

I realize this may not be incredibly easy to figure out, so maybe a configuration that determines how many characters each element in the "IN" clause must be before splitting lines (in other words, in my both examples, this value could be 2; the first example stays on one line because all the elements are less than or equal to 2, and the second example splits lines because at least one element is greater than 2).
NMGod
  • Posts: 1
  • Joined: 6/29/2015
I would also like some more formatting options around brackets.

The current formatting is horrible.
Similar Topics
  • You cannot post new topics in this forum.
  • You cannot reply to topics in this forum.
  • You cannot delete your posts in this forum.
  • You cannot edit your posts in this forum.
  • You cannot create polls in this forum.
  • You cannot vote in polls in this forum.