【问题标题】:PyCharm and reStructuredText (Sphinx) documentation popupsPyCharm 和 reStructuredText (Sphinx) 文档弹出窗口
【发布时间】:2016-08-30 19:06:02
【问题描述】:

让我们想象一下,我想在 PyCharm 4.5 社区版(也在 5.0 中尝试过)中看到一个简单方法的文档字符串弹出窗口。

我用 epytext 语法(自 2008 年以来不支持 Epydoc 生成器,仅适用于 Python2)和 reStructuredText 语法(Sphinx 积极使用)写下了这些文档字符串支持的生成器,用于官方 python 文档)

epytext 在 PyCharm 文档弹出窗口中完美运行

PyCharm works with epytext Screenshot

但是 reStructuredText 根本不显示任何参数!

PyCharm fails with reStructuredText Screenshot

尝试使用 PyCharm 设置处理此问题、阅读 PyCharm 帮助、搜索 PyCharm 错误跟踪器并使用 Google 无法帮助我找到 PyCharm 中的这些文档字符串弹出窗口无法与社区推荐的文档字符串标记一起正常工作的原因语言。

这是因为功能需求低吗?也许,是否有一些有用的替代方法可以查看 PyCharm 甚至其他 IDE 中的现代文档标记?我还需要能够生成 HTML 格式漂亮的文档页。

我在这里找到了another topic,与同一问题有关,但自去年以来仍未得到答复。所以,我猜想在现代 IDE 中查看现代文档的愿望出了什么问题。

这是我的代码示例

def find_links(self, issue, link_type):
    """

    Find all issues linked with C{issue} with C{link_type}.

    @param issue: Issue key
    @type issue: str
    @param link_type: Accepts either Type Name (like 'Child') or Link Description (like 'child of')
    @type link_type: str
    @return: Keys of found issues
    @rtype: list

    """
    result_keys = []
    link_list = self.get_link_list(issue)
    for link in link_list:
        ... # omitted
    return result_keys

def test_sphinx_docs_method(self, issue, link_type):
    """

    Find all issues linked with *issue* with *link_type*.

    :param issue: Issue key
    :type issue: str
    :param link_type: Accepts either Type Name (like 'Child') or Link Description (like 'child of')
    :type link_type: str
    :return: Keys of found issues
    :rtype: list

    """
    result_keys = []
    link_list = self.get_link_list(issue)
    for link in link_list:
        ... # omitted
    return result_keys

【问题讨论】:

    标签: python pycharm python-sphinx epydoc


    【解决方案1】:

    我不知道这个功能是否只存在于最近的 PyCharm 版本中,那么你有什么版本?在我的 PyCharm CE 2016.2.2 中,它看起来像屏幕截图。

    检查首选项 > 编辑器 > 常规 > 代码完成,确保启用“自动弹出文档”选项。

    祝你好运!

    【讨论】:

    • 非常感谢!奇怪,但如果从 pycharm 站点下载 2016.1 版本,目前这个功能可以工作,而我同事几个月前安装的那个就不行了! IDK 的确切原因,可能所有这些版本都有一个最近的补丁(我测试了 5.0.2 和 5.0.5,最新的也可以使用这个功能!)
    猜你喜欢
    • 2018-07-02
    • 2012-02-20
    • 2016-01-17
    • 2018-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-09
    • 1970-01-01
    相关资源
    最近更新 更多