commands.py 文件源码

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

项目:KodiDevKit 作者: phil65 项目源码 文件源码
def run(self, edit):
        for region in self.view.sel():
            if not region.empty():
                self.view.insert(edit, region.begin(), self.view.substr(region))
                continue
            line_contents = self.view.substr(self.view.line(region))
            match = re.search(r'File "(.*?)", line (\d*), in .*', line_contents)
            if match:
                sublime.active_window().open_file("{}:{}".format(os.path.realpath(match.group(1)),
                                                                 match.group(2)),
                                                  sublime.ENCODED_POSITION)
                return
            match = re.search(r"', \('(.*?)', (\d+), (\d+), ", line_contents)
            if match:
                sublime.active_window().open_file("{}:{}:{}".format(os.path.realpath(match.group(1)),
                                                                    match.group(2),
                                                                    match.group(3)),
                                                  sublime.ENCODED_POSITION)
                return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号