Visual Studio C++ “Automatically format completed block on }”

你。 提交于 2019-12-22 09:06:04

问题


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:

Start off with some code:

{
    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;
    }
}

回答1:


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 }".



来源:https://stackoverflow.com/questions/11799866/visual-studio-c-automatically-format-completed-block-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!