Search code examples
javascriptnode.jswebstormcode-generationstub

How to generate code stub in WebStorm editor


I am using WebStorm IDE for nodejs development. Whenever I write a new test case. First, try to create the following stub

describe('', ()=>{
    it('', ()=>{

    });
});

and then complete the test logic. How can I save the above stub somewhere in the IDE and get pasted/generated at the cursor by some key shortcuts?


Solution

  • Select your code snippet in editor, then choose Save as Live Template... from Tools main menu. See https://www.jetbrains.com/help/webstorm/2019.2/creating-and-editing-live-templates.html#9f697662

    see also https://www.jetbrains.com/help/webstorm/2019.2/using-live-templates.html