在 PyDev 中显示函数文档

发布于 2024-10-07 22:40:04 字数 543 浏览 14 评论 0原文

我已经启动并运行了 Pydev,几乎一切都运行良好。但是我在文档字符串方面遇到了一些麻烦。

假设我有一个如下所示的函数:

def _get_logging_statement(self):
    """Returns an easy to read string which separates items in the log file cleanly"""
    result = "\n\n#============================================="
    result += "\n#   %-80s#"(self)
    result =+ "\n\n#============================================"
    return result

假设我已经重写了 repr 以正确格式化该字符串。

当我将鼠标悬停在 Eclipse 中时,它会按预期显示完整的文档字符串。然而,完整的实现也显示在文档下方。

有没有办法显示文档字符串?

I've gotten Pydev up and running, and almost all is working well. However I'm having some trouble with docstrings.

Let's say for instance I have a function such as the following:

def _get_logging_statement(self):
    """Returns an easy to read string which separates items in the log file cleanly"""
    result = "\n\n#============================================="
    result += "\n#   %-80s#"(self)
    result =+ "\n\n#============================================"
    return result

Assume I've overridden repr to format that string properly as well.

When I hover over this in Eclipse it shows me the full docstring as intended. However, the full implementation is also displayed below the doctsting.

Is there a way to only display the docstring?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空城旧梦 2024-10-14 22:40:04

目前看起来不像。谷歌搜索这个问题,最上面的结果向我指出了这个 Pydev 用户帖子

<块引用>
<块引用>

2010 年 5 月 3 日星期一上午 5:45,Janosch Peters 写道:

嗨,

当我将鼠标悬停在函数或类上时,我会收到一个工具提示,显示
函数/类的整个定义不仅仅是文档字符串(正如我
会期望)。

这是预期的行为吗?我认为这会更有用,如果只是
显示文档字符串的内容。


目前预计。请输入要提出的功能请求
仅显示文档字符串选项。

干杯,

法比奥

查看了 Pydev 错误/功能跟踪器,没有发现输入的这个特定问题。您可能想将其输入 Pydev 功能请求跟踪器中,看看是否可以在那里获得帮助。

Doesn't look like it currently. Googled around for this issue and the top result pointed me to this Pydev-users post:

On Mon, May 3, 2010 at 5:45 AM, Janosch Peters wrote:

Hi,

when I hover over a function or class, I get a tooltip showing the
whole definition of the function/class not only the docstring (as I
would expect).

Is this expected behaviour? I think it would be more useful, if only
the content of the docstring is shown.

It's currently expected. Please enter a feature request to make
showing just the docstring an option.

Cheers,

Fabio

Looked around the Pydev bug/feature tracker and didn't find this specific issue entered. You might want to enter it in the Pydev feature request tracker and see if you can get help there.

看透却不说透 2024-10-14 22:40:04

我已在 PyDev bug tracker 中提交了功能请求,ID 为 863。

在 PyCharm 中,当我将鼠标悬停在方法名称上时,我可以看到一个弹出窗口显示
只有每个方法的文档字符串,没有实现细节。
并且,诸如 @param xx:@rtype 等标签都被正确解析
并在弹出窗口中以可读格式显示,以及不同的样式,例如
spinx/epytext/google/plain 可以在设置中进行调整,以便它可以
识别所有格式。

我想在 PyDev 中提出同样的建议:一个弹出窗口显示
带有已解析标签的文档字符串,没有实现细节,并且 if
与 javadoc 一样,可以使用 some code 来像 HTML 一样呈现它,效果更好。

如果您也想要此票,请考虑投票支持此票。 (也许也在这里投票)

I have submitted a feature request in the PyDev bug tracker, with ID 863.

In PyCharm when I hover onto a method name, I can see a popup showing
only the docstring of every method, without implementation details.
And, the tags like @param xx:, @rtype, etc., are parsed correctly
and shown in a readable format in the popup, and different style like
spinx/epytext/google/plain can be tweaked in settings so that it can
recognize all formats.

I would like to suggest the same in PyDev: a popup which shows
docstring with tags parsed, without implementation details, and if
like javadoc, one can use <code>some code</code> to render it like in HTML, better.

Consider vote up to this ticket if you also want this. (And maybe vote up here, too)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文