简体   繁体   English

VS2017在C ++中大括号缩进

[英]VS2017 indenting on braces in C++

I have watched several C++ tutorials on Pluralsight using VS2017 and whenever the author types a pair of braces and presses enter, the cursor always appears indented and on the middle line, ready for typing to commence (see image 2 ). 我已经看过使用VS2017PluralsightPluralsight几本C++教程,每当作者键入一对大括号并按Enter时,光标始终显示为缩进并在中间行,可以开始键入(参见image 2 )。 In my VS2017 however, the cursor always appears in front of the closing brace (see image 1 ), so I have to press enter to create a blank line between the braces, move the cursor up and then type a tab before I can start typing. 但是,在我的VS2017中,光标总是出现在VS2017大括号的前面(请参见图image 1 ),因此我必须按Enter在大括号之间创建空白行,将光标向上移动,然后键入一个选项卡,然后才能开始输入。

I have searched the settings in VS2017 under text editor/C++ but cannot find how to change this behaviour. 我已经在text editor/C++下的VS2017搜索了设置,但是找不到如何更改此行为。 It's annoying and I'm thinking there must be a way to change it. 这很烦人,我在想必须要有一种改变它的方法。

Does anyone know how please? 有人知道吗?

大括号

Tools >> Options >> Text Editor >> C++ >> Formatting >> General 工具>>选项>>文本编辑器>> C ++ >>格式>>常规

Be sure that "Automatically format braces when they are automatically completed" is checked. 确保选中“自动完成括号后自动格式化”。

That should give you what you want 那应该给你你想要的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM