James Akwuh
James Akwuh

Reputation: 2217

How to configure WebStorm to properly format generator functions?

I'm using WebStorm code auto formatting and notice that it doesn't format correctly generator functions. I need this:

function* (), function* name()

But WebStorm formats it to this:

function*(), function* name()

There are some settings in WebStorm's code style preferences, but seems like they do not cover this case. Are there any solutions?

Upvotes: 2

Views: 148

Answers (1)

shilch
shilch

Reputation: 1945

Webstorm does not seem to have this option (my Webstorm 2016.1.2 ignores generator function when formating). A workaround for this problem is a grunt / gulp task that rewrites the files (do a backup first!). So you would use a plugin like gulp-replace to define a task gulp reformat that you call after formatting with Webstorm. Not the best solution, but it should work ;)
However, I would wait for an update.

Upvotes: 1

Related Questions