forked from qt-creator/qt-creator
TextEditor: Add dedicated text style for C++ concepts
Fixes: QTCREATORBUG-29286 Change-Id: Ifc89bad0b84dfdbcac0720fc59799edd461c00bb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -326,8 +326,10 @@ void doSemanticHighlighting(
|
||||
styles.mainStyle = C_PARAMETER;
|
||||
} else if (token.type == "macro") {
|
||||
styles.mainStyle = C_MACRO;
|
||||
} else if (token.type == "type" || token.type == "concept") {
|
||||
} else if (token.type == "type") {
|
||||
styles.mainStyle = C_TYPE;
|
||||
} else if (token.type == "concept") {
|
||||
styles.mainStyle = C_CONCEPT;
|
||||
} else if (token.type == "modifier") {
|
||||
styles.mainStyle = C_KEYWORD;
|
||||
} else if (token.type == "label") {
|
||||
|
@@ -1302,8 +1302,8 @@ void ClangdTestHighlighting::test_data()
|
||||
QTest::newRow("fake operator method call") << 1050 << 8 << 1050 << 22
|
||||
<< QList<int>{C_FUNCTION} << 0;
|
||||
QTest::newRow("concept definition") << 1053 << 30 << 1053 << 42
|
||||
<< QList<int>{C_TYPE, C_DECLARATION} << 0;
|
||||
QTest::newRow("concept use") << 1054 << 29 << 1054 << 41 << QList<int>{C_TYPE} << 0;
|
||||
<< QList<int>{C_CONCEPT, C_DECLARATION} << 0;
|
||||
QTest::newRow("concept use") << 1054 << 29 << 1054 << 41 << QList<int>{C_CONCEPT} << 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;
|
||||
|
@@ -420,8 +420,8 @@ bool FontSettings::loadColorScheme(const Utils::FilePath &filePath,
|
||||
for (const FormatDescription &desc : descriptions) {
|
||||
const TextStyle id = desc.id();
|
||||
if (!m_scheme.contains(id)) {
|
||||
if (id == C_NAMESPACE && m_scheme.contains(C_TYPE)) {
|
||||
m_scheme.setFormatFor(C_NAMESPACE, m_scheme.formatFor(C_TYPE));
|
||||
if ((id == C_NAMESPACE || id == C_CONCEPT) && m_scheme.contains(C_TYPE)) {
|
||||
m_scheme.setFormatFor(id, m_scheme.formatFor(C_TYPE));
|
||||
continue;
|
||||
}
|
||||
if (id == C_MACRO && m_scheme.contains(C_FUNCTION)) {
|
||||
|
@@ -33,6 +33,7 @@ const char *nameForStyle(TextStyle style)
|
||||
case C_NUMBER: return "Number";
|
||||
case C_STRING: return "String";
|
||||
case C_TYPE: return "Type";
|
||||
case C_CONCEPT: return "Concept";
|
||||
case C_NAMESPACE: return "Namespace";
|
||||
case C_LOCAL: return "Local";
|
||||
case C_PARAMETER: return "Parameter";
|
||||
|
@@ -33,6 +33,7 @@ enum TextStyle : quint8 {
|
||||
C_NUMBER,
|
||||
C_STRING,
|
||||
C_TYPE,
|
||||
C_CONCEPT,
|
||||
C_NAMESPACE,
|
||||
C_LOCAL,
|
||||
C_PARAMETER,
|
||||
|
@@ -141,6 +141,8 @@ FormatDescriptions TextEditorSettingsPrivate::initialFormats()
|
||||
Tr::tr("Name of a primitive data type."), Qt::darkYellow);
|
||||
formatDescr.emplace_back(C_TYPE, Tr::tr("Type"), Tr::tr("Name of a type."),
|
||||
Qt::darkMagenta);
|
||||
formatDescr.emplace_back(C_CONCEPT, Tr::tr("Concept"), Tr::tr("Name of a concept."),
|
||||
Qt::darkMagenta);
|
||||
formatDescr.emplace_back(C_NAMESPACE, Tr::tr("Namespace"), Tr::tr("Name of a namespace."),
|
||||
Qt::darkGreen);
|
||||
formatDescr.emplace_back(C_LOCAL, Tr::tr("Local"),
|
||||
|
Reference in New Issue
Block a user