2016-08-30 104 views
2

讓我們來想象一下,我想在PyCharm 4.5 Community Edition(在5.0中試用)中看到一個簡單方法的文檔字符串彈出窗口。PyCharm和reStructuredText(Sphinx)文檔彈出窗口

我在這兩個epytext語法寫下這些文檔字符串(epydoc的發電機是不支持的,因爲2008年只爲Python2作品)和新結構化語法(這是使用獅身人面像 - 積極支持發生器,用於官方python文檔)在PyCharm文檔彈出式窗口

的epytext一個完美的作品

PyCharm works with epytext Screenshot

但reStructuredText的一個不顯示在任何參數二!

PyCharm fails with reStructuredText Screenshot

試圖與PyCharm設置來處理這個問題,讀PyCharm幫助,通過PyCharm錯誤追蹤搜索和使用谷歌不能幫助我找到爲什麼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 

回答

1

如果此功能目前僅在最近PyCharm版本,所以什麼版本你有我不知道嗎?在我的PyCharm CE 2016.2.2中,它看起來像截圖。

enter image description here

檢查首選項>編輯>常規>代碼完成,以確保選擇 「Autopop文檔」 已啓用。

祝你好運!

+0

非常感謝!奇怪,但如果從pycharm網站下載2016.1版本,目前該功能仍然有效,而且我的同事幾個月前安裝的那個版本不會! IDK的確切原因,可能是所有版本都有最新補丁(我測試過5.0.2和5.0.5,最新版本也適用於這個功能!) –