MayaSublime icon indicating copy to clipboard operation
MayaSublime copied to clipboard

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

Open ThibH opened this issue 8 years ago • 2 comments

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.

ThibH avatar Jan 25 '17 21:01 ThibH

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 avatar Jan 25 '17 21:01 justinfx

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

justinfx avatar Jan 25 '17 21:01 justinfx