forked from qt-creator/qt-creator
ClangCodeModel: Highlight "override" and "final" with clangd
Change-Id: If30de546ce360ab9bc3cfa2780f61d6a78e4191d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -1968,6 +1968,14 @@ static void collectExtraResults(QFutureInterface<TextEditor::HighlightingResult>
|
|||||||
insert(result);
|
insert(result);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (node.role() == "attribute" && (node.kind() == "Override" || node.kind() == "Final")) {
|
||||||
|
TextEditor::HighlightingResult result;
|
||||||
|
result.useTextSyles = true;
|
||||||
|
result.textStyles.mainStyle = TextEditor::C_KEYWORD;
|
||||||
|
setFromRange(result, node.range());
|
||||||
|
insert(result);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const bool isExpression = node.role() == "expression";
|
const bool isExpression = node.role() == "expression";
|
||||||
const bool isDeclaration = node.role() == "declaration";
|
const bool isDeclaration = node.role() == "declaration";
|
||||||
|
@@ -1236,6 +1236,8 @@ void ClangdTestHighlighting::test_data()
|
|||||||
<< QList<int>{C_LOCAL} << 0;
|
<< QList<int>{C_LOCAL} << 0;
|
||||||
QTest::newRow("static function call (argument)") << 819 << 18 << 819 << 19
|
QTest::newRow("static function call (argument)") << 819 << 18 << 819 << 19
|
||||||
<< QList<int>{C_LOCAL, C_OUTPUT_ARGUMENT} << 0;
|
<< QList<int>{C_LOCAL, C_OUTPUT_ARGUMENT} << 0;
|
||||||
|
QTest::newRow("override attribute") << 186 << 28 << 186 << 36 << QList<int>{C_KEYWORD} << 0;
|
||||||
|
QTest::newRow("final attribute") << 187 << 33 << 187 << 38 << QList<int>{C_KEYWORD} << 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangdTestHighlighting::test()
|
void ClangdTestHighlighting::test()
|
||||||
|
Reference in New Issue
Block a user