How to preview function params + doc string?

I have a function with params and doc-string.
# file
def bar(p1, p2):
    do this and that
# file
from foo import bar

In, I start typing "bar", select it from the auto-complete popup, and my cursor is now positioned at "???" inside the parens. How do I see a preview of the params + doc-string at this moment? The options on the View menu are:
  • Quick Definition (does nothing)
  • Quick documentation (disabled or does nothing)
  • External documentation (disabled)
  • Parameter info (just shows "p1, p2")
  • Context info (does nothing)

If I back out my cursor back into the "bar", then "Quick documentation" works (though it also insists on adding inferred-type information), but this cursor motion breaks my flow of work. What is the best way to do this?

1 comment
Comment actions Permalink
Hi there,

  • Parameter info works only inside function brackets — that is the actual place/moment where you would need such type of small and brief popup.
  • Quick documentation (as well as Quick Definition) requires caret to be standing on a function/class/etc name in order to display anything.

Apparently you did not know this but you can invoke Quick Documentation while auto-completion popup is still active — just use the shortcut (Ctrl+Q on default keymap on Linux/Windows) ... or configure PyCharm to open it up automatically for you (Settings | Editor | Code Completion).

The "minus" is that once you select the item from code completion (the pop up closes) the Quick Documentation popup will most likely close automatically as well (the idea behind: you know what the function does & what parameters are there, so why obstruct the vision). The workaround – is to pin Quick Documentation, so it always stays visible, and if code completion closes, it will still display the same content (unless you activate the option there to automatically show the documentation for selected element).

Please sign in to leave a comment.