Code Formatting

  • New code formatting has been released on SSC. Please feel free to check it out and comment.

    Use the [ code ][ /code ] shortcuts to the right for enclosing code items.

  • It seems to be dropping blank lines in the format. Maybe I'm doing something wrong, but it seems to be doing so.

    Line one, followed by a blank line

    Line two

    That has a blank line between the two, in the edit screen. Makes it a bit harder to view longer code pieces.

    I like the line-wrap though! Very cool! No more left-right scroll because someone had a piece of code 10000-characters wide!

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • I really loved the colored output:-D, it makes real easy to read the code. But there seems to be some problem with the text "ADD" as it adds itself twice to the output (i.e. "ADDADD" is being shown, 1 with blue color and other with pink color).

    ALTER TABLE [dbo].[type_of_fraud]

    ADD [matchfile_autoload] char(01) NOT NULL

    CONSTRAINT DF_No_matchfile_autoload DEFAULT('N')

    Edit:

    And also, it would be better if you can make the font size same as the normal text.

    --Ramesh


  • Steve

    A great improvement ..... for posting as well as reading what code others have posted.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Definitely an improvement. I haven't seen the issues mentioned yet though. This has been a light day for me posting code. I've mainly added links.

  • While I like the color highlighting and wordwrap, there's something distinctly odd with it.

    I use IE6 (Company Policy) and the code backgroup tends to come out as random gray/white horizontal stripes, occasionally solid gray (which is what I suspect it should be.

    Also when I looked at my recent posts page, I get some very odd behaviour. It looks like the code blocks are overlaid all over the messages. See attached partial screenshot.

    Derek

  • Another (minor) thing is that it seems to ignore "nvarchar". "Varchar" ends up blue, but "nvarchar" ends up black.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • 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.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    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
  • seems to hate less-than and greater-than symbols:

    this line has the ampersand-LT-semicolon:

    salesMonth <=@month and YTD = 0 OR salesMonth = @month and YTD <> 0

    this is as you'd type it

    salesMonth 0

    strips the middle portion of the code out assuming an HTML tag.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks for the notes. I'm logging some bugs.

    - The ADDADD thing, we had that with some other keywords and cleaned them up. We missed this one.

    - Blank lines, noted

    - background - We have code tags, it's possible some are missing. If that's the case, you'd get the solid gray. Other code items are made with the alternating greenbar type formatting of white and light gray. We can make it solid.

    - Font size, noted. Not sure if I want it the same or smaller to stand out.

  • 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

  • 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, MVP, M.Sc (Comp Sci)
    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
  • 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

  • i noticed if i add an 800 line block, it'll show all 800 lines; i'd rather have a scrollbar for the code in question, if possible.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Copying and pasting code from the forum, the code becomes double spaced and it loses it formatting (indention for one).

Viewing 15 posts - 1 through 15 (of 42 total)

You must be logged in to reply to this topic. Login to reply