I want to make snippet for console.log(variable) but instead to have prefix I want to make this with "suffix". Here’s an example:
var name = "Marco";
var car = "Volvo";
name.log > TAB > console.log(name);
When I write my variable "name" after that ".log" like in example above. After that pressing TAB key on keyboard i want to get my "console.log(name);".
When I do it like this: car.log > TAB, I want to get "console.log(car);".
2
Answers
Looking at the documentation for Snippets, I don’t think what you’re asking for is supported.
The mechanism for using snippets is based on exact matches of text (the
prefix
field), and while the variables include things likeTM_CURRENT_LINE
andTM_CURRENT_WORD
, and even given those, I can’t see a way to work them to do what you want.The closest I could get was
But I don’t know how to "consume" / remove the pre-existing text preceding the snippet prefix.
what you can do is
name
name
, useCtrl+D
clog
clog
is the following snippet: