ternjs / tern_for_sublime

Sublime Text package adding Tern support
MIT License
803 stars 54 forks source link

Conflicts with GitSavvy dashboards #133

Open ghost opened 7 years ago

ghost commented 7 years ago

When I'm changing GitSavvy dashboards via Tab key, TurnJS outputs to the console:

Traceback (most recent call last):
  File "C:\Tools\SublimeText\sublime_plugin.py", line 320, in on_selection_modified_async
    callback.on_selection_modified_async(v)
  File "C:\Users\i.oleksandrov\AppData\Roaming\Sublime Text 3\Packages\tern_for_sublime\tern.py", line 53, in on_selection_modified_async
    on_selection_modified(view)
  File "C:\Users\i.oleksandrov\AppData\Roaming\Sublime Text 3\Packages\tern_for_sublime\tern.py", line 32, in on_selection_modified
    pfile = get_pfile(view)
  File "C:\Users\i.oleksandrov\AppData\Roaming\Sublime Text 3\Packages\tern_for_sublime\tern.py", line 94, in get_pfile
    if not is_js_file(view): return None
  File "C:\Users\i.oleksandrov\AppData\Roaming\Sublime Text 3\Packages\tern_for_sublime\tern.py", line 16, in is_js_file
    return view.score_selector(sel_end(view.sel()[0]), "source.js") > 0
  File "C:\Tools\SublimeText\sublime.py", line 538, in __getitem__
    raise IndexError()
IndexError
marijnh commented 7 years ago

You appear to have cut off the interesting part of the stack trace.

ghost commented 7 years ago

@marijnh Sorry, updated.

marijnh commented 7 years ago

Could you see if attached patch helps?

ghost commented 7 years ago

Nope, it's pretty the same console output:

Traceback (most recent call last):
  File "C:\Tools\SublimeText\sublime_plugin.py", line 320, in on_selection_modified_async
    callback.on_selection_modified_async(v)
  File "C:\Users\i.oleksandrov\AppData\Roaming\Sublime Text 3\Packages\tern_for_sublime\tern.py", line 53, in on_selection_modified_async
    on_selection_modified(view)
  File "C:\Users\i.oleksandrov\AppData\Roaming\Sublime Text 3\Packages\tern_for_sublime\tern.py", line 32, in on_selection_modified
    pfile = get_pfile(view)
  File "C:\Users\i.oleksandrov\AppData\Roaming\Sublime Text 3\Packages\tern_for_sublime\tern.py", line 94, in get_pfile
    if not is_js_file(view): return None
  File "C:\Users\i.oleksandrov\AppData\Roaming\Sublime Text 3\Packages\tern_for_sublime\tern.py", line 16, in is_js_file
    return len(view.sel()) > 0 & view.score_selector(sel_end(view.sel()[0]), "source.js") > 0
  File "C:\Tools\SublimeText\sublime.py", line 538, in __getitem__
    raise IndexError()
IndexError
marijnh commented 7 years ago

Ugh, okay, so indexing view.sel() is somehow returning an index error even though it's length is > 0. Not sure what's going on there, but something seems to be breaking a part of ST that Tern isn't responsible for.