plugin_query_type.py 文件源码

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

项目:GoFeather 作者: frou 项目源码 文件源码
def run(self, args, simulate=False):
        view = self.view
        window = view.window()

        save_and_format(window)

        if not check_num_selections(view, 1):
            return
        byte_offset = view.sel()[0].begin()

        cmd = [
            'guru', '-json', 'describe',
            view.file_name() + ':#' + str(byte_offset)
        ]
        cmd_output = run_tool(cmd)
        if not cmd_output:
            return

        json_obj = sublime.decode_value(cmd_output.decode('utf-8'))
        type_str = json_obj['value']['type']

        window.settings().set(SettingsKeys.PANEL_QUERIED_TYPE, type_str)
        window.run_command('show_go_doc_from_panel')
        window.settings().erase(SettingsKeys.PANEL_QUERIED_TYPE)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号