Visual Studio 2013 C++ auto indenting doesn't work well

本小妞迷上赌 提交于 2019-12-21 21:38:35

问题


For some reason, after I type the following block in Visual Studio 2013:

for (int i = 0; i < m; i++)
    if (some_condition)
    {

    }

VS 2013 automatically indents the code to this:

for (int i = 0; i < m; i++)
if (some_condition)
{

}

If I put the if between curly brackets, it formats the code correctly. This behavior is very frustrating. I don't remember having this issue in VS 2012.

If I disable auto formatting, it doesn't even put the cursor at the same indent level as the line above. Even notepad++ works better than VS.

Is there a way to fix this? Maybe to import the indenting rules from VS2012 which worked just fine?


回答1:


Bug is fixed with VS 2013 Update 1. Try install it Tools -> Extensions and Updates -> Updates -> Product Updates -> Update 1




回答2:


Can you change settings as below and check

In Tool->Options->Text editor->C/C++->Format-> Indentation (un-check this option) and reformate code block once or try new code.



来源:https://stackoverflow.com/questions/20491828/visual-studio-2013-c-auto-indenting-doesnt-work-well

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