You can use the Introduce Variable refactoring even on incomplete statements. Just select the necessary block in the editor and press &shortcut:IntroduceVariable;.