forked from qt-creator/qt-creator
CppEditor: Skip over access specifier when inserting a doxygen comment
That is, also do function-specific magic on typing "/**<return>" in front of a function if there is an access specifier such as "public:" in between. This use case is rather weird, but it's also pretty easy to support and it should not hurt anyone. Note that depending on the indentation of the access specifier, the indentation of the inserted comment will probably not be what the user expects, but this is not easily fixable. Fixes: QTCREATORBUG-20311 Change-Id: Ie32a71eede91ef64a19381c8e379a183a91fd27d Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -295,6 +295,20 @@ void DoxygenTest::testBasic_data()
|
||||
" */\n"
|
||||
"API void f();\n"
|
||||
);
|
||||
|
||||
QTest::newRow("withAccessSpecifierBeforeFunction") << _(
|
||||
"class C {\n"
|
||||
" /**|\n"
|
||||
" public: void f();\n"
|
||||
"};\n"
|
||||
) << _(
|
||||
"class C {\n"
|
||||
" /**\n"
|
||||
" * @brief f\n"
|
||||
" */\n"
|
||||
" public: void f();\n"
|
||||
"};\n"
|
||||
);
|
||||
}
|
||||
|
||||
void DoxygenTest::testBasic()
|
||||
|
@@ -116,7 +116,7 @@ QString DoxygenGenerator::generate(QTextCursor cursor,
|
||||
declCandidate.replace(attribute, "");
|
||||
|
||||
declCandidate.replace("Q_INVOKABLE", "");
|
||||
|
||||
declCandidate.remove(QRegularExpression(R"(\s*(public|protected|private)\s*:\s*)"));
|
||||
declCandidate.replace(QChar::ParagraphSeparator, QLatin1Char('\n'));
|
||||
|
||||
// Let's append a closing brace in the case we got content like 'class MyType {'
|
||||
|
Reference in New Issue
Block a user