show_definition.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:Assembly-RGBDS 作者: michalisb 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号