Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code PHP Formatter Intelephense

I use Visual Studio Code as my editor and Intelephense as my PHP formatter. It works well for the most part, but Intelephense changes my format in several ways that makes it harder for me to read. For example, I like to format my code as follows:

    if( $var ) {
        // Do something.
    }
    elseif( $var ) {
        // Do something.
    }

But! When I save, Intelephense changes the above to:

    if ($var) {
        // Do something.
    } elseif ($var) {
        // Do something.
    }

To me, that's harder to read, especially when dealing with long expressions. How can I configure Intelephense to format my code as in the first example?

like image 918
GTS Joe Avatar asked Jul 20 '20 16:07

GTS Joe


1 Answers

Extensions > PHP Intelephense > Manage(click the gear) > Find Intelephense › Format: Braces and change or Find Intelephense › Format: Enable and remove tick.

like image 166
xNoJustice Avatar answered Sep 21 '22 13:09

xNoJustice