Hi,
I've just downloaded 2.14 to give the new formatter a try. It's a good tool, but if it could deal with these scenarios too then it would be fantastic:
1. Aligning parentheses. Ideally this would be configurable based upon the number of characters between the matching parentheses.
For example:
SELECT D.col3
FROM DATA AS D
WHERE EXISTS
( -- I think the best general rule is if the gap between the parentheses is big, then have them start and end on a new line like this
SELECT 1
FROM OTHER AS O
WHERE O.col1 = D.col1
AND O.col2 = D.col2
)
But while at the same time, still allowing parentheses to remain in a single line when they're close together:
DECLARE @this NUMERIC(16,6) -- parentheses in data types (close together)
, @that VARCHAR(50)
SELECT col3 = ISNULL(D.col3,0) -- function parentheses. Normally close together. It's fine to wrap into multiple lines if the gap is very big.
FROM DATA AS D
WHERE D.col4 = 1
AND (@this = 3 OR @that = 'Value') -- parentheses in simple logic (still quite close together)
2. Aligning multi-part / multi-line join conditions, for example:
SELECT D.col7
, O.col8
FROM DATA AS D
INNER JOIN OTHER AS O
ON O.col1 = D.col2
AND O.col3 = D.col4
AND O.col5 = D.col6
3. Aligning column aliases (similar to how you already do this with UPDATE statements), for example:
SELECT alias1 = col1
, a2 = col2
, verylongalias3 = col3
FROM DATA
4. Aligning the 'END' with the 'CASE' in a case statement, for example:
SELECT
calcval = CASE
WHEN col1 = 1 THEN 100
WHEN col2 = 1 THEN 200
ELSE 300
END
FROM DATA
Thanks!