Visual Studio C ++“在}上自动格式化已完成的块” [英] Visual Studio C++ "Automatically format completed block on }"

查看:72
本文介绍了Visual Studio C ++“在}上自动格式化已完成的块”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio为C#设置了此设置,但对于C ++我找不到。 在}上自动格式化已完成的代码块,我在处理C#内容时经常使用此功能。现在,我回到了C ++(我更喜欢),我错过了该功能。我该如何设置?我想我现在必须使用3rd party插件或其他东西,但是我在所有搜索中都找不到任何相关的插件。

Visual Studio has this setting for C#, but I can't find it for C++. "Automatically format completed block on }" I used this feature a lot while working on C# stuff & now that I'm back on C++ (which I prefer), I miss the feature. How can I set this up? I assume I'd have to use a 3rd party plugin or something at this point, but I can't find any relevant ones in all my searching.

该功能是什么可以:如果我有一段代码&

What the feature does: If I have a section of code & type '{' before it, then type '}' after it, it will automatically tab it in to match the tabbing rules that make the code easier to read.

Ex,然后在其后键入 {,然后在其后键入},它将自动将其插入以匹配使代码易于阅读的制表规则。 :

Ex:

以一些代码开始:

{
    int i = 1;
    int j = 2;
    j += i;
}






在某处添加起始括号:


Add a start bracket somewhere:

{
    int i = 1;
    int j = 2;
    {
    j += i;
}






添加结尾括号,并且包含的​​代码会自动为我显示:


Add an end-bracket, and the contained code is automatically tabbed in for me:

{
    int i = 1;
    int j = 2;
    {
        j += i;
    }
}


推荐答案

此在Visual Studio 2013中。请确保在文本编辑器-> C / C ++->格式设置->常规下的选项中启用了该功能。选项是键入}时自动格式化块。

This is in Visual Studio 2013. Make sure you have it enabled in Options under Text Editor->C/C++->Formatting->General. The option is "Automatically format block when I type a }".

这篇关于Visual Studio C ++“在}上自动格式化已完成的块”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆