SublimeText / PackageDev

Tools to ease the creation of snippets, syntax definitions, etc. for Sublime Text.
MIT License
436 stars 83 forks source link

Experiencing tracebacks in console if working in syntax_test_... file. #104

Closed deathaxe closed 7 years ago

deathaxe commented 7 years ago

I get the following traceback output, when working in a file whose name starts with syntax_test_ which does not (yet) contain any syntax test rules.

I have such a file with 100k lines of code to just do performance benchmarks but no syntax tests itself. I guess the missing rules cause this exception.

Console output

Traceback (most recent call last):
  File "C:\Apps\Sublime\sublime_plugin.py", line 417, in run_async_view_listener_callback
    vel.__class__.__dict__[name](vel)
  File "syntax-test_dev in C:\Apps\Sublime\Data\Installed Packages\PackageDev.sublime-package", line 283, in on_selection_modified_async
  File "syntax-test_dev in C:\Apps\Sublime\Data\Installed Packages\PackageDev.sublime-package", line 102, in get_details_of_line_being_tested
AttributeError: 'NoneType' object has no attribute 'begin'

dirty hack on line 102 to possibly solve it

Didn't check this issue thoroughly so here just a suggestion.

        details = get_details_of_test_assertion_line(view, pos)
        if not details or not details.line_region:
            break
        pos = details.line_region.begin() - 1
keith-hall commented 7 years ago

Thanks for reporting, I've been able to replicate and will fix it when I get chance :)

keith-hall commented 7 years ago

I've added a fix for this to my open PR here: https://github.com/SublimeText/PackageDev/pull/101

I took the time to make the implementation more efficient while fixing this bug ;)

FichteFoll commented 7 years ago

Fixed via https://github.com/SublimeText/PackageDev/commit/f84a18790a7c93a14b31db227020b4871e9bb7db (#101).