There are times where I have already written some value, and want to put it into a variable rather than using the value directly. So I copy the value, replace it with the name of a currently undeclared variable, then declare the variable and paste the value
It would be useful if the undeclared variable showed in autofill
Hmm, I’m not sure I agree with this suggestion exactly as posted. If we start suggesting undeclared-but-used variables there’s a risk of Autocomplete misleading people (e.g. someone misspells a variable elsewhere in the script and then Autocompletes it).
Maybe instead, this points to the need for a “Refactor → Extract Variable” action that does the common expression replacement for you. Would that address your workflow?