From 7ba4efa774437105b346c57f9af007fb6dfc2a6a Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Wed, 9 Mar 2016 21:16:05 +0300 Subject: [PATCH] PY-18733 Consider return type collected by debugger in generated docstrings Don't add empty type annotation for return value inside generated docstring unconditionally in PyDocstringGenerator. It should really be found in PyDocstringGenerator#prepareParameters(). --- .../documentation/docstrings/PyDocstringGenerator.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/python/src/com/jetbrains/python/documentation/docstrings/PyDocstringGenerator.java b/python/src/com/jetbrains/python/documentation/docstrings/PyDocstringGenerator.java index 50fea52fba76..d2456729a9e7 100644 --- a/python/src/com/jetbrains/python/documentation/docstrings/PyDocstringGenerator.java +++ b/python/src/com/jetbrains/python/documentation/docstrings/PyDocstringGenerator.java @@ -209,10 +209,7 @@ public class PyDocstringGenerator { statementList.accept(visitor); if (!isConstructor((PyFunction)myDocStringOwner) && (visitor.myHasReturn || addReturn)) { // will add :return: placeholder in Sphinx/Epydoc docstrings - myAddedParams.add(new DocstringParam("", null, true)); - if (PyCodeInsightSettings.getInstance().INSERT_TYPE_DOCSTUB) { - withReturnValue(""); - } + withReturnValue(null); } } return this; @@ -274,7 +271,8 @@ public class PyDocstringGenerator { String type = paramTypes.get(paramCoordinates); if (type == null && PyCodeInsightSettings.getInstance().INSERT_TYPE_DOCSTUB) { if (signature != null) { - type = StringUtil.notNullize(param.isReturnValue() ? signature.getReturnTypeQualifiedName() : + type = StringUtil.notNullize(param.isReturnValue() ? + signature.getReturnTypeQualifiedName() : signature.getArgTypeQualifiedName(param.getName())); } else {