Is there a way to setup vscode to auto format the curly brackets to go on new lines. I recently had to switch from visual studio to vscode and trying to get it to function like i had my visual studio so i can fully get back to my usual work flow. Ive posts about some extensions that are sopposed to do this but they either dotn function right or are no longer available. Thanks for the help
Asked
Active
Viewed 1,343 times
0
-
1Does this answer your question? [How do I set up VSCode to put curly braces on a new line?](https://stackoverflow.com/questions/32900921/how-do-i-set-up-vscode-to-put-curly-braces-on-a-new-line) – SmileyMiley Dec 12 '21 at 16:12
-
Thats a solution for javascript, im using c# and it doesnt have those same options – Jeremy Dec 12 '21 at 16:22
-
https://nosuchstudio.medium.com/formatting-curly-braces-on-the-same-line-in-c-in-vscode-c4937e1c215f – hk1ll3r Dec 13 '21 at 20:12
-
I had the same issue, and answered it [here](https://stackoverflow.com/a/76195410/13177011). – Raphael Setin May 07 '23 at 17:48
1 Answers
0
To make VSCode add a new line for opening curly brackets, Create a file named omnisharp.json
in the root of your Unity project (beside your Assets folder) with the following content and then restart VSCode.
{
"FormattingOptions": {
"NewLinesForBracesInLambdaExpressionBody": true,
"NewLinesForBracesInAnonymousMethods": true,
"NewLinesForBracesInAnonymousTypes": true,
"NewLinesForBracesInControlBlocks": true,
"NewLinesForBracesInTypes": true,
"NewLinesForBracesInMethods": true,
"NewLinesForBracesInProperties": true,
"NewLinesForBracesInObjectCollectionArrayInitializers": true,
"NewLinesForBracesInAccessors": true,
"NewLineForElse": true,
"NewLineForCatch": true,
"NewLineForFinally": true
}
}

Tidominer
- 67
- 6
-
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 13 '21 at 00:02