[PhpStorm 2016] Javascript code reformat issue


I would like some help to find where I didn't set the javascript code style parameter right.
My issue is that the first method of an objet goes to the next line, while I would like to keep it on the same line.
Though I want second, third, fourth, etc to wrap... Only the first one should stay inline.
Exemples will do the talk.

This is what I want:

$('body').on('vclick', '.myTracking', function() {
myTracking($(this).attr("data-id"), $(this).attr("data-type"), $(this).attr("data-value"));

and this is what I get:

.on('vclick', '.myTracking', function() {
.attr("data-id"), $(this)
.attr("data-type"), $(this)

Here is a screen of my settings:

It was working fine on PhpStorm 10, but I can't get it back on PhpStorm 2016.


Hope someone will be able to help. Thanks



Please set Chained method calls to "Do not wrap". This should do the trick.


I want them to wrap... but not the first one...
If I set to "Do not wrap', it will place everything on the same line...
Might be a problem to read things afterward... ^^


Did you try 'Chop down if long' instead of 'Wrap always'?


I did, it will keep inline if there is two method, which I don't want... :/
Maybe it's a bug... As the preview on the right of the setting screen show it correctly...


To me, the resultant formatting exactly matches the one in preview:



Note: 'long' here means 'exceeds right margin' that can be set in Settings | Editor | Code Style, Right margin (columns)


Do you mind to screen and zip every tab of the javascript code style plz?!
I will compare with my own settings when I will be back home in about 45 mins


It's default - only options I changed are 'Chop down if long' and 'Align when multiline' for chained calls. Note also that existing line breaks are kept by default on reformatting, so, if the call is already on a new line, it will be kept there and you run Format Code


I see...
Unfortunate, but it won't works...

It works in my exemple because it's small code, it won't with big one... :/

As exemple, ligne 22 on your screenshot, you have 2 chained method on the same line...
Unlike my screenshot which have x(), y(), z() on seperate line, but the first method x(), was kept on the first line.


My screenshot shows the resultant formatting with 'Chop down if long', and yours - 'wrap always'.

With 'wrap always' formatting looks as follows:


that, again, matches the preview...



Sorry for the long silence...
I will try to reset my settings, maybe I checked something I shouldn't have...

Also, just to be sure... You're on PhpStorm 2016 right?! (Lastest version)


Please sign in to leave a comment.