akof1314 / CoolFormat

CoolFormat Source Code Formatter
http://blog.csdn.net/akof1314/article/details/5355948
539 stars 147 forks source link

C/C++ 预处理语句缩进错误 #41

Open CongXue0 opened 6 years ago

CongXue0 commented 6 years ago

if defined 开头的预处理语句 到 #endif 之间无法缩进

示例代码:

if defined ABC

ifdef KK

endif

else

ifdef BBB

define HGF

endif

endif

define OPP 1

if OPP

#ifdef HGF
    #define OOO
#endif

endif

if defined HGF && defined OOO

#ifdef KKK
    #undef OOO
#endif

endif

CongXue0 commented 6 years ago

经过测试包含 #include 的预处理语句容易被缩进,一旦可以缩进后,后面的预处理语句也能够缩进了,直接拷贝粘贴下面的代码是不会缩进的。

if defined ABC

ifdef KK

endif

else

ifdef BBB

define HGF

endif

endif

CongXue0 commented 6 years ago

还有预处理语句 #if 到 #endif 之间把非预处理语句也缩进了,比如extern语句 和 全局变量定义语句

akof1314 commented 6 years ago

@dcsnow 到设置界面,将 indent preproc block 选项打开