//:Ideas
Made={*}
Possible
All Insights
Current Article:
Faster Coding With Live templates

Faster Coding With Live templates

Posted on
February 11, 2021
, By
admin
Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

  • Test text
  • Test text
  • Test text

What’s a Rich Text element?

The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.

Static and dynamic content editing

A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!

How to customize formatting for each rich text

Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.

What Are Live Templates?

Live templates are predefined functionalities in almost all JetBrains IDE programs.

When Can We Use Live Templates?

They are recommended if you want to increase your productivity by placing the code line that you would probably use the most into the Live template. It will save your time in further coding. Most people that are working in IT are looking for ways to cut time spent in development so they could do other stuff. Like working on some personal projects, or, in my case, playing darts with my colleagues. This is one example of achieving that.

How Can We Implement Live Templates?

My advice is, whenever you come across a block of code that most likely will be used occasionally in a short period of time, take a few minutes to add it inside Live templates in order to save time by calling it with a small change.

  • Dialogue with live templates can be found inside Preferences -> Editor -> Live Templates and it looks like this:
prva

Even when you install PHPStorm, you can find some predefined templates which can be a good base for you to learn how to create a structure for new ones.

  • You can also choose the way you want to call templates. It can be ‘Tab’, ‘Space’, or any other key combination.
1
  • Let's go through an example of adding one template for Laravel Framework. One of the ideas is to use it as relations inside models. The first step is to click on `+` and choose `Live template`.
6
  • Next, you need to fill out a new template.

-Abbreviations (text that you will type in order to call the template)

-Description (description popup)

-Template text (template body)

-Context (the context in which the template applies)

-Edit variables (dynamic part of the template)

-Expand (button to call the template)

44
  • After adding the template, next thing is to continue with editing the dynamic part of the template by clicking on `Edit Variables`. Save all progress and go back to the Editor.  
  • Let's see what happens if you open Post model class and you add-relation with User class.
2

By typing template abbreviation that you`ve just created, you will get a popup with a suggestion.

3 (1)
  • Use the `Tab` button to fill out the block code on places where the cursor is and places you have chosen to enter manually. Every next Tab press will lead you to the next place until they are all filled out.

The final look of block code would look like this.

4

When Using Live Templates is Not Recommended?

If you are a beginner and want to go through the complete learning process step by step, then it would be better not to use this functionality. Later, when you need to be faster, use Live templates and save your time.

4What's Behind the Efficiency of Quantox Developers?

Using Live Templates is just one way how Quantox developers can expedite the software development process. We know how to use IDE programs to increase our productivity, while keeping the code readable, reusable and secure. If you need an IT solutions fast, we have ways of cutting the development process time. Let's Talk!