ClangCodeModel: Support highlighting angle brackets

... in template declarations and instantiations.

Fixes: QTCREATORBUG-16799
Change-Id: I82bc6411ca980ecbe2a6c70ae37580166a4b89e9
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2020-10-15 12:06:14 +02:00
parent 8112a00432
commit d8c1e51bfe
5 changed files with 51 additions and 7 deletions

View File

@@ -112,6 +112,8 @@ bool ignore(ClangBackEnd::HighlightingType type)
case HighlightingType::ObjectiveCMethod:
case HighlightingType::TemplateTypeParameter:
case HighlightingType::TemplateTemplateParameter:
case HighlightingType::AngleBracketOpen:
case HighlightingType::AngleBracketClose:
return true;
}
@@ -136,9 +138,15 @@ TextEditor::TextStyles toTextStyles(ClangBackEnd::HighlightingTypes types)
TextEditor::HighlightingResult toHighlightingResult(
const ClangBackEnd::TokenInfoContainer &tokenInfo)
{
using ClangBackEnd::HighlightingType;
const auto textStyles = toTextStyles(tokenInfo.types);
return {tokenInfo.line, tokenInfo.column, tokenInfo.length, textStyles};
TextEditor::HighlightingResult result(tokenInfo.line, tokenInfo.column, tokenInfo.length,
textStyles);
if (tokenInfo.types.mixinHighlightingTypes.contains(HighlightingType::AngleBracketOpen))
result.kind = 1;
else if (tokenInfo.types.mixinHighlightingTypes.contains(HighlightingType::AngleBracketClose))
result.kind = 2;
return result;
}
} // anonymous