JavaScript Postfix Completion

This post is part of a series of posts covering features in WebStorm 9 EAP:

It was bound to happen. Over a year ago we introduced the concept of Postfix code completion in ReSharper. A year later, it was introduced to IntelliJ IDEA 13, and today, we’re bringing Postfix code completion to JavaScript with WebStorm 9 EAP.

If you’re not familiar with it, here’s a glimpse into how it works:

Not Null

We are introducing a not null check after having typed the name of the argument. We do this by typing .notnull after the identifier.

Here is another example showing how we can do a for loop using .itin:

It In

The purpose behind Postfix completion is that often we realize that a certain construct has to be created when writing code, and this provides a more efficient way, as opposed to messing around with the cursors keys or mouse to position the caret in a specific place. If you think about it, it’s pretty similar to Live Templates, except that you’re invoking them after having written some code.

In addition to the above two completions, WebStorm provides the following postfix completions:

Postfix list

each of which can be activated or deactivated via Preferences | Editor | Postfix completion.

We can also invoke a list of completions available using the Cmd+J key (Ctrl+J on Windows), which invokes the Live Template insertion menu.

Try it out in the recently opened WebStorm 9 EAP and let us know what you think. If you have any suggestions on some completions you’d like, also let us know. You can either leave them as comments here or file in an issue in YouTrack.

Develop with pleasure!
JetBrains WebStorm Team

This entry was posted in Cool Feature, Early Access Preview. Bookmark the permalink.

24 Responses to JavaScript Postfix Completion

  1. Pingback: WebStorm 9 EAP is Open! | JetBrains WebStorm Blog

  2. Mikhail Krasilnikov says:

    Any plans to fix OLD usability problems? Like 2 years old, or

    • Ekaterina Prigara says:

      At the moment I’m not aware of any plans to fix these issues for the upcoming release, however, right now out Platform team is working on some UX improvements in the project configuration including inspection profiles, so hopefully we’ll be able to see some positive changes in the nearest future.

    • Strajk says:


      As dev, I understand that making new features is more fun than bugfixing, but there is a really lot of bugs which should deserve more attention :/

      • Ekaterina Prigara says:

        Feel free to vote for the most critical issues in your opinion on our issue tracker:
        Votes help our dev team to prioritise the issues.

        • Charles Scalfani says:

          If only voting for things mattered.

        • Terence Martin says:

          There is a disconnect between having the issues prioritized and having them actually addressed. See for example created February 2005, still outstanding (not closed), lots of votes (121, I think) but?

          It also doesn’t seem fair that if I encounter a bug, the only hope I have of getting it fixed is to report it and hope that enough other people also happen to notice the same bug, realize I reported it, and then vote, so that it filters to the top of the priority list for possible fixing. Or, failing that, run some sort of social media campaign to raise awareness. I just want to write code.

          To be honest? As a result of this, I don’t bother reporting anything I see any longer. There are too many reports already and it seems as if zero attention is paid unless enough people vote and bring it to someone’s attention.

          I’m working under the theory that if someone else hasn’t already noticed it, there’s no way in hell anything *I* do is going to have any effect on anything, so why bother?

          I just do my best to work around the bugs as best I can and cross my fingers that some day they might be fixed.

          • Ekaterina Prigara says:

            Dear Terence,
            there is a difference between features and bugs. When the teams (IntelliJ IDEA platform core team, WebStorm team and others) decide on the new features to work on lots of factors are considered and number of votes is one of them. For the bug reports, of course, number of votes and feedback is the strongest signal, however, to tell the truth, some issues take more time to fix than we would like to, but still votes help us better prioritize.

  3. actually the shipped notnull postfix macro is wrong from javascript perspective :)
    It should translate to if ( id !== null ) { ... }

    I know it’s editable , but you know, just sayin… ;)

    • Jerry Stonesbergs says:

      Actually, that depends. != null matches for both null and undefined, which more often than not is what you want.

      But it depends. Which is why it’s absolute essential that they are editable/configurable!

      The trigger should also be configurable; e.g. I’d prefer the trigger to be “.nn” (“not null”).

      And creating your own postfix completions would be very useful as well. When working with jasmine, it is a great bit of hassle wrapping your expression in expect(___).toBe($END$); I make custom live templates all the time – it’s incredibly useful. So being able to make your own postfix completions is a HUGE deal for me.

      Jerry :)

      • Andrey Starovoyt says:

        @Martin.Hochel , @Jerry.Stonesbergs Hi,
        > Actually, that depends. != null matches for both null and undefined, which more often than not is what you want.
        It is true, so we implemented just ‘!= null’. Of course the other form ‘ id !== null’ is popular and matches to the best js practices. If you think that both forms can be useful at the same time we can consider possibility of adding a postfix template for the form ‘id !== null’.

        Now there is no way to change postfix templates but we have thoughts to make templates customizable. You can vote for the feature:

        If you have ideas what kinds js postfix templates can be added to webstorm please share your opinion!

  4. Pingback: WebStorm 9 EAP, 138.2406: spy-js code completion, CSS3 enhancements, Scratch files and… JSX | JetBrains WebStorm Blog

  5. Pingback: IntelliJ IDEA 14 パブリックプレビュー | JetBrains ブログ

  6. Jordan says:

    Looks like you’re missing a VERY common and REALLY important postfix – the IIFE (Immediately Invoked Function Expression, or a.k.a. “self-executing function”):

    (function (arg) {


    • Andrey Starovoyt says:

      Hi. Thanks for the feedback.
      I am not sure that you want Postfix Template. I think Live Template is more applicable here. Postfix Template always is called to some expressions. On the other hand Live Template just generates code-snippet. You can add custom Live Template (and there is no way to add custom Postfix Template). Is the Live Template what you need?

  7. Oleg Taranenko says:

    Perfect extension, but sad there is not possible to add a new (or maybe remove) postfix completion.
    Ie. I’m using console .log and console.warn and console.error functions.

    Should I file a new wish or it already exists?

    thanks, Oleg

  8. Pingback: IntelliJ IDEA 14 is Released! | JetBrains IntelliJ IDEA Blog

  9. Mihai says:

    It would be great if you could add this for actionscript as well. Not much different to javascript, I imagine. Thanks.

  10. Pingback: Meteor Support in WebStorm 9 | JetBrains WebStorm Blog

  11. Pingback: Tracing, debugging and profiling Node.js with spy-js | JetBrains WebStorm Blog

  12. Baoxin says:

    If you can add custom suffix completion, will be a very great function,thx

Leave a Reply

Your email address will not be published. Required fields are marked *