python - PyCharm 和 reStructuredText (Sphinx) 文档弹出窗口

标签 python pycharm python-sphinx epydoc

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

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

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

PyCharm works with epytext Screenshot

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

PyCharm fails with reStructuredText Screenshot

尝试使用 PyCharm 设置来处理这个问题,阅读 PyCharm 帮助,通过 PyCharm bugtracker 搜索并使用 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

最佳答案

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

enter image description here

检查 Preferences > Editor > General > Code Completion,确保启用选项“Autopop documentation”。

祝你好运!

关于python - PyCharm 和 reStructuredText (Sphinx) 文档弹出窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39235275/

相关文章:

python - 创建项目后,创建一个继承全局站点包的 PyCharm 项目?

python - 错误 : error in 'egg_base' option: 'src' does not exist or is not a directory

python - Python中无法连接字符串和整数的原因

python - 提高元素 block 之间差异的性能

python - 在Python中与无限循环一起运行服务器

python - 在 svg 内的路径中查找 XPath

python - 将pycharm项目导入jupyter笔记本

python - 阅读文档不会自动生成 py-modindex.html

python-sphinx - 如何使用 Sphinx 链接本地 Python 帮助文档

python-sphinx - 如何在代码环境中的 reStructuredText 中强制使用不间断空格?