ClangFormat: Improve dummy text guessing for empty lines

Improve detection of the cases when the empty line is inside
the parenthesis to get more proper indentation.

Change-Id: I4aa37c29b17bedcd0e4a781d12c7066e818a07f3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-03-07 12:29:10 +01:00
parent 7ce0fc567a
commit df23fbdc89
2 changed files with 68 additions and 15 deletions

View File

@@ -391,6 +391,19 @@ TEST_F(ClangFormat, IndentAfterExtraSpaceInpreviousLine)
" && b)"));
}
TEST_F(ClangFormat, IndentEmptyLineInsideParantheses)
{
insertLines({"if (a ",
"",
" && b)"});
indenter.indentBlock(doc.findBlockByNumber(1), QChar::Null, TextEditor::TabSettings());
ASSERT_THAT(documentLines(), ElementsAre("if (a",
" ",
" && b)"));
}
TEST_F(ClangFormat, IndentFunctionBodyButNotFormatBeforeIt)
{
insertLines({"int foo(int a, int b,",