CppEditor: Let users provide statement macros

Like ClangFormat has.

Fixes: QTCREATORBUG-15069
Fixes: QTCREATORBUG-18789
Change-Id: I0ffb70be502d1c73aaaf436484ddc6704f152621
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2024-02-23 14:31:30 +01:00
parent cdd85477fb
commit 2524e2adb3
6 changed files with 54 additions and 3 deletions

View File

@@ -108,6 +108,7 @@ private Q_SLOTS:
void lambdaWithReturnType();
void structuredBinding();
void subscriptOperatorInFunctionCall();
void statementMacros();
};
struct Line {
@@ -2213,6 +2214,23 @@ void tst_CodeFormatter::subscriptOperatorInFunctionCall()
checkIndent(data);
}
void tst_CodeFormatter::statementMacros()
{
QList<Line> data;
data << Line("MY_MACRO")
<< Line("template<int n = 0>")
<< Line("~ class C;");
checkIndent(data);
data.clear();
CppCodeStyleSettings settings;
settings.statementMacros << "MY_MACRO";
data << Line("MY_MACRO")
<< Line("template<int n = 0>")
<< Line("class C;");
checkIndent(data, settings);
}
QTEST_GUILESS_MAIN(tst_CodeFormatter)
#include "tst_codeformatter.moc"