How can we help you today? How can we help you today?

Parenthetical Indentation within a CASE expression

Most of the new indentation options are awesome, but I've seen some strange behavior with parentheses. In the query below, shouldn't the 'IN' list be indented from the CASE?
SELECT Field = CASE
					WHEN 'LongStringToEnsureThisDoesNotStayOnOneLine' IN
	(
		'SomeOtherRandomLongString'
	   ,'YetOtherRandomLongString'
	)
					THEN 'WhyAreTheseParenthesesWrong?'
					ELSE 'RedGateIsStillAwesomeThough'
			   END

Currently running Version 7.3.0.598
a.higgins
0

Comments

3 comments

  • Aaron L
    Hi a.higgins,

    Thanks for the script! :) We're looking into this now and should hopefully have a fix in the next beta build.

    Thanks,
    Aaron.
    Aaron L
    0
  • a.higgins
    This solves the IN () indentation, but there still seems to be some issues with other types of parenthetical indentations: for example
    SELECT Field = CASE
    					WHEN
    	(
    		'LongStringToEnsureThisDoesNotStayOnOneLine' LIKE '%xya%' OR
    		'SomeOtherRandomLongString' LIKE '%qwe%' OR
    		'YetOtherRandomLongString' LIKE '%aslpha%'
    	) AND
    	'WhyAreTheseParenthesesWrong?' IS NOT NULL
    					THEN 'Help'
    					ELSE 'All Fixed Now'
    			   END
    
    a.higgins
    0
  • a.higgins
    Another example, though this one isn't within a CASE:
    SELECT
    	SimpleField	 = 'xyz'
       ,AnotherField =
       ( -- I'd expect this to be indented to align with the 'xyz' string out past the equals sign
    	   SELECT TOP 1
    		   t.TABLE_NAME
    	   FROM INFORMATION_SCHEMA.TABLES t
       )
    
    a.higgins
    0

Add comment

Please sign in to leave a comment.