Reputation: 2682
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>
Upvotes: 2
Views: 3451
Reputation: 165178
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.
Upvotes: 11