PyCharm 2024.2 Help

Sticky lines

The sticky lines (or sticky scroll) feature enhances your coding experience by maintaining the visibility of parent elements as you scroll through the file, offering immediate context to your code. In a file with a complex hierarchy of classes and methods, this feature ensures that the signature of the currently viewed method and its containing classes always remain at the top of the editor.

You can also click any of the sticky lines to scroll the editor to the corresponding declaration.

PyCharm: Sticky lines in the editor

By default, the maximum number of sticky lines is set to 5.

Configure number of sticky lines

  • Right-click the sticky lines in the editor and click Configure Sticky Lines.

    Configure sticky lines
  • Press Ctrl+Alt+S to open settings and then select Editor | General | Sticky Lines. Next to the Maximum number of lines field, enter the desired number of sticky lines.

Disable sticky lines

Disable sticky lines

By default, the Show sticky lines feature is enabled. You can choose to disable the feature for all languages or for specific languages.

Disable sticky lines for all languages

  • Right-click the sticky lines in the editor and click Disable.

    Disable sticky lines
  • Right-click the gutter, select Appearance, and then deselect Show Sticky Lines.

    Disable sticky lines from the gutter
  • Press Ctrl+Alt+S to open settings and then select Editor | General | Sticky Lines. Clear the Show sticky lines while scrolling checkbox.

Disable sticky lines for specific languages

  • Right-click the sticky lines in the editor and click Disable for <language>. The option will list the language you are currently viewing.

    Disable sticky lines
  • Press Ctrl+Alt+S to open settings and then select Editor | General | Sticky Lines. In the Languages section, deselect the checkbox next to the language to disable sticky lines for it.

    Disable sticky lines for specific language

Change sticky lines color settings

  • Press Ctrl+Alt+S to open settings and then select Editor | Color Scheme | General | Editor | Sticky Lines. Edit the color for the background, border, or hovered state.

    Sticky lines color scheme settings
Last modified: 23 September 2024