<commit_before>---
published: false
---

---
layout:     post
title:      WebStorm Live Templates for Meteor development
date:       2015-04-26 23:30:39
summary:    Learn how to use Live Templates in Webstorm to speed up meteor development.
categories: tech meteor
---
## What are Live Templates
 
In many frameworks including meteor particular code structures show up again and again. [WebStorm](https://www.jetbrains.com/webstorm/) has a feature called Live Templates which can be seen as customizable autocomplete. We define an abbreviation which expands to our template text when we press the 'expand' key (tab by default).
 
Below we will go over 5 of the most useful Live Templates I've found. If you'd like to share your own, feel free to do so in the comment section below.
 
## Creating a Live Template
To create a Live Template launch WebStorm and head to File > Settings > Editor > Live Templates. Now press the ![Add](images/add.png) on the top right and select Live Template. For each of the templates, click define ![No context available](images/no_applicable_context.png) and check JavaScript.
 
## 1. Getting and setting Session variables
Abbreviation: sget
Description: Get a session variable.
Template text:
{% highlight ruby %}
Session.get($PARAMETER$)$END$
{% endhighlight %}

Abbreviation: sset<commit_msg>Publish the post<commit_after>---
published: false
---

---
layout:     post
title:      WebStorm Live Templates for Meteor development
date:       2015-04-26 23:30:39
summary:    Learn how to use Live Templates in Webstorm to speed up meteor development.
categories: tech meteor
published: true
---
## What are Live Templates
 
In many frameworks including meteor particular code structures show up again and again. [WebStorm](https://www.jetbrains.com/webstorm/) has a feature called Live Templates which can be seen as customizable autocomplete. We define an abbreviation which expands to our template text when we press the 'expand' key (tab by default).
 
Below we will go over 5 of the most useful Live Templates I've found. If you'd like to share your own, feel free to do so in the comment section below.
 
## Creating a Live Template
To create a Live Template launch WebStorm and head to File > Settings > Editor > Live Templates. Now press the ![Add](images/add.png) on the top right and select Live Template. For each of the templates, click define ![No context available](images/no_applicable_context.png) and check JavaScript.
 
## 1. Getting and setting Session variables
Abbreviation: sget
Description: Get a session variable.
Template text:
{% highlight ruby %}
Session.get($PARAMETER$)$END$
{% endhighlight %}

Abbreviation: sset
{'fraction_non_alphanumeric': 0.07295173961840629, 'fraction_numerical': 0.011971567527123082, 'mean_word_length': 4.212475633528265, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3509388', 'n_tokens_mistral': 766, 'n_tokens_neox': 677, 'n_words': 359}