The basic way to select a piece of text is to extend the selection with the mouse cursor. PyCharm, as a keyboard-centric IDE, suggests to use navigation keys to make selections. You can opt to select pieces of text by lines, or select rectangular fragments in the column mode, extend and shrink the selection, and use sticky selection.

In this section:

When you perform various code refactorings that involve selecting an expression , PyCharm can help you select the expression of interest. This feature is known as smart expression selection.

The procedure for the Introduce Variable refactoring is just an example. The smart expression selection feature, in fact, is available in all the refactorings that start with selecting an expression.

  1. Place the cursor before or within the expression.

    ws_php_storm_introduceVariableJSSmartSelectExpressionStart.png

  2. Choose Refactor | Extract Variable from the main or the context menu, or press Ctrl+Alt+V.
  3. In the Expressions pop-up menu, select the expression. To do that, click the required expression. Alternatively, use the Up and Down arrow keys to navigate to the expression of interest, and then press Enter to select it.

    ws_php_storm_introduceVariableJSSmartSelectExpression.png

See Also

Procedures:

Reference:

Web Resources: