I am creating a snippet for my templates in Meteor and the only thing left to be perfect would be to know the file name in which that snippet was called.
What I have:
type: temp + tab
What I get:
<template name="">
</template>
What I want:
<template name="">
file_name.html
</template>
Live Templates is how "snippets" are called in WebStorm and other IDEA-based IDEs.
There is filename() function (fileNameWithoutExtension() has been added a few version later) that can provide such info/text for a variable. Official documentation.
Knowing that: add a variable into your template and then use the aforementioned function on it:
<template name="$END$">
$FILE$
</template>
Now click on "Edit Variables" button and use it there. Selecting "Skip if defined" will make that variable "non-editable" during template expansion.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With