问题描述
我希望VS Code将花括号放在C#和C ++的新行中
I want VS Code to put curly braces on a new line in C# and C++
现在如何工作
外观如何
尝试了C#FixFormat扩展,但仅在按CTRL + K + F后才有效但是我希望VS Code在编码时在新行上加上大括号,无需像热键之类的其他步骤
Tried C# FixFormat extension, but it works only after I push CTRL+K+Fbut I want VS Code to make curly braces on new lines while I'm coding,without additional steps like hotkeys and such
推荐答案
就我而言,我使用的是Microsoft的 C#扩展名(3.5星).默认情况下,此扩展使用其默认的C#格式化程序.禁用格式化选项,如下所示,您将一无所获,包括烦人的NewLinesForBracesInMethods
.另外,您可以尝试调整C#扩展格式化程序. 在此处获取更多信息.
In my case, I was using the C# extension by Microsoft (3.5 stars). By default, this extension uses its default C# formatter. Disable the formatting option as shown below, and you won't get any for formatting, including the annoying NewLinesForBracesInMethods
. Alternatively you can try to tweak the C# extension formatter. More info here.
所以我用 C#FixFormat (5星)扩展名替换了它.对于我来说,这似乎可以直接使用.
So I replaced it with the C# FixFormat (5 stars) extension. This seems to work straight of the box for me.
但是后来我意识到,我没有获得自动完成功能,因此我通过Microsoft重新安装了C#扩展,并保留了FixFormat扩展.而且效果很好,没有新的括号.
But then I realised, I wasn't getting autocomplete, so I reinstalled the C# extension by microsoft, and kept the FixFormat extension. And it works great, no new lines for braces.
这篇关于如何设置VSCode在键入时将花括号放在C#和C ++的新行中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!