PyCharm 2018.3 Help

Navigating through the source code

You can quickly navigate within your source code using different action such as autoscroll, bookmarks, or the Select In pop-up. You can also look up a symbol declaration and its type, see implementations, and quick definitions.

You can automatically locate a class in the Project tool window.

  1. If the class in question is opened in the editor, press Alt+F1 for the Select in pop-up.

    Select in pop-up

  2. In the pop-up, select Project View and press Enter.

    PyCharm locates your target in the Project View window.

Use Autoscroll to locate a file

You can use the scroll to and from actions to locate your file in the Project view.

  1. In the Project tool window, right-click the Project area.

    Context menu

  2. From the context menu, select Autoscroll from Source. PyCharm tracks a file that is currently open in the editor and locates it in the Project view automatically.

  3. You can also select the Autoscroll to Source option. In this case, when you click a file in the Project view, PyCharm will automatically open it in the editor.

Use bookmarks for navigation

You can add a bookmark to any line of your code.

  1. On the desired line of code, press the following shortcuts:
    • F11 to create an anonymous bookmark.

    • Press Ctrl+F11 and select a number or a letter to create a book mark with mnemonics.

  2. Press N/A or N/A to show next or previous bookmark.

  3. Press Shift+F11 to open the Bookmarks dialog where you can manage bookmarks, for example, you can delete, sort bookmarks, or supply them with a brief description.

  4. If you have a bookmark with letter mnemonics, press Shift+F11 and press the letter you need. PyCharm returns you back to the editor and to the corresponding bookmark.

  5. If you need to navigate to an existing bookmark with number mnemonics, press Ctrl and the bookmark's number.

  6. Every created bookmark is reflected in the Favorites (Alt+2) tool window which you can also use for navigation to your bookmarks.

Go to declaration and its type

You can navigate to the initial declaration of a symbol and symbol's type from its usage.

  • Place a caret at a symbol in question and press Ctrl+B.

  • For a type declaration, press Ctrl+Shift+B.

Go to Implementation

You can keep track of class implementations and overriding methods using either the gutter icons or the appropriate shortcuts.

  • Click the one of icons gutter implementedMethod svg / icons gutter implementingMethod svg, icons gutter overridenMethod svg / icons gutter overridingMethod svg gutter icons and select the desired ascendant or descendant class from the list.

  • Press Ctrl+U to navigate to the super method.

  • Press Ctrl+Alt+B to navigate to the implementation.

Locate the source code element with Structure view

You can use the structure view pop-up to locate a code element in the file you are working on.

  1. Press Ctrl+F12 to open the structure view pop-up.

  2. In the pop-up, locate the item you need. You can start typing the name of the element and PyCharm narrows down the search. Press Enter to return back to the editor, and the corresponding element.

    While in the pop-up, you can sort the file members, see anonymous classes, and inherited members.

    Structure View pop-up

If you want to browse through methods in the editor, you can use the Alt+Down / Alt+Up shortcut to navigate to next or previous method.

Moreover, you can visually separate methods in your code. To do that, open the Settings/Preferences (Ctrl+Alt+S) dialog, go to | Editor | General | Appearance and select the Show method separators option.

Last modified: 27 February 2019

See Also

Tutorials and Examples: