You can quickly extract an expression at the caret as a variable, by pressing &shortcut:IntroduceVariable; (Refactor | Extract | Variable). The IDE will prompt you to confirm the expression to extract and ask if you want to replace the occurrences of that expression in other places within a function, if any.