Line Numbers On Code

I think code line numbers would be a great improvement to the site. For example in the last post I made I included a python script that was about 80 lines long but the line that was the most important to conversation was line 56. Unfortunately the lack of line numbers made me have to provide a weird reference to it where just saying line 56 would be far more clear, had the option been there.

01| I like this code formatting tool
02| however i would love to see these lines numbered
03| maybe something like this 
04| but without me having to manually enter these line numbers 
05| that way references to specific parts of your code can be made
06| without sacrificing the much needed context 
07| that providing the whole script gives you 
08| its like using a magnet to find the needle in the haystack :) 

-Thanks, please give this post a like if you agree :wink:

6 Likes

FYI @solamour

2 Likes

Not a web developer at all but I imagine the hard part would probably be copy/pasting the code as if it is all in the same object, the numbers would get copied along with it. If you put it in two objects, they wouldn’t scroll together properly?

Would be a great addition if they can though.

Did you define the IN[5] before defining the function ?
Can you try this:

  • Assign x = IN[5][0] before defining the function.
    Then the function ExportDwg will receive the global variable -x.

The python code and its intention were described on this thread, Export DWG From Template File (Post 3). This post simply a request to add line numbers to code blocks on the site so you can reference specific areas of code more easily.

-Thanks anyway. :grinning: