CppTools: Separate highlighting for function declarations and calls

Task-number: QTCREATORBUG-15564
Change-Id: Iab1b60e19448202432f98295c89769cd376aa03f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Orgad Shaneh
2015-10-25 23:31:20 +02:00
committed by Orgad Shaneh
parent 72e6dd2ab1
commit 246e72262c
5 changed files with 129 additions and 89 deletions

View File

@@ -134,6 +134,14 @@ unsigned SemanticHighlighter::documentRevision() const
return m_baseTextDocument->document()->revision();
}
static TextStyles mixinStyle(TextStyle main, TextStyle mixin)
{
TextStyles res;
res.mainStyle = main;
res.mixinStyles.push_back(mixin);
return res;
}
void SemanticHighlighter::updateFormatMapFromFontSettings()
{
QTC_ASSERT(m_baseTextDocument, return);
@@ -148,6 +156,10 @@ void SemanticHighlighter::updateFormatMapFromFontSettings()
m_formatMap[LabelUse] = fs.toTextCharFormat(C_LABEL);
m_formatMap[MacroUse] = fs.toTextCharFormat(C_PREPROCESSOR);
m_formatMap[FunctionUse] = fs.toTextCharFormat(C_FUNCTION);
m_formatMap[FunctionDeclarationUse] =
fs.toTextCharFormat(mixinStyle(C_FUNCTION, C_DECLARATION));
m_formatMap[VirtualFunctionDeclarationUse] =
fs.toTextCharFormat(mixinStyle(C_VIRTUAL_METHOD, C_DECLARATION));
m_formatMap[PseudoKeywordUse] = fs.toTextCharFormat(C_KEYWORD);
m_formatMap[StringUse] = fs.toTextCharFormat(C_STRING);
}