forked from qt-creator/qt-creator
ClangFormat: Simplify the dummy text for empty line heuristics
The text to fill the empty line mostly depends not on the fact of being inside parenthesis or not but rather on the last preceding meaningful character. Let's check for this character and sometimes for the following one to better understand the current context and pick the proper dummy text. With this behavior improvement we can better indent empty lines inside initializer lists with empty lines inside. Change-Id: Id2f27454ef56dfdf8c15b5efb14c4d09242908a9 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -404,6 +404,19 @@ TEST_F(ClangFormat, IndentEmptyLineInsideParantheses)
|
||||
" && b)"));
|
||||
}
|
||||
|
||||
TEST_F(ClangFormat, EmptyLineInInitializerList)
|
||||
{
|
||||
insertLines({"Bar foo{a,",
|
||||
"",
|
||||
"};"});
|
||||
|
||||
indenter.indentBlock(doc.findBlockByNumber(1), QChar::Null, TextEditor::TabSettings());
|
||||
|
||||
ASSERT_THAT(documentLines(), ElementsAre("Bar foo{a,",
|
||||
" ",
|
||||
"};"));
|
||||
}
|
||||
|
||||
TEST_F(ClangFormat, IndentFunctionBodyButNotFormatBeforeIt)
|
||||
{
|
||||
insertLines({"int foo(int a, int b,",
|
||||
|
||||
Reference in New Issue
Block a user