Click to See Complete Forum and Search --> : Line Numbers In Code


Jarrod1937
12-13-2010, 01:29 PM
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.

Jick
12-13-2010, 11:10 PM
I agree it would be nice. Not so sure it will happen though. Best to see what Joe says. ;)

JPnyc
12-14-2010, 01:02 AM
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.

Jarrod1937
12-14-2010, 07:14 AM
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).

JPnyc
12-14-2010, 08:27 AM
I'd like to, but I'm administrating 27 forums, I just haven't got the time.

Jeff Mott
12-14-2010, 02:21 PM
This Syntax Highlighter (http://alexgorbatchev.com/SyntaxHighlighter/) 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.

NogDog
12-14-2010, 08:59 PM
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.

Jeff Mott
12-14-2010, 10:14 PM
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. :)

OctoberWind
12-17-2010, 01:24 PM
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!! :mad: