PyCharm和reStructuredText(Sphinx)文档弹出窗口 [英] PyCharm and reStructuredText (Sphinx) documentation popups

查看:483
本文介绍了PyCharm和reStructuredText(Sphinx)文档弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

让我们想象一下,我想在 PyCharm 4.5 Community Edition(也在5.0中试用)中看到一种简单方法的文档字符串弹出窗口.

Let's imagine, I want to see a docstring popup for one simple method in PyCharm 4.5 Community Edition (tried also in 5.0).

我用 epytext 语法(自2008年以来不支持Epydoc生成器,仅适用于Python2)和 reStructuredText 语法(由Sphinx使用-主动记录了这些文档字符串)支持的生成器,用于正式的python文档)

I wrote down these docstrings in both epytext syntax (Epydoc generator is unsupported since 2008 and works only for Python2) and reStructuredText syntax (which is used by Sphinx - actively supported generator, used for offical python docs)

epytext可以完美地在PyCharm文档弹出窗口中工作

The epytext one works in PyCharm documentation popups perfectly

PyCharm可与epytext屏幕截图一起使用

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

But the reStructuredText one doesn't show any parameters at all!

PyCharm失败,出现reStructuredText屏幕截图

尝试使用PyCharm设置处理此问题,阅读PyCharm帮助,搜索PyCharm Bugtracker以及使用Google无法帮助我找到PyCharm中这些文档字符串弹出式窗口无法与社区推荐的文档字符串标记一起正常工作的原因语言.

Trying to handle this with PyCharm settings, reading the PyCharm helps, searching through the PyCharm bugtracker and using Google couldn't help me to find the reason why these docstring popups in PyCharm don't work correctly with community-recommended docstring markup language.

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

Is this because of low demand of the feature? Perhaps, is there some useful alternatives to view the modern documentation markup inside PyCharm or even another IDE? I also need to be able to generate HTML pretty formatted docpages.

我在这里找到另一个主题,该主题与相同的问题,但自去年以来仍未得到解答.因此,我想在现代IDE中查看现代文档的愿望出了什么问题.

I've found another topic here, related to the same issue, but it is still unanswered since previous year. So, I'm guessing what's wrong with my desires to view modern documentation inside modern 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中,它看起来像屏幕截图上一样.

I do not know if this feature present only in recent PyCharm versions so what version do you have? In my PyCharm CE 2016.2.2 it looks like on the screenshot.

检查偏好设置">编辑器">常规">代码完成",以确保启用了自动弹出文档"选项.

Check Preferences > Editor > General > Code Completion, to be sure option "Autopop documentation" is enabled.

祝你好运!

这篇关于PyCharm和reStructuredText(Sphinx)文档弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆