What setting in VSCode makes the editor stop rearranging curly brackets?

Advertisements

VSCode is a great IDE, but sometimes it doesn’t do what I want.

On saving my file, the editor changes the position of my curly brackets.

(I am editing mainly PHP and JS, and VSCode version 1.77.1, with only 1 extension: Intelephense)

for example:

function glue($a, $b){
  return $a . $b;
}

changes into:

function glue($a, $b)
{
  return $a . $b;
}

I have tried changing some editor values in setting.json, but I cannot find the right one.
How can I tell VScode to not rearrange my brackets?

Thanks for your time!

EDIT:

User CamB04 put me on the right track. For others with my (old) codingstyle, add this to your settings.json:

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

(K&R = Brian Kernighan and Dennis Ritchie, the inventors of the C-language)

>Solution :

You can write brace in the research bar and the second parameter that shows is what you are looking for I think:

JavaScript › Format: Place Open Brace On New Line For Functions Defines whether an open brace is put onto a new line for functions or not.

Kind regards.

Leave a ReplyCancel reply