This $END$ is a special predefined variable for placing the cursor once the abbreviation is expanded. The template text field that we modified contains an identifier ( $END$) So check only the Statement box in the JavaScript drop-down area as shown below In our case, this would be a Javascript Statement. Applicable context: The context where this live template should take effect.Set this as console.log("Fired-", $END$) Template text: The actual content that will replace the abbreviation.We will set it as ‘This will print out console.log() statement’ Description (which is optional): a short readable description of what this template is used for.Abbreviation: which could be anything of your choosing.You will be prompted to enter the following Now again hit the + button and choose “Live Template” this time. What you could do is click on the + button on the extreme right and choose “Template Group” to create a new template group. The dialog displays a list of already existing templates. As an example, I will show you how you could insert a console.log('Fired') statement using the abbreviation log Create a Template Group Here you can add the abbreviation and the accompanying autocomplete code as per your wish. In your IDE, Navigate to Settings->Editor->Live Templates. Certainly we could do a copy-paste each time but even then you’d need to type the whole thing the first time at least! and the effort involved in copy-pasting from different files is sometimes just so tedious that I’d honestly prefer typing it out! Now for a lazy developer like myself, that’s a lot eh! So why not shorten the syntax ? Live Templates brings us this custom autocomplete feature with PhpStorm/WebStorm. ![]() During development, isn’t it several 100 times that we need to print something on the screen? (Maybe just to check the flow of execution, especially with the advent of modular development?) Well, we end up typing the same syntax over and over again.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |