VScode formatter, keep open bracket at same line (PHP)

The new versions of VScode include this feature already.

You just need to search for "intelephense" in the VScode settings, and look for a setting called "Braces".

VScode Intelephense braces setting


If you want to have your php code formatted like this

function test {

}

then use intelephense with the following settings.

  "intelephense.format.braces": "k&r"

Edit

As @Pinonirvana said in his answer, you can now do this through the GUI.
You'll find this information under du user settings:

Short key -> Ctrl+,

or

File > Preferences > Settings

enter image description here


There is default formatter in the intelephence and it doesen't have many options to customize. You can disable it in the php language-specific settings:

~/.config/Code - OSS/User/settings.json:
----------
...
"[php]": {
    // "editor.defaultFormatter": "bmewburn.vscode-intelephense-client"
    "editor.defaultFormatter": "kokororin.vscode-phpfmt"
},
...

Then you can use some another formatter that support customization, phpfmt for example. Here is my settings:

"phpfmt.exclude": [
    "AllmanStyleBraces"
],
"phpfmt.smart_linebreak_after_curly": true,
"phpfmt.psr2": false,
"phpfmt.detect_indent": true