Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading