Skip to content

Commit

Permalink
Jump to the dependent directly if there's only one. Fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Kemp committed Jun 19, 2014
1 parent c466c9e commit 7e30680
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Dependents.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ def show_quick_panel():

self.window.show_quick_panel(self.dependents, self.on_done)

sublime.set_timeout(show_quick_panel, 10)
if len(self.dependents) == 1:
self.open_file(self.dependents[0])
else:
sublime.set_timeout(show_quick_panel, 10)

def on_done(self, picked):
"""
Expand All @@ -66,13 +69,16 @@ def on_done(self, picked):
return

dependent = self.dependents[picked]
self.open_file(dependent)

def open_file(self, dependent):
# We removed the root originally when populating the dependents list
filename = self.path + self.window.root + '/' + dependent

def open_file():
def open():
self.window.open_file(filename)

sublime.set_timeout(open_file, 10)
sublime.set_timeout(open, 10)

def show_error(string):
"""
Expand Down

0 comments on commit 7e30680

Please sign in to comment.