PyCharm 2022.1 Help

Code reference information

This section describes how to see definitions of symbols, display documentation references, and use the view parameter information feature.

Definitions

In PyCharm, you can see where and how symbols, such as tags, classes, fields, methods, or functions are defined in your project. For this purpose, the IDE features the Quick Definition popup.

  • To view definition of a symbol, select it in the editor and press Ctrl+Shift+I (or click View | Quick Definition).

Quick Definition popup

Alternatively, with the Ctrl key pressed, hover the cursor over any symbol. PyCharm displays the symbol as a link and shows its definition in a tooltip. Click this link to jump to the definition of the symbol.

Jump to the selected definition

You can open a definition in the Find tool window. To do so, click the Options icon in the top-right corner of the popup and click Open in Find tool window Open in Find Tool Window.

To open the source code of the definition for editing and close the popup, click the Options icon and then click Edit Edit Source (F4).

Type definitions

The Quick Type Definition feature allows you to view the type definition of variables, fields, methods, or any other symbols in a popup without switching from the code you're editing.

  • Place the caret at the symbol for which you want to view the type definition and select View | Quick Type Definition.

    Viewing type definition in a popup

    To open the source code of the definition for editing and close the popup, click the Options icon and then click Edit Edit Source (F4).

PyCharm doesn't have a default keyboard shortcut for this action, but you can manually configure it in the settings. For more information on how to configure custom shortcuts, refer to Configure keyboard shortcuts.

Parameter info

The Parameter Info popup shows the names of parameters in method and function calls. PyCharm automatically shows a popup with all available method signatures within 1 second (1000 milliseconds) after you type an opening bracket in the editor, or select a method from the suggestions list.

You can explicitly invoke the popup if it has closed or if your IDE is configured not to show the popup automatically. To do so, press Ctrl+P (or click View | Parameter Info).

View Parameter Info

Show full method or function signatures

By default, the parameter info popup shows simple signatures. You can configure the IDE to show full signatures that include method names and returned types.

  • In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | General | Code Completion, and select the Show full method signatures checkbox.

Make sure to include the required third-party JavaScript libraries in the project source path. Otherwise, the names of parameters will not be displayed.

Configure the parameter info popup

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | General | Code Completion.

  2. In the Show the parameter info popup in ... milliseconds field, specify the time in milliseconds after which the popup should appear.

If you don't want the popup to appear automatically, clear the Show the parameter info popup in ... milliseconds checkbox.

Inlay hints

Inlay hints are special markers that appear in the editor and provide you with additional information about your code, like the names of the parameters that a called method expects. Other types of hints inform you about annotations, method parameters, usages, and so on (depending on the language).

Some of the hints are enabled by default.

You can fine-tune inlay hints in Settings/Preferences | Editor | Inlay Hints. For detailed explanation of what each type does, see Inlay Hints.

Configure the parameter hints exception list

If you don't want to see parameter hints for specific methods, you can configure the list with exceptions. By default, the exception list contains a number of pre-defined methods. You can remove a method from the list to see the hints for it, or add new methods to hide their hints in the editor.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), select Editor | Inlay Hints and click the necessary language.

  2. Select Parameter hints in the list in the middle section.

    The options for configuring hints become available on the right.

  3. Add methods for which you don't want to see the hints to the Exclude list section.

  4. Add cases for which you do not want to see the hints to the Exclude list section. To add a case, click the inline hint in your code, press Alt+Enter and select Do not show hints for current method.

  5. Apply the changes and close the dialog.

Quick Documentation

You can get quick information for any symbol right from the editor by means of the Quick Documentation feature. It shows you code documentation in a popup as you hover the mouse over code elements.

PyCharm recognizes inline documentation created in accordance with PEP-257.

Quick Documentation in a popup

View Quick Documentation in a popup

  • Hover the mouse over the necessary symbol in the editor.

  • Place the caret at the symbol and press Ctrl+Q (View | Quick Documentation).

    Press Ctrl+Q again to open this documentation in the Documentation tool window.

    Quick Documentation Window

    Click links in the documentation topic to preview documentation for top-level elements (in this example: math) or to the related types (in this example: float).

Click the Show Options Menu icon in the popup to change the font size, display the quick documentation toolbar, or go to the source code.

Disable Quick Documentation on hover

By default, the quick documentation popup appears as you hover the mouse over code elements. You can configure the IDE to display the popup only after you explicitly invoke the Quick Documentation feature.

  • Click the Show Options Menu icon in the popup and disable the Show on Mouse Move option.

  • In the Settings/Preferences dialog (Ctrl+Alt+S), go to Editor | Code Editing | Quick Documentation and clear the Show quick documentation on hover checkbox.

In this case, to view documentation for a symbol at caret, press Ctrl+Q or select View | Quick Documentation from the main menu. The documentation will be shown in a popup, but you can configure the IDE to display it in the tool window right away.

Quick Documentation in the tool window

View documentation in the tool window

With the default settings, pressing Ctrl+Q (View | Quick Documentation) opens quick documentation opens a popup. You can change the settings to view documentation in the tool window.

  • In the quick documentation popup, click the Show Options Menu icon and disable the Show Documentation Popup First option.

  • In the Documentation tool window, click the Show Options Menu icon on the tool window toolbar and disable the Show Documentation Popup First option.

Keep documentation in the tool window

You can open a piece of documentation for a specific code element in the tool window and keep viewing documentation for other elements in your current file.

  1. Place the caret at the required code element and press Ctrl+Q. If the popup appears, press Ctrl+Q again to switch to the tool window.

    The asterisk symbol (*) on the documentation tab means that the tab is not pinned, so its content will be replaced by documentation for another code element that you select in the editor.

  2. Right-click the tab with the documentation in the documentation tool window and enable the Keep This Documentation option.

    After that, the current documentation tab will be pinned. You can return to the editor and view documentation for other code elements that will open either in the popup or in a new tab in the tool window.

External documentation

External documentation opens the necessary information in a web browser so that you can navigate to related symbols and keep the information for further reference at the same time.

PyCharm shows documentation for SciPy, NumPy, PyGTK, and the other modules you've installed for your Python interpreter. External documentation should be properly configured in the External Documentation page of the Settings/Preferences.

View external documentation

  • To view documentation for a symbol at the caret in a browser, press Shift+F1 or select View | External Documentation from the main menu.

To view external documentation, you need to configure the documentation URL first. PyCharm comes with the URLs for pandas, wx, kivy, PySide, PyQt5, PyQt4, matplotlib, pyramid, flask, and gtk. You can modify the predefined set of URLs or add a new one in the project Settings/Preferences.

Configure External Documentation

  1. In the Settings/Preferences dialog (Ctrl+Alt+S) open Tools | External Documentation.

    Configuring external documentation
  2. To add a new documentation URL, click the Add button. In the opened dialog, specify the module name and the URL of the corresponding external documentation.

    Adding a URL for numpy documentation

    If external documentation resides locally, specify the local path to it.

  3. To modify any of the preconfigured documentation URLs, select the documentation module in the Tools | External Documentation dialog and double-click it or click the Edit button.

  4. To set up a URL pattern, select a macros in the Available Macros field and click the Insert button.

    Modifying the URL for the matplotlib documentation

    Note that each documentation module has its specific structure, so be careful when adding macros.

Type Info

In PyCharm, you can identify the type of an expression in the following way:

  • Place the caret at the necessary code element and press Ctrl+Shift+P (or select View | Type Info from the main menu).

Productivity tips

Copy tooltip text to the clipboard

To copy tooltip text to the clipboard, hold Alt (on Linux, hold Ctrl+Alt) and click the tooltip.

View context information

If the current method or class declaration is not visible, you can view it in the tooltip by pressing Alt+Q.

Last modified: 23 May 2022