ClangCodeModel: Support new clangd semantic token for labels

See https://reviews.llvm.org/D143260.

Task-number: QTCREATORBUG-27338
Change-Id: I26eb3688f311d93c966901a6639931fec944dd49
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2023-02-06 15:12:43 +01:00
parent d0bf83f86a
commit 24df1f1183
2 changed files with 5 additions and 0 deletions

View File

@@ -330,6 +330,8 @@ void doSemanticHighlighting(
styles.mainStyle = C_TYPE; styles.mainStyle = C_TYPE;
} else if (token.type == "modifier") { } else if (token.type == "modifier") {
styles.mainStyle = C_KEYWORD; styles.mainStyle = C_KEYWORD;
} else if (token.type == "label") {
styles.mainStyle = C_LABEL;
} else if (token.type == "typeParameter") { } else if (token.type == "typeParameter") {
// clangd reports both type and non-type template parameters as type parameters, // clangd reports both type and non-type template parameters as type parameters,
// but the latter can be distinguished by the readonly modifier. // but the latter can be distinguished by the readonly modifier.

View File

@@ -1302,6 +1302,9 @@ void ClangdTestHighlighting::test_data()
QTest::newRow("concept definition") << 1053 << 30 << 1053 << 42 QTest::newRow("concept definition") << 1053 << 30 << 1053 << 42
<< QList<int>{C_TYPE, C_DECLARATION} << 0; << QList<int>{C_TYPE, C_DECLARATION} << 0;
QTest::newRow("concept use") << 1054 << 29 << 1054 << 41 << QList<int>{C_TYPE} << 0; QTest::newRow("concept use") << 1054 << 29 << 1054 << 41 << QList<int>{C_TYPE} << 0;
QTest::newRow("label declaration") << 242 << 1 << 242 << 11
<< QList<int>{C_LABEL, C_DECLARATION} << 0;
QTest::newRow("label use") << 244 << 10 << 244 << 20 << QList<int>{C_LABEL} << 0;
} }
void ClangdTestHighlighting::test() void ClangdTestHighlighting::test()