www.webdeveloper.com
Results 1 to 9 of 9

Thread: Line Numbers In Code

  1. #1
    Join Date
    Mar 2010
    Posts
    672

    Line Numbers In Code

    If a person is posting with some sort of code tag like the code, html, or php tags, it should display the line number of each line. This would be quite helpful in communicating issues or suggestions about someones code. So instead of saying " The reference to $_POST you have within your third foreach loop statement is not referencing the same index as the first $_POST you have outside your main loop code block", i then then simply say "The $_POST on line 30 is referencing a different index than the one on line 6" ... Quite a bit easier imo.

  2. #2
    Join Date
    Feb 2003
    Location
    Aberdeen, Washington, USA
    Posts
    1,859
    I agree it would be nice. Not so sure it will happen though. Best to see what Joe says.

  3. #3
    Join Date
    May 2004
    Location
    Manhattan NY
    Posts
    6,028
    Thanks for the suggestion but we've only come across one color coding plug in for vBulletin that includes line numbers, and it destroys all spatial formatting when you copy and paste. When you copy and paste the code, there will be no line breaks.

  4. #4
    Join Date
    Mar 2010
    Posts
    672
    Quote Originally Posted by JPnyc View Post
    Thanks for the suggestion but we've only come across one color coding plug in for vBulletin that includes line numbers, and it destroys all spatial formatting when you copy and paste. When you copy and paste the code, there will be no line breaks.
    Can't you guys simply program the feature yourself? Or alter the one existing plugin? This is a web developer forum after all ;-)
    I'm sure if you put out an announcement others may give it a try, heck i may give it a try in my spare time (what little i have). Shouldn't be that hard to identify the line numbers (and no reason to strip out the formatting).

  5. #5
    Join Date
    May 2004
    Location
    Manhattan NY
    Posts
    6,028
    I'd like to, but I'm administrating 27 forums, I just haven't got the time.

  6. #6
    Join Date
    Jul 2003
    Location
    The City of Roses
    Posts
    2,503
    This Syntax Highlighter is the best I've seen. It has line numbers, and it doesn't destroy formatting (among many other cool features). It's all JavaScript, so if you wanted to use it, all you'd have to do is turn off vBulletin's default highlighting and plug this guy in instead.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  7. #7
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,246
    Only problem with most line number systems I've seen is that if you try to copy and paste the code into your editor, the line numbers come with it. If you can overcome that somehow, then fine, otherwise I'd rather copy the code into my editor and see the line numbers there.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  8. #8
    Join Date
    Jul 2003
    Location
    The City of Roses
    Posts
    2,503
    Quote Originally Posted by NogDog View Post
    Only problem with most line number systems I've seen is that if you try to copy and paste the code into your editor, the line numbers come with it. If you can overcome that somehow, then fine, otherwise I'd rather copy the code into my editor and see the line numbers there.
    You should try the SyntaxHighlighter demo. You may be pleasantly surprised.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  9. #9
    Join Date
    Jul 2007
    Location
    Wisconsin
    Posts
    468
    I saw somewhere (on one of the 8,462 design/development blogs out there), the "code blocks" were set with a background image, of alternating light grey/light green, with line numbers.

    The layout wasn't "perfect" but it matched the line-height pretty close.

    I really wish I remembered which site. I want to say there was a lot of good info on that site. Curse you 3am half-asleep browsing!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles