forked from qt-creator/qt-creator
ClangCodeModel/TextEditor: Add support for highlighting parameters
This is already built into clang, so we just need to expose it to the highlighter and the UI. Fixes: QTCREATORBUG-24880 Change-Id: I6d0595af2589a9b69eb954aafad46457ab2c5752 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -50,6 +50,8 @@ TextEditor::TextStyle toTextStyle(ClangBackEnd::HighlightingType type)
|
||||
return TextEditor::C_PRIMITIVE_TYPE;
|
||||
case HighlightingType::LocalVariable:
|
||||
return TextEditor::C_LOCAL;
|
||||
case HighlightingType::Parameter:
|
||||
return TextEditor::C_PARAMETER;
|
||||
case HighlightingType::Field:
|
||||
case HighlightingType::QtProperty:
|
||||
return TextEditor::C_FIELD;
|
||||
|
||||
@@ -80,7 +80,7 @@ static Utils::optional<TextEditor::TextStyle> styleForScopes(const QList<QString
|
||||
{"variable.other.member", TextEditor::C_FIELD},
|
||||
{"variable.other.field", TextEditor::C_FIELD},
|
||||
{"variable.other.field.static", TextEditor::C_GLOBAL},
|
||||
{"variable.parameter", TextEditor::C_LOCAL},
|
||||
{"variable.parameter", TextEditor::C_PARAMETER},
|
||||
};
|
||||
|
||||
for (QString scope : scopes) {
|
||||
|
||||
@@ -55,6 +55,7 @@ const char *nameForStyle(TextStyle style)
|
||||
case C_STRING: return "String";
|
||||
case C_TYPE: return "Type";
|
||||
case C_LOCAL: return "Local";
|
||||
case C_PARAMETER: return "Parameter";
|
||||
case C_GLOBAL: return "Global";
|
||||
case C_FIELD: return "Field";
|
||||
// TODO: Rename "Static" to "Enumeration" in next major update,
|
||||
|
||||
@@ -55,6 +55,7 @@ enum TextStyle : quint8 {
|
||||
C_STRING,
|
||||
C_TYPE,
|
||||
C_LOCAL,
|
||||
C_PARAMETER,
|
||||
C_GLOBAL,
|
||||
C_FIELD,
|
||||
C_ENUMERATION,
|
||||
|
||||
@@ -162,6 +162,8 @@ FormatDescriptions TextEditorSettingsPrivate::initialFormats()
|
||||
Qt::darkMagenta);
|
||||
formatDescr.emplace_back(C_LOCAL, tr("Local"),
|
||||
tr("Local variables."), QColor(9, 46, 100));
|
||||
formatDescr.emplace_back(C_PARAMETER, tr("Parameter"),
|
||||
tr("Function or method parameters."), QColor(9, 46, 100));
|
||||
formatDescr.emplace_back(C_FIELD, tr("Field"),
|
||||
tr("Class' data members."), Qt::darkRed);
|
||||
formatDescr.emplace_back(C_GLOBAL, tr("Global"),
|
||||
|
||||
Reference in New Issue
Block a user