How can I setup webstorm to automatically add semi-colons to javascript functions, methods, etc

tvpmb picture tvpmb · Aug 4, 2012 · Viewed 22.1k times · Source

When I write Javascript, I use semi-colons. However when I write in webstorm/phpstorm, it auto completes braces and brackets, but doesn't auto-add a semicolon. I know that isn't required per the standards, etc., but that's the way that I code - and I'm not alone, many people code this way.

Example:

var data = $.ajax({});

Normally, webstorm/phpstorm will do this, and leave the cursor inside the curly braces:

var data = $.ajax({})

All in the world that I want is to not have to add the semicolon manually and have it just auto-complete as I noted in my first example.

Answer

CrazyCoder picture CrazyCoder · Aug 4, 2012

There is no way to insert it automatically, you need to use the Complete Statement action (Ctrl+Shift+Enter).

You also need to check that Use semicolon to terminate statements option is enabled in Settings | Code Style | JavaScript | Other tab.