def run(self, edit, event):
if self.symbol_details:
view_path = self.symbol_details[0]
focus_region = self.symbol_details[1]
# collapse the region to a single point, the region start
focus_region = sublime.Region(focus_region.begin(), focus_region.begin())
# get the view with this path
view = sublime.active_window().find_open_file(view_path)
if view:
self.showSymbol(view, focus_region)
else:
# weird issue, but unless we open the file with 'ENCODED_POSITION' it won't scroll afterwards
# https://github.com/SublimeTextIssues/Core/issues/538
view = sublime.active_window().open_file("%s:%d:%d" % (view_path, 1, 0), sublime.ENCODED_POSITION)
def viewLoadedTimeout():
# we can run methods only on loaded views
if not view.is_loading():
self.showSymbol(view, focus_region)
else:
sublime.set_timeout(viewLoadedTimeout, 100)
# open is asynchronous, wait for a bit and then try to focus
sublime.set_timeout(viewLoadedTimeout, 100)
评论列表
文章目录