There are several quick fixes that do useful things for variables in Mathematica code.
The Assign to local variable quick fix introduces a new
local variable and makes an assignment. Place the cursor
before an expression, for example, before the Sin[x],
as in the following.
After the quick fix, the result should appear as below.
The Extract to local variable quick fix introduces a new
local variable and makes an assignment to the current
selection. It also replaces other instances of the
selection with the local variable.
Select an expression, for example, before the Sin[x],
as in the following.
After the quick fix, the result should appear as below.
The Localize variable quick fix makes a variable into
a local variable.
Select a variable that is not a local variable, for example, the y,
as in the following.
After the quick fix, the result should appear as below.