问题
Is it possible to use clang-format to have double newlines between function definitions:
void func1()
{
return;
}
void func2()
{
return;
}
回答1:
If you are asking whether the IDE can insert these lines automatically, I don't believe so. You can have any number of lines but only by manually entering them.
回答2:
clang-format
does not have an option controlling the number of newlines after the function definition. However, it does have an option, MaxEmptyLinesToKeep
, which will keep it from undoing your two empty lines. So, you will have to cook up some way of doing this through your editor and clang-format
with MaxEmptyLinesToKeep
set to 2
, or higher, will respect your decision.
来源:https://stackoverflow.com/questions/28826390/double-newlines-following-function-definitions