While using Prettier, IntelliJ IDEA keeps removing space between the function and parentheses

I uses Prettier. IntelliJ IDEA does the following:

Having this code:

describe('My test', function () {
});

After reformatting the file it keeps removing the space between function and parentheses so it looks like this:

 describe('My test', function() {
});

How do I make it stop doing that? And how to make it insert the space between function and parentheses if there is none?

0
3 comments

Try enabling *Before parentheses > Function declaration parentheses* in `Settings | Editor | Code Style | JavaScript/TypeScript > Spaces`. Will it help?

0

Nope, it didn't help :(

0

It was my bad. I used from the menu Code > Reformat code which triggered the default formatter.

I didn't read the documentation carefully https://www.jetbrains.com/help/idea/prettier.html

I had to right click the file and choose "Reformat with Prettier" option.

I also added it to be kicked off upon saving.

Sorry for that. This would apply RTFM thingy :)

 

1

Please sign in to leave a comment.