justinfx / MayaSublime

Send selected Python and MEL code snippets from SublimeText to Maya via commandPort
MIT License
149 stars 38 forks source link

Line number in errors is relative to function instead of the whole file. #30

Open ThibH opened 7 years ago

ThibH commented 7 years ago

For example I get an error:

# Error: list index out of range
# Traceback (most recent call last):
#   File "<string>", line 72, in submit
# IndexError: list index out of range # 

But it's in fact line 72 considering that line 0 is at the beginning of the submit function. The real line number was in fact 121.

justinfx commented 7 years ago

This is a problem when used selected text to Maya instead of the whole file. The exception comes from Maya and not Sublime, so Maya only knows the chunk of text that you sent it. I am not sure how to go about faking this unless we ship back serialized traceback details to reformat, or we parse the traceback text and reformat the location information.

justinfx commented 7 years ago

Maybe we could send the selected text padded by newlines to fake it to match the offset in the source file.