summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2018-08-22 17:25:12 +0200
committerIvan Donchevskii <ivan.donchevskii@qt.io>2018-09-13 11:15:05 +0000
commit50e5aacb026e79995c9967b12eabb9d37336a841 (patch)
tree13fec0e3b67bd9197c887ad0a9a61ec520bfc50f /src/tools
parentccf2d848f4514428bbfe1702e43b20dcb77f58e8 (diff)
downloadqt-creator-50e5aacb026e79995c9967b12eabb9d37336a841.tar.gz
Highlighting: Add highlighting style for punctuation
Currently only operators have their own style but not punctuation tokens. Make possible to highlight both. Task-number: QTCREATORBUG-20666 Change-Id: I9533e0f1bef65b86c4e4f5c9756571103584124b Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/clangbackend/source/fulltokeninfo.cpp2
-rw-r--r--src/tools/clangbackend/source/tokeninfo.cpp8
2 files changed, 4 insertions, 6 deletions
diff --git a/src/tools/clangbackend/source/fulltokeninfo.cpp b/src/tools/clangbackend/source/fulltokeninfo.cpp
index e850e0495c..1bf265b371 100644
--- a/src/tools/clangbackend/source/fulltokeninfo.cpp
+++ b/src/tools/clangbackend/source/fulltokeninfo.cpp
@@ -243,7 +243,7 @@ void FullTokenInfo::overloadedOperatorKind()
{
TokenInfo::overloadedOperatorKind();
- if (m_types.mixinHighlightingTypes.front() != HighlightingType::OverloadedOperator)
+ if (!m_types.mixinHighlightingTypes.contains(HighlightingType::OverloadedOperator))
return;
// Overloaded operator
diff --git a/src/tools/clangbackend/source/tokeninfo.cpp b/src/tools/clangbackend/source/tokeninfo.cpp
index 68877e4032..62742c2c48 100644
--- a/src/tools/clangbackend/source/tokeninfo.cpp
+++ b/src/tools/clangbackend/source/tokeninfo.cpp
@@ -529,13 +529,13 @@ void TokenInfo::overloadedOperatorKind()
if (inOperatorDeclaration && !isTokenPartOfOperator(declarationCursor, m_cxToken))
return;
- if (m_types.mainHighlightingType == HighlightingType::Invalid)
- m_types.mainHighlightingType = HighlightingType::Operator;
+ m_types.mixinHighlightingTypes.push_back(HighlightingType::Operator);
m_types.mixinHighlightingTypes.push_back(HighlightingType::OverloadedOperator);
}
void TokenInfo::punctuationOrOperatorKind()
{
+ m_types.mainHighlightingType = HighlightingType::Punctuation;
auto kind = m_originalCursor.kind();
switch (kind) {
case CXCursor_CallExpr:
@@ -557,9 +557,7 @@ void TokenInfo::punctuationOrOperatorKind()
case CXCursor_BinaryOperator:
case CXCursor_CompoundAssignOperator:
case CXCursor_ConditionalOperator:
- m_types.mainHighlightingType = HighlightingType::Operator;
- break;
- default:
+ m_types.mixinHighlightingTypes.push_back(HighlightingType::Operator);
break;
}