Question

In PhpStorm is it possible to have the auto formatter align consecutive assignments in JavaScript? The PHP formatter has the option to align on equals ("+") by checking the "Align consecutive assignments" option in Settings -> Code Style -> PHP -> Other(Tab), but there doesn't seem to be that option for JavaScript, just for colon assignments.

I am using PhpStorm 7.1.3, the latest at the time of writing.

Thanks.

Was it helpful?

Solution

I am using phpstorm 2018.3.5 and I just had to configure this style of alignment for a project I took over.

As sam said here for php you can set it in :

Settings -> Editor -> Code Style -> PHP -> Wrapping and Braces -> Align consecutive assignments

So I thought it would be the same for JS but it turns out to be slightly different :

Settings -> Editor -> Code Style -> JavaScript -> Wrapping and Braces -> Variable Declarations -> Align -> When grouped

I hope this can help.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top