Author |
Message |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
[SA 9.0.199 Pro] - Formatting bug [FIXED] |
|
Formatting code with default rules in editor with Ctrl+F11 only works in SQL Editor the first time after starting the editor. Subsequent applications of the formatting have no effect, no matter how garbled the code has become. However, formatting with custom rules (Shift+Ctrl+F11) works properly.
Last edited by gemisigo on Fri Mar 03, 2017 8:31 am; edited 1 time in total |
|
Wed Jan 04, 2017 6:13 am |
|
 |
Mindflux
Joined: 25 May 2013 Posts: 846 Country: United States |
|
|
|
Can you expand on this one?
I've always used Ctrl+F11 and it works more than once in the editor.
I didn't even know Ctrl+Shift+F11 existed, I just tried it and it asked for a rule (though it did NOT show my custom ruleset).
*Edit: to expand on Ctrl+Shift+F11. I see it shows whatever is NOT the default ruleset. So If I switch to a default one and hit Ctrl+Shift+F11 I now see my custom ruleset. Interesting...
|
|
Wed Jan 04, 2017 10:13 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Would it be possible to see the actual code that is not getting reformatted after the first try?
|
|
Wed Jan 04, 2017 10:38 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
 |
 |
Would it be possible to see the actual code that is not getting reformatted after the first try? |
Any. The most obvious one like
 |
 |
SELECT 1 AS a
|
refuses to warp into
 |
 |
SELECT
1 AS a
|
The latter does change into the former if I use custom rule with Shift+Ctrl+F11 which I use to compress code.
UPDATE: Formatting selected code with Ctrl+F11 does work however. It only fails to comply if there's nothing selected. Shift+Ctrl+F11 works in both cases.
Could updating to .199 have to do something with this?
|
|
Wed Jan 04, 2017 11:57 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
 |
 |
refuses to warp into
SELECT
1 AS a
|
I don't think it should warp. The default formatting rule for SELECT for SQL Server targets is
 |
 |
SELECT ... AS ...,
... = ...
INTO ...,
...
FROM ... AS ...,
...
JOIN ...
ON ... = ...
AND ...
WHERE ... = ...
AND ...
OR ...
GROUP BY
...,
...
HAVING ...,
...
ORDER BY
...,
... |
I'm unable to reproduce this issue. I have to admit that "SELECT 1 AS a" isn't helping me.
|
|
Thu Jan 12, 2017 3:39 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
That's because you left the defaults at factory defaults. For me it should warp. I use two formatting rule set, T-SQL Default Style which I have modified rather heavily and have the default for SELECT as
 |
 |
SELECT
... AS ...
,... = ...
FROM
... AS ...
,...
JOIN
...
ON ... = ...
AND ...
OR ...
WHERE ... = ...
AND ...
OR ...
GROUP BY
...
,...
HAVING
...
,...
ORDER BY
...
,...
|
The other ruleset is T-SQL Ext Compact Style which has the following format for SELECT:
 |
 |
SELECT ... AS ..., ... = ...
FROM ... AS ..., ...
JOIN ... ON ... = ... AND ... OR ...
WHERE ... = ... AND ... OR ...
GROUP BY ..., ...
HAVING ..., ...
ORDER BY ..., ...
|
The code in the editor is formatted to default by Ctrl+F11 and to Ext Compact by Ctrl+Shift+F11
The problem is that right after starting the editor Ctrl+F11 works in a tab in SE with unselected code but never again after the first one. Ctrlt+Shift+F11 works every time. In short:
#1 I start the editor
#2 Type in
 |
 |
SELECT 1 AS a
|
#3 Hit Ctrl+F11 and it gets formatted as
 |
 |
SELECT
1 AS a
|
#4 Now I hit Ctrl+Shift+F11 and it reformats to
 |
 |
SELECT 1 AS a
|
#5 Hitting Ctrl+F11 doesn't format it to default (though the cursor changes to indicate there are some processes running in the background).
#6 Selecting the code and pressing Ctrl+F11 formats it properly to default
#7 Pressing Ctrl+Shift+F11 formats the code regardless of being selected or not
I created a short video where I start the editor and a virtual keyboard so that it can be seen which modifier keys are held down. Unfortunately, the function keys are not visible but trust me, I was holding down Ctrl and rubbing F11 frantically, obviously to no avail, except in the first case where it did format the code. You may notice that the header did not change when formatting to Ext Compact: that's because it has the header formatting rule disabled. I tried to remove the header to see if it's the one causing the issue as a side-effect, but that didn't help.
You can watch the recording here.
|
|
Thu Jan 12, 2017 5:11 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Thank you very much. I see it now. It might be a hot key behavior rather then the code formatting issue. I'm forwarding your messages to the team for further investigation.
|
|
Thu Jan 12, 2017 10:54 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
 |
 |
Thank you very much. I see it now. It might be a hot key behavior rather then the code formatting issue. I'm forwarding your messages to the team for further investigation. |
Yes, it is not strictly a code formatting issue, but that's the feature it affects. Cursor shows that something is done in the background with no visible results.
|
|
Thu Jan 12, 2017 11:54 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
It seems it only affects SQL Server, it works properly in MySQL. Could the connection type be the cause?
|
|
Fri Jan 20, 2017 9:08 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
The notes to the ticket indicate the issue is specific to running multiple editors and changing SQL assistant options, it's not specific to database connections. But as far as I understand which running editors get affected and which not is more or less random.
|
|
Fri Jan 20, 2017 9:33 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
No other editors running here, only SQL Editor, yet the error still persists. A freshly started SE is immediately affected after the first hit of Ctrl+F11 (for tabs connected to SQL Servers).
|
|
Fri Jan 20, 2017 9:45 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Has there been any progress on this matter? It's having a nasty impact on workflow.
|
|
Wed Feb 08, 2017 10:50 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Sorry for the trouble. The state of the tracking issue #SA0030521 indicate that the issue has been fixed and the fix is going to be available in 9.1 maintenance release; just few weeks away.
|
|
Wed Feb 08, 2017 11:00 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
Thank you very much for fixing this one, it was getting me an increasing amount of white hair :)
|
|
Fri Mar 03, 2017 8:31 am |
|
 |
gemisigo
Joined: 11 Mar 2010 Posts: 2165
|
|
|
|
The issue is back. Formatting selected code with default rules works sometimes, formatting custom works regardless if the code is selected or not. Formatting unselected (the entire content of the editor tab) rarely works. The cursor changes to hourglass to show there's something happening in the background but nothing really happens to the code.
Only affects SQL Server, everything works properly for SQLite or MySQL.
|
|
Fri Mar 17, 2017 10:18 am |
|
 |
|