 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
[12.1.279 Pro] - Text Length for In-line Parentheses |
|
There is something fishy with the settings named in the title. I recall it working properly in the past but now it glitches.
I have the formatting setting Text Length for In-line Parentheses set to 180 and the following code in the editor:
 |
 |
SELECT u.*
,(SELECT ui.`name`
FROM `user_include` AS ui
WHERE 1 = 1
AND ui.`login` = u.`login`) AS y
,(CASE
WHEN a = 1 THEN 1
ELSE 0
END) AS x
FROM `cte_user` AS u
WHERE 1 = 1
AND EXISTS (SELECT 1
FROM `user_include` AS ui
WHERE 1 = 1
AND ui.`login` = u.`login`)
|
According to my formatting rule this should end up like this:
 |
 |
SELECT u.*
,(SELECT ui.`name` FROM `user_include` AS ui WHERE 1 = 1 AND ui.`login` = u.`login`) AS y
,(CASE WHEN a = 1 THEN 1 ELSE 0 END) AS x
FROM `cte_user` AS u
WHERE 1 = 1
AND EXISTS (SELECT 1 FROM `user_include` AS ui WHERE 1 = 1 AND ui.`login` = u.`login`)
|
However, it becomes this instead:
 |
 |
SELECT u.*
,(SELECT ui.`name`
FROM `user_include` AS ui
WHERE 1 = 1
AND ui.`login` = u.`login`) AS y
,(CASE WHEN a = 1 THEN 1 ELSE 0 END) AS x
FROM `cte_user` AS u
WHERE 1 = 1
AND EXISTS (SELECT 1
FROM `user_include` AS ui
WHERE 1 = 1
AND ui.`login` = u.`login`)
|
The CASE part gets single-lined correctly, but the two subqueries, both being much shorter than 180 characters, are formatted as if they were longer than 180. Even if I include the surplus spaces between the opening and closing brackets in the original code, the subqueries are shorter than 110 characters, yet they aren't formatted to make a single line. At first, I thought that SA breaks the subquery in the SELECT part into multiple lines so that it can align the alias name (it shouldn't) but that does not explain why the subquery in the WHERE part isn't formatted correctly either.
|
|
Tue Nov 08, 2022 7:27 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|