SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Formatting anomaly

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Formatting anomaly
Author Message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Formatting anomaly Reply with quote
In case the lines following the header are commented the same way the as header (that is, both using '--' or '/* ... */), formatting the code will remove the commented part, unintentionally resulting in code loss.

Formatting for (header):
Code:

-- $DATE$ $TIME$ Formatted to SQL Server default


editor contents:
Code:

-- SELECT
--    s.[name]
--    ,s.id
--    ,s.xtype
-- FROM
--    dbo.syscolumns AS s

SELECT
   s.[name]
   ,s.id
   ,s.xtype
FROM
   dbo.syscolumns AS s


Result after formatting:
Code:

-- 2012.06.26. 16:24:36 Formatted to SQL Server default

SELECT
   s.[name]
   ,s.id
   ,s.xtype
FROM
   dbo.syscolumns AS s

Tue Jun 26, 2012 10:30 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
Also, formatting removes language specific accents as well :(
Mon Sep 24, 2012 6:01 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
The language specific issue is history but the code loss due to formatting is still present in 6.3.153.
Sun Nov 04, 2012 1:35 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7838

Post Reply with quote
This is still an open issue. There seem to be no reliable way to identify the old header and separate it from other comments in the beginning in case it changed in the settings. We are looking for a way to setup some sort of regular expression to separate the header part or alternatively create a new requirement to have at least 1 empty line separating the header

For tracking purposes here is the issue #SA0020608


Last edited by SysOp on Mon Nov 05, 2012 6:43 pm; edited 1 time in total
Mon Nov 05, 2012 11:13 am View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
I see. Meanwhile I've experimented with it and came up with (bit lame) workaround. While it can happen that the comment types are combined, it's still unlikely. So I changed my (header) formatting to:
Code:

--/* $DATE$ $TIME$ etc. etc. */

Now formatting leaves comment intact as long as there are no combinations of comment types at the top of the script.
Mon Nov 05, 2012 2:42 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7838

Post Reply with quote
That should work, but the header doesn't look pretty. I hope we can develop a better solution not requiring jumping through the extra hoops to get the formatting to confuse headers and other comments
Mon Nov 05, 2012 6:46 pm View user's profile Send private message
gemisigo



Joined: 11 Mar 2010
Posts: 2102

Post Reply with quote
Well, yes, it's rather pretty ugly and does not protect from code loss every time. I plan to remove that when you find a solution for this issue. Until then it remains a scar in my scripts :(
Tue Nov 06, 2012 4:30 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
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


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.