hyper_click_command.py 文件源码

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

项目:SublimeHyperClick 作者: aziz 项目源码 文件源码
def run(self, edit):
        self.window = self.view.window()
        v = self.view

        if len(v.sel()) != 1:
            return

        cursor = v.sel()[0].a
        line_range = v.line(cursor)
        line_content = v.substr(line_range).strip()
        matched = self.is_valid_line(line_content)
        if matched:
            destination_str = matched.group(1)
            file_path = HyperClickPathResolver(v,
                destination_str,
                self.roots, self.lang, self.settings
            )
            resolved_path = file_path.resolve()
            if resolved_path:
                if resolved_path.startswith('http://') or resolved_path.startswith('https://'):
                    webbrowser.open_new_tab(resolved_path)
                else:
                    self.window.open_file(resolved_path)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号