Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12345»»»

Code Formatting Expand / Collapse
Author
Message
Posted Wednesday, March 18, 2009 8:47 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, October 20, 2014 5:17 AM
Points: 1,274, Visits: 1,985
GilaMonster (3/18/2009)
Steve Jones - Editor (3/17/2009)
New code formatting has been released on SSC.


Ooooohhhh..... Nice!

Jack Corbett (3/17/2009)
This has been a light day for me posting code. I've mainly added links.


I don't think I've posted any code this week yet.


If you look, you'll find that all existing code is now being displayed with color highlighting...

I wonder if that's broken anything? I think I may have used a construct like

[ c o d e ] ..... ; [ b ] [ / b ] ) ... [ / c o d e ]

and relied on the bold tag getting hidden! I will have to go look...


Derek
Post #678562
Posted Wednesday, March 18, 2009 8:55 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 5:26 AM
Points: 40,423, Visits: 36,872
I think the string and comment handling needs a little more work
http://www.sqlservercentral.com/Forums/FindPost678555.aspx

--here's a single quote within a comment
select 'String 1', 012
select 'String 3', 789 -- that's not what I wanted to see
select 'String 5', 456 -- that's better
select 'String 7', 123 -- not quite




Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #678572
Posted Wednesday, March 18, 2009 9:09 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, October 20, 2014 5:17 AM
Points: 1,274, Visits: 1,985
Bob posted some code here. Bob's code looks OK, but I think the formatter saw a single quote in the comment and hence was thown out of phase.

-- based on what we've seen
insert #t
select 'this is how' union all
select 'we insert data' union all
select 'for testing'

declare @i int
-- wouldn't it be nice to insert arrays so you didn't need to do union all
set @i = 1
select k as 'kay'

/*
block comments aren't right either
what happens if I insert one
*/
select j as 'jay'

Basically, it looks like the scanner is recognizing single quotes in comments and hence getting confused. I've attache a screenshot previewing the above rather than try to describe it.


Derek

  Post Attachments 
ssc screenshot 2.bmp (4 views, 890.04 KB)
Post #678596
Posted Wednesday, March 18, 2009 9:13 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 5:29 AM
Points: 12,923, Visits: 32,315
i noticed if i add an 800 line [code] block, it'll show all 800 lines; i'd rather have a scrollbar for the code in question, if possible.

Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #678604
Posted Wednesday, March 18, 2009 9:14 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 3:38 AM
Points: 20,804, Visits: 32,733
Copying and pasting code from the forum, the code becomes double spaced and it loses it formatting (indention for one).



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #678606
Posted Wednesday, March 18, 2009 9:22 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 7:12 AM
Points: 31,284, Visits: 15,746
Lowell, good point. We should probably limit areas to 40-50 lines tops.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #678613
Posted Wednesday, March 18, 2009 9:29 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, October 20, 2014 5:17 AM
Points: 1,274, Visits: 1,985
Since the formatting is active for historical code, you also have interesting effects where the 'code' wasn't t-sql, for example
http://www.sqlservercentral.com/Forums/FindPost661664.aspx


Or where I inserted 'font' tags in the code to produce a color effect, which of course, are now visible.
http://www.sqlservercentral.com/Forums/FindPost669471.aspx


Derek
Post #678627
Posted Wednesday, March 18, 2009 9:35 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, October 20, 2014 5:17 AM
Points: 1,274, Visits: 1,985
How easy would it be to revert the [ code ][ /code ] tags to work as before and add a new set of [ tsql ][ /tsql ] tags?

Hence old usage wouldn't break and people could preview that new [ tsql ] sections were valid.


Derek
Post #678638
Posted Wednesday, March 18, 2009 12:45 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 7:12 AM
Points: 31,284, Visits: 15,746
I shall ask

There should be a [ code2 ] set of tags for XML as well.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #678808
Posted Wednesday, March 18, 2009 1:07 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Sunday, November 23, 2014 12:50 AM
Points: 3,109, Visits: 11,515
It doesn't seem to handle tab indents very well. The indents below are all over the place, even though they are all a single tab character.

I think it would be easier to read with a non-proportional font for the display, since that is usually the way we usually see it in a code editor.
select
*
from
Mytable
where
MyColumn1 in (1,2)
order by
MyColumn33

Post #678829
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse