diff --git a/share/qtcreator/styles/creator-dark.xml b/share/qtcreator/styles/creator-dark.xml
index 6252c25a455..dbb18ae47c8 100644
--- a/share/qtcreator/styles/creator-dark.xml
+++ b/share/qtcreator/styles/creator-dark.xml
@@ -27,6 +27,7 @@
+
diff --git a/share/qtcreator/styles/dark.xml b/share/qtcreator/styles/dark.xml
index f589e8c4dda..1e169a69b02 100644
--- a/share/qtcreator/styles/dark.xml
+++ b/share/qtcreator/styles/dark.xml
@@ -15,6 +15,7 @@
+
diff --git a/share/qtcreator/styles/default_classic.xml b/share/qtcreator/styles/default_classic.xml
index 04939c70329..08d9fd0e812 100644
--- a/share/qtcreator/styles/default_classic.xml
+++ b/share/qtcreator/styles/default_classic.xml
@@ -23,6 +23,7 @@
+
diff --git a/share/qtcreator/styles/grayscale.xml b/share/qtcreator/styles/grayscale.xml
index 09a09f1ba93..8d7cbfb6cd2 100644
--- a/share/qtcreator/styles/grayscale.xml
+++ b/share/qtcreator/styles/grayscale.xml
@@ -15,6 +15,7 @@
+
diff --git a/share/qtcreator/styles/inkpot.xml b/share/qtcreator/styles/inkpot.xml
index 5d143c1f97d..761b931deda 100644
--- a/share/qtcreator/styles/inkpot.xml
+++ b/share/qtcreator/styles/inkpot.xml
@@ -20,6 +20,7 @@
+
diff --git a/share/qtcreator/styles/intellij.xml b/share/qtcreator/styles/intellij.xml
index ee579f0e36d..aedb2df64f9 100644
--- a/share/qtcreator/styles/intellij.xml
+++ b/share/qtcreator/styles/intellij.xml
@@ -9,6 +9,7 @@
+
diff --git a/share/qtcreator/styles/modnokai_night_shift_v2.xml b/share/qtcreator/styles/modnokai_night_shift_v2.xml
index 0f2270f13fe..1b062ae7dfa 100644
--- a/share/qtcreator/styles/modnokai_night_shift_v2.xml
+++ b/share/qtcreator/styles/modnokai_night_shift_v2.xml
@@ -33,6 +33,7 @@
+
diff --git a/share/qtcreator/styles/solarized-dark.xml b/share/qtcreator/styles/solarized-dark.xml
index 379fca705c8..1a6c5a53ab4 100644
--- a/share/qtcreator/styles/solarized-dark.xml
+++ b/share/qtcreator/styles/solarized-dark.xml
@@ -33,6 +33,7 @@
+
diff --git a/share/qtcreator/styles/solarized-light.xml b/share/qtcreator/styles/solarized-light.xml
index 29f6b4dfdc7..ede48e7d0bc 100644
--- a/share/qtcreator/styles/solarized-light.xml
+++ b/share/qtcreator/styles/solarized-light.xml
@@ -33,6 +33,7 @@
+
diff --git a/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp b/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp
index b37605af128..ae7495fb944 100644
--- a/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp
+++ b/src/plugins/clangcodemodel/clangdsemantichighlighting.cpp
@@ -342,7 +342,7 @@ void doSemanticHighlighting(
} else if (token.type == "parameter") {
styles.mainStyle = C_PARAMETER;
} else if (token.type == "macro") {
- styles.mainStyle = C_PREPROCESSOR;
+ styles.mainStyle = C_MACRO;
} else if (token.type == "type") {
styles.mainStyle = C_TYPE;
} else if (token.type == "typeParameter") {
@@ -406,7 +406,7 @@ void ExtraHighlightingResultsCollector::collect()
{
for (int i = 0; i < m_results.length(); ++i) {
const HighlightingResult res = m_results.at(i);
- if (res.textStyles.mainStyle != C_PREPROCESSOR || res.length != 10)
+ if (res.textStyles.mainStyle != TextEditor::C_MACRO || res.length != 10)
continue;
const int pos = Utils::Text::positionInText(m_doc, res.line, res.column);
if (subViewLen(m_docContent, pos, 10) != QLatin1String("Q_PROPERTY"))
@@ -478,7 +478,7 @@ void ExtraHighlightingResultsCollector::insertResult(const HighlightingResult &r
// location, so it should occur right before the insertion position.
if (it > m_results.begin() && (it - 1)->line == result.line
&& (it - 1)->column == result.column
- && (it - 1)->textStyles.mainStyle == C_PREPROCESSOR) {
+ && (it - 1)->textStyles.mainStyle == C_MACRO) {
return;
}
@@ -589,7 +589,7 @@ void ExtraHighlightingResultsCollector::collectFromNode(const ClangdAstNode &nod
const bool isExpression = node.role() == "expression";
if (isExpression && node.kind() == "Predefined") {
- insertResult(node, C_PREPROCESSOR);
+ insertResult(node, C_MACRO);
return;
}
diff --git a/src/plugins/clangcodemodel/test/clangdtests.cpp b/src/plugins/clangcodemodel/test/clangdtests.cpp
index 4c976e7f41a..244cef4cba3 100644
--- a/src/plugins/clangcodemodel/test/clangdtests.cpp
+++ b/src/plugins/clangcodemodel/test/clangdtests.cpp
@@ -889,11 +889,11 @@ void ClangdTestHighlighting::test_data()
QTest::newRow("closing angle bracket in class template declaration") << 261 << 18 << 261 << 19
<< QList{C_PUNCTUATION} << int(CppEditor::SemanticHighlighter::AngleBracketClose);
QTest::newRow("macro definition") << 231 << 9 << 231 << 31
- << QList{C_PREPROCESSOR, C_DECLARATION} << 0;
+ << QList{C_MACRO, C_DECLARATION} << 0;
QTest::newRow("function-like macro definition") << 232 << 9 << 232 << 24
- << QList{C_PREPROCESSOR, C_DECLARATION} << 0;
+ << QList{C_MACRO, C_DECLARATION} << 0;
QTest::newRow("function-like macro call") << 236 << 5 << 236 << 20
- << QList{C_PREPROCESSOR} << 0;
+ << QList{C_MACRO} << 0;
QTest::newRow("function-like macro call argument 1") << 236 << 21 << 236 << 22
<< QList{C_NUMBER} << 0;
QTest::newRow("function-like macro call argument 2") << 236 << 24 << 236 << 25
@@ -1054,7 +1054,7 @@ void ClangdTestHighlighting::test_data()
QTest::newRow("using declaration for function template") << 584 << 10 << 584 << 16
<< QList{C_FUNCTION} << 0;
QTest::newRow("Q_PROPERTY (macro name)") << 599 << 5 << 599 << 15
- << QList{C_PREPROCESSOR} << 0;
+ << QList{C_MACRO} << 0;
QTest::newRow("Q_PROPERTY (property name)") << 599 << 52 << 599 << 56
<< QList{C_FIELD} << 0;
QTest::newRow("Q_PROPERTY (READ keyword)") << 599 << 57 << 599 << 61
@@ -1078,7 +1078,7 @@ void ClangdTestHighlighting::test_data()
QTest::newRow("Q_PROPERTY (REVISION keyword [new])") << 600 << 46 << 600 << 54
<< QList{C_KEYWORD} << 0;
QTest::newRow("multi-line Q_PROPERTY (macro name)") << 704 << 5 << 704 << 15
- << QList{C_PREPROCESSOR} << 0;
+ << QList{C_MACRO} << 0;
QTest::newRow("multi-line Q_PROPERTY (property name)") << 718 << 13 << 718 << 17
<< QList{C_FIELD} << 0;
QTest::newRow("multi-line Q_PROPERTY (getter)") << 722 << 13 << 722 << 20
@@ -1086,19 +1086,19 @@ void ClangdTestHighlighting::test_data()
QTest::newRow("multi-line Q_PROPERTY (notifier)") << 730 << 13 << 730 << 24
<< QList{C_FUNCTION} << 0;
QTest::newRow("old-style signal (macro)") << 672 << 5 << 672 << 11
- << QList{C_PREPROCESSOR} << 0;
+ << QList{C_MACRO} << 0;
QTest::newRow("old-style signal (signal)") << 672 << 12 << 672 << 21
<< QList{C_FUNCTION} << 0;
QTest::newRow("old-style signal (signal parameter)") << 672 << 22 << 672 << 29
<< QList{C_TYPE} << 0;
QTest::newRow("old-style slot (macro)") << 673 << 5 << 673 << 9
- << QList{C_PREPROCESSOR} << 0;
+ << QList{C_MACRO} << 0;
QTest::newRow("old-style slot (slot)") << 673 << 10 << 673 << 19
<< QList{C_FUNCTION} << 0;
QTest::newRow("old-style slot (slot parameter)") << 673 << 20 << 673 << 27
<< QList{C_TYPE} << 0;
QTest::newRow("old-style signal with complex parameter (macro)") << 674 << 5 << 674 << 11
- << QList{C_PREPROCESSOR} << 0;
+ << QList{C_MACRO} << 0;
QTest::newRow("old-style signal with complex parameter (signal)") << 674 << 12 << 674 << 21
<< QList{C_FUNCTION} << 0;
QTest::newRow("old-style signal with complex parameter (signal parameter part 1)")
@@ -1246,7 +1246,7 @@ void ClangdTestHighlighting::test_data()
<< QList{C_PUNCTUATION} << int(CppEditor::SemanticHighlighter::AngleBracketClose);
QTest::newRow("cyrillic string") << 792 << 24 << 792 << 27 << QList{C_STRING} << 0;
QTest::newRow("macro in struct") << 795 << 9 << 795 << 14
- << QList{C_PREPROCESSOR, C_DECLARATION} << 0;
+ << QList{C_MACRO, C_DECLARATION} << 0;
QTest::newRow("#ifdef'ed out code") << 800 << 1 << 800 << 17
<< QList{C_DISABLED_CODE} << 0;
QTest::newRow("static function call (object)") << 819 << 5 << 819 << 6
@@ -1298,11 +1298,11 @@ void ClangdTestHighlighting::test_data()
QTest::newRow("output arg") << 945 << 20 << 945 << 23
<< QList{C_LOCAL, C_OUTPUT_ARGUMENT} << 0;
QTest::newRow("built-in define 1") << 950 << 21 << 950 << 29
- << QList{C_PREPROCESSOR} << 0;
+ << QList{C_MACRO} << 0;
QTest::newRow("built-in define 2") << 951 << 21 << 951 << 33
- << QList{C_PREPROCESSOR} << 0;
+ << QList{C_MACRO} << 0;
QTest::newRow("built-in define 3") << 952 << 21 << 952 << 40
- << QList{C_PREPROCESSOR} << 0;
+ << QList{C_MACRO} << 0;
QTest::newRow("deref operator (object)") << 960 << 10 << 960 << 11 << QList{C_LOCAL} << 0;
QTest::newRow("deref operator (member)") << 960 << 12 << 960 << 13 << QList{C_FIELD} << 0;
QTest::newRow("nested call") << 979 << 20 << 979 << 21 << QList{C_LOCAL} << 0;
diff --git a/src/plugins/cppeditor/semantichighlighter.cpp b/src/plugins/cppeditor/semantichighlighter.cpp
index d1e4e678257..503ba407ff7 100644
--- a/src/plugins/cppeditor/semantichighlighter.cpp
+++ b/src/plugins/cppeditor/semantichighlighter.cpp
@@ -328,7 +328,7 @@ void SemanticHighlighter::updateFormatMapFromFontSettings()
m_formatMap[EnumerationUse] = fs.toTextCharFormat(C_ENUMERATION);
m_formatMap[VirtualMethodUse] = fs.toTextCharFormat(C_VIRTUAL_METHOD);
m_formatMap[LabelUse] = fs.toTextCharFormat(C_LABEL);
- m_formatMap[MacroUse] = fs.toTextCharFormat(C_PREPROCESSOR);
+ m_formatMap[MacroUse] = fs.toTextCharFormat(C_MACRO);
m_formatMap[FunctionUse] = fs.toTextCharFormat(C_FUNCTION);
m_formatMap[FunctionDeclarationUse] =
fs.toTextCharFormat(TextStyles::mixinStyle(C_FUNCTION, C_DECLARATION));
diff --git a/src/plugins/languageclient/semantichighlightsupport.cpp b/src/plugins/languageclient/semantichighlightsupport.cpp
index a7aca308643..9536052b811 100644
--- a/src/plugins/languageclient/semantichighlightsupport.cpp
+++ b/src/plugins/languageclient/semantichighlightsupport.cpp
@@ -262,7 +262,7 @@ void SemanticTokenSupport::updateFormatHash()
case variableToken: style = C_LOCAL; break;
case functionToken: style = C_FUNCTION; break;
case methodToken: style = C_FUNCTION; break;
- case macroToken: style = C_PREPROCESSOR; break;
+ case macroToken: style = C_MACRO; break;
case keywordToken: style = C_KEYWORD; break;
case commentToken: style = C_COMMENT; break;
case stringToken: style = C_STRING; break;
diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp
index b3265dcbd29..a946f4cc201 100644
--- a/src/plugins/texteditor/fontsettings.cpp
+++ b/src/plugins/texteditor/fontsettings.cpp
@@ -421,6 +421,10 @@ bool FontSettings::loadColorScheme(const QString &fileName,
m_scheme.setFormatFor(C_NAMESPACE, m_scheme.formatFor(C_TYPE));
continue;
}
+ if (id == C_MACRO && m_scheme.contains(C_FUNCTION)) {
+ m_scheme.setFormatFor(C_MACRO, m_scheme.formatFor(C_FUNCTION));
+ continue;
+ }
Format format;
const Format &descFormat = desc.format();
// Default fallback for background and foreground is C_TEXT, which is set through
diff --git a/src/plugins/texteditor/texteditorconstants.cpp b/src/plugins/texteditor/texteditorconstants.cpp
index df6df10ae5d..dedef17fdfe 100644
--- a/src/plugins/texteditor/texteditorconstants.cpp
+++ b/src/plugins/texteditor/texteditorconstants.cpp
@@ -71,6 +71,7 @@ const char *nameForStyle(TextStyle style)
case C_OVERLOADED_OPERATOR: return "Overloaded Operator";
case C_PUNCTUATION: return "Punctuation";
case C_PREPROCESSOR: return "Preprocessor";
+ case C_MACRO: return "Macro";
case C_LABEL: return "Label";
case C_COMMENT: return "Comment";
case C_DOXYGEN_COMMENT: return "Doxygen.Comment";
diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h
index 757e58a8452..68667f40adc 100644
--- a/src/plugins/texteditor/texteditorconstants.h
+++ b/src/plugins/texteditor/texteditorconstants.h
@@ -69,6 +69,7 @@ enum TextStyle : quint8 {
C_OVERLOADED_OPERATOR,
C_PUNCTUATION,
C_PREPROCESSOR,
+ C_MACRO,
C_LABEL,
C_COMMENT,
C_DOXYGEN_COMMENT,
diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp
index ed840b1d428..221b59964c9 100644
--- a/src/plugins/texteditor/texteditorsettings.cpp
+++ b/src/plugins/texteditor/texteditorsettings.cpp
@@ -263,6 +263,8 @@ FormatDescriptions TextEditorSettingsPrivate::initialFormats()
FormatDescription::ShowAllControls);
formatDescr.emplace_back(C_PREPROCESSOR, tr("Preprocessor"),
tr("Preprocessor directives."), Qt::darkBlue);
+ formatDescr.emplace_back(C_MACRO, tr("Macro"),
+ tr("Macros."), functionFormat);
formatDescr.emplace_back(C_LABEL, tr("Label"), tr("Labels for goto statements."),
Qt::darkRed);
formatDescr.emplace_back(C_COMMENT, tr("Comment"),