diff --git a/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp b/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp index e1b82ab3770..8f61703da16 100644 --- a/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp +++ b/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp @@ -330,6 +330,8 @@ void doSemanticHighlighting( styles.mainStyle = C_TYPE; } else if (token.type == "modifier") { styles.mainStyle = C_KEYWORD; + } else if (token.type == "label") { + styles.mainStyle = C_LABEL; } else if (token.type == "typeParameter") { // clangd reports both type and non-type template parameters as type parameters, // but the latter can be distinguished by the readonly modifier. diff --git a/src/plugins/clangcodemodel/test/clangdtests.cpp b/src/plugins/clangcodemodel/test/clangdtests.cpp index a90126c00e8..3389baf051f 100644 --- a/src/plugins/clangcodemodel/test/clangdtests.cpp +++ b/src/plugins/clangcodemodel/test/clangdtests.cpp @@ -1302,6 +1302,9 @@ void ClangdTestHighlighting::test_data() QTest::newRow("concept definition") << 1053 << 30 << 1053 << 42 << QList{C_TYPE, C_DECLARATION} << 0; QTest::newRow("concept use") << 1054 << 29 << 1054 << 41 << QList{C_TYPE} << 0; + QTest::newRow("label declaration") << 242 << 1 << 242 << 11 + << QList{C_LABEL, C_DECLARATION} << 0; + QTest::newRow("label use") << 244 << 10 << 244 << 20 << QList{C_LABEL} << 0; } void ClangdTestHighlighting::test()