问题
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).
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)
The epytext one works in PyCharm documentation popups perfectly
PyCharm works with epytext Screenshot
But the reStructuredText one doesn't show any parameters at all!
PyCharm fails with reStructuredText Screenshot
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.
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.
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.
Here are my code examples
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:
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.
Good luck!
来源:https://stackoverflow.com/questions/39235275/pycharm-and-restructuredtext-sphinx-documentation-popups