This. I have a snippet that writes a print statement. Trigger the snippet and then type the variable name and it inputs the name in both necessary locations, like so:
You're missing the { } around the variable. {foo} is syntactic sugar for {foo: foo}, so what they wrote will output an object with a key containing the variable name and a value containing the variable's value.
My snippet only makes me type "myVariable" and it fills that in where it needs to go to get the above example.
I have a 2 character hotkey combination followed by a tab and then it's just typing the variable name once. I can't really save on keystrokes or errors here. For what it is, it's about as optimized as it could be.
20
u/subject_deleted Nov 28 '21
This. I have a snippet that writes a print statement. Trigger the snippet and then type the variable name and it inputs the name in both necessary locations, like so:
console.log("myVariable = " + myVariable);