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
评论列表
文章目录