C
C#3w ago
yourFriend

How to open brace on new line by default for C# or any language in vs code?

I want this by default:
if(condition)
{
code here;
}
if(condition)
{
code here;
}
Instead of:
if(condition){
code here;
}
if(condition){
code here;
}
5 Replies
yourFriend
yourFriendOP3w ago
Yes
Angius
Angius3w ago
Try an .editorconfig file https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/csharp-formatting-options#new-line-options
[*.cs]
csharp_new_line_before_open_brace = all
[*.cs]
csharp_new_line_before_open_brace = all
ero
ero3w ago
I don't think VSCode has such a feature. You need to get used to Enter Brace Enter
yourFriend
yourFriendOP2w ago
Yeah, I'll just do this for now. I do see some extensions for .editorconfig in VS Code. Might try them some day.
ero
ero2w ago
i don't believe an editorconfig will place braces on a new line while typing. i could see it doing so when formatting the file (ideally with formatOnSave turned on)
Want results from more Discord servers?
Add your server