简体   繁体   English

Visual Studio C ++代码如何自动缩进预处理程序指令

[英]Visual Studio C++ code how to autoindent preprocessor directives

How to use autoindent the preprocessor directives 如何使用自动缩进预处理指令

For example in Visual studio all preprocessor directives intended like this 例如,在Visual Studio中,所有旨在这样的预处理器指令

void test(){
#if _SOME_VAR
    std::cout << "test" << std::endl;
#if _SOME_VAR2
      std::cout << "test2" << std::endl;
#endif
#endif
}

How can i make code auto indents like this 我该如何使代码自动缩进

void test(){
  #if _SOME_VAR
    std::cout << "test" << std::endl;
    #if _SOME_VAR2
      std::cout << "test2" << std::endl;
    #endif
  #endif
}

The solution is 解决方案是

Tools->Options->Text Editor->Indentation->Position of preprocessor directives 工具->选项->文本编辑器->缩进->预处理器指令的位置

在此处输入图片说明

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

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