When using the Format Document command I'd like to change how the code formats. I'm completely new to VSCode and I'm still having trouble navigating the settings, so easy to understand replies would be very helpful. Currently the code is formatting like this:
void start () { //Do stuff here }
I want it to look like:
void start () { //Do stuff here }
In programming, curly braces (the { and } characters) are used in a variety of ways. In C/C++, they are used to signify the start and end of a series of statements. In the following expression, everything between the { and } are executed if the variable mouseDOWNinText is true. See event loop.
I have found this simple solution for VScode !
Just create a file called omnisharp.json at the root of your project and paste the following JSON :
{ "FormattingOptions": { "NewLinesForBracesInLambdaExpressionBody": false, "NewLinesForBracesInAnonymousMethods": false, "NewLinesForBracesInAnonymousTypes": false, "NewLinesForBracesInControlBlocks": false, "NewLinesForBracesInTypes": false, "NewLinesForBracesInMethods": false, "NewLinesForBracesInProperties": false, "NewLinesForBracesInObjectCollectionArrayInitializers": false, "NewLinesForBracesInAccessors": false, "NewLineForElse": false, "NewLineForCatch": false, "NewLineForFinally": false } }
I found the solution here: https://medium.com/@wearetherock/visual-studio-code-c-put-the-opening-brace-on-the-same-line-as-the-statement-a98c552a544b
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With