diff --git a/share/qtcreator/styles/darkvim.xml b/share/qtcreator/styles/darkvim.xml
index eb6aa8ae5ef..dfc49c36d2c 100644
--- a/share/qtcreator/styles/darkvim.xml
+++ b/share/qtcreator/styles/darkvim.xml
@@ -16,6 +16,7 @@
+
diff --git a/share/qtcreator/styles/grayscale.xml b/share/qtcreator/styles/grayscale.xml
index b7a76c3ba64..92e8b15cde0 100644
--- a/share/qtcreator/styles/grayscale.xml
+++ b/share/qtcreator/styles/grayscale.xml
@@ -16,6 +16,7 @@
+
diff --git a/share/qtcreator/styles/inkpot.xml b/share/qtcreator/styles/inkpot.xml
index c0a3c75adb6..adc8ec08ca1 100644
--- a/share/qtcreator/styles/inkpot.xml
+++ b/share/qtcreator/styles/inkpot.xml
@@ -21,6 +21,7 @@
+
diff --git a/share/qtcreator/styles/intellij.xml b/share/qtcreator/styles/intellij.xml
index dfe5f7afd59..b55e103d0dc 100644
--- a/share/qtcreator/styles/intellij.xml
+++ b/share/qtcreator/styles/intellij.xml
@@ -10,6 +10,7 @@
+
diff --git a/src/libs/3rdparty/cplusplus/Token.cpp b/src/libs/3rdparty/cplusplus/Token.cpp
index 8be67571318..2f6ce3d608d 100644
--- a/src/libs/3rdparty/cplusplus/Token.cpp
+++ b/src/libs/3rdparty/cplusplus/Token.cpp
@@ -46,21 +46,20 @@ const char *token_names[] = {
("|="), ("||"), ("+"), ("+="), ("++"), ("#"), ("##"), ("?"), ("}"),
("]"), (")"), (";"), ("*"), ("*="), ("~"), ("~="),
- ("alignas"), ("alignof"), ("asm"), ("auto"), ("bool"), ("break"), ("case"), ("catch"),
- ("char"), ("char16_t"), ("char32_t"),
+ ("alignas"), ("alignof"), ("asm"), ("auto"), ("break"), ("case"), ("catch"),
("class"), ("const"), ("const_cast"), ("constexpr"), ("continue"),
("decltype"), ("default"),
- ("delete"), ("do"), ("double"), ("dynamic_cast"), ("else"), ("enum"),
- ("explicit"), ("export"), ("extern"), ("false"), ("float"), ("for"),
- ("friend"), ("goto"), ("if"), ("inline"), ("int"), ("long"),
+ ("delete"), ("do"), ("dynamic_cast"), ("else"), ("enum"),
+ ("explicit"), ("export"), ("extern"), ("false"), ("for"),
+ ("friend"), ("goto"), ("if"), ("inline"),
("mutable"), ("namespace"), ("new"), ("noexcept"),
("nullptr"), ("operator"), ("private"),
("protected"), ("public"), ("register"), ("reinterpret_cast"),
- ("return"), ("short"), ("signed"), ("sizeof"), ("static"),("static_assert"),
+ ("return"), ("sizeof"), ("static"), ("static_assert"),
("static_cast"), ("struct"), ("switch"), ("template"), ("this"), ("thread_local"),
("throw"), ("true"), ("try"), ("typedef"), ("typeid"), ("typename"),
- ("union"), ("unsigned"), ("using"), ("virtual"), ("void"),
- ("volatile"), ("wchar_t"), ("while"),
+ ("union"), ("using"), ("virtual"),
+ ("volatile"), ("while"),
// gnu
("__attribute__"), ("__thread"), ("__typeof__"),
@@ -72,6 +71,10 @@ const char *token_names[] = {
("@protected"), ("@protocol"), ("@public"), ("@required"), ("@selector"),
("@synchronized"), ("@synthesize"), ("@throw"), ("@try"),
+ // Primitive types
+ ("bool"), ("char"), ("char16_t"), ("char32_t"), ("double"), ("float"), ("int"),
+ ("long"), ("short"), ("signed"), ("unsigned"), ("void"), ("wchar_t"),
+
// Qt keywords
("emit"), ("SIGNAL"), ("SLOT"), ("Q_SIGNAL"), ("Q_SLOT"), ("signals"), ("slots"),
("Q_FOREACH"), ("Q_D"), ("Q_Q"),
diff --git a/src/libs/3rdparty/cplusplus/Token.h b/src/libs/3rdparty/cplusplus/Token.h
index d4a2901c347..b9a4bc68cf8 100644
--- a/src/libs/3rdparty/cplusplus/Token.h
+++ b/src/libs/3rdparty/cplusplus/Token.h
@@ -119,13 +119,9 @@ enum Kind {
T_ALIGNOF,
T_ASM,
T_AUTO,
- T_BOOL,
T_BREAK,
T_CASE,
T_CATCH,
- T_CHAR,
- T_CHAR16_T,
- T_CHAR32_T,
T_CLASS,
T_CONST,
T_CONST_CAST,
@@ -135,7 +131,6 @@ enum Kind {
T_DEFAULT,
T_DELETE,
T_DO,
- T_DOUBLE,
T_DYNAMIC_CAST,
T_ELSE,
T_ENUM,
@@ -143,14 +138,11 @@ enum Kind {
T_EXPORT,
T_EXTERN,
T_FALSE,
- T_FLOAT,
T_FOR,
T_FRIEND,
T_GOTO,
T_IF,
T_INLINE,
- T_INT,
- T_LONG,
T_MUTABLE,
T_NAMESPACE,
T_NEW,
@@ -163,8 +155,6 @@ enum Kind {
T_REGISTER,
T_REINTERPRET_CAST,
T_RETURN,
- T_SHORT,
- T_SIGNED,
T_SIZEOF,
T_STATIC,
T_STATIC_ASSERT,
@@ -181,12 +171,9 @@ enum Kind {
T_TYPEID,
T_TYPENAME,
T_UNION,
- T_UNSIGNED,
T_USING,
T_VIRTUAL,
- T_VOID,
T_VOLATILE,
- T_WCHAR_T,
T_WHILE,
T___ATTRIBUTE__,
@@ -223,6 +210,23 @@ enum Kind {
T_LAST_OBJC_AT_KEYWORD = T_AT_TRY,
+ // Primitive types
+ T_FIRST_PRIMITIVE,
+ T_BOOL = T_FIRST_PRIMITIVE,
+ T_CHAR,
+ T_CHAR16_T,
+ T_CHAR32_T,
+ T_DOUBLE,
+ T_FLOAT,
+ T_INT,
+ T_LONG,
+ T_SHORT,
+ T_SIGNED,
+ T_UNSIGNED,
+ T_VOID,
+ T_WCHAR_T,
+ T_LAST_PRIMITIVE = T_WCHAR_T,
+
T_FIRST_QT_KEYWORD,
// Qt keywords
@@ -247,6 +251,7 @@ enum Kind {
T_Q_DECLARE_INTERFACE,
T_Q_OBJECT,
T_Q_GADGET,
+
T_LAST_KEYWORD = T_Q_GADGET,
// aliases
@@ -320,7 +325,10 @@ public:
{ return f.kind >= T_FIRST_OPERATOR && f.kind <= T_LAST_OPERATOR; }
inline bool isKeyword() const
- { return f.kind >= T_FIRST_KEYWORD && f.kind < T_FIRST_QT_KEYWORD; }
+ { return f.kind >= T_FIRST_KEYWORD && f.kind < T_FIRST_PRIMITIVE; }
+
+ inline bool isPrimitiveType() const
+ { return f.kind >= T_FIRST_PRIMITIVE && f.kind <= T_LAST_PRIMITIVE; }
inline bool isComment() const
{ return f.kind == T_COMMENT || f.kind == T_DOXY_COMMENT ||
diff --git a/src/plugins/cppeditor/cppeditorenums.h b/src/plugins/cppeditor/cppeditorenums.h
index 5dfde493267..dc676ebd1fa 100644
--- a/src/plugins/cppeditor/cppeditorenums.h
+++ b/src/plugins/cppeditor/cppeditorenums.h
@@ -43,6 +43,7 @@ enum CppFormats {
CppStringFormat,
CppTypeFormat,
CppKeywordFormat,
+ CppPrimitiveTypeFormat,
CppOperatorFormat,
CppPreprocessorFormat,
CppLabelFormat,
diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp
index 241619ded0d..d7b23b15e7f 100644
--- a/src/plugins/cppeditor/cpphighlighter.cpp
+++ b/src/plugins/cppeditor/cpphighlighter.cpp
@@ -52,6 +52,7 @@ CppHighlighter::CppHighlighter(QTextDocument *document) :
<< TextEditor::C_STRING
<< TextEditor::C_TYPE
<< TextEditor::C_KEYWORD
+ << TextEditor::C_PRIMITIVE_TYPE
<< TextEditor::C_OPERATOR
<< TextEditor::C_PREPROCESSOR
<< TextEditor::C_LABEL
@@ -220,6 +221,9 @@ void CppHighlighter::highlightBlock(const QString &text)
|| CppTools::isQtKeyword(text.midRef(tk.utf16charsBegin(), tk.utf16chars()))
|| tk.isObjCAtKeyword()) {
setFormat(tk.utf16charsBegin(), tk.utf16chars(), formatForCategory(CppKeywordFormat));
+ } else if (tk.isPrimitiveType()) {
+ setFormat(tk.utf16charsBegin(), tk.utf16chars(),
+ formatForCategory(CppPrimitiveTypeFormat));
} else if (tk.isOperator()) {
setFormat(tk.utf16charsBegin(), tk.utf16chars(), formatForCategory(CppOperatorFormat));
} else if (i == 0 && tokens.size() > 1 && tk.is(T_IDENTIFIER) && tokens.at(1).is(T_COLON)) {
diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp
index 8fa21ae58d0..10a3412c1b5 100644
--- a/src/plugins/cpptools/cppcompletionassist.cpp
+++ b/src/plugins/cpptools/cppcompletionassist.cpp
@@ -1727,6 +1727,10 @@ void CppCompletionAssistProcessor::addKeywords()
// keyword completion items.
for (int i = T_FIRST_KEYWORD; i < keywordLimit; ++i)
addCompletionItem(QLatin1String(Token::name(i)), m_icons.keywordIcon(), KeywordsOrder);
+
+ // primitive type completion items.
+ for (int i = T_FIRST_PRIMITIVE; i <= T_LAST_PRIMITIVE; ++i)
+ addCompletionItem(QLatin1String(Token::name(i)), m_icons.keywordIcon(), KeywordsOrder);
}
void CppCompletionAssistProcessor::addMacros(const QString &fileName, const CPlusPlus::Snapshot &snapshot)
diff --git a/src/plugins/texteditor/texteditorconstants.cpp b/src/plugins/texteditor/texteditorconstants.cpp
index cd2e81aa0a3..7ac6a9ef182 100644
--- a/src/plugins/texteditor/texteditorconstants.cpp
+++ b/src/plugins/texteditor/texteditorconstants.cpp
@@ -62,6 +62,7 @@ const char *nameForStyle(TextStyle style)
case C_VIRTUAL_METHOD: return "VirtualMethod";
case C_FUNCTION: return "Function";
case C_KEYWORD: return "Keyword";
+ case C_PRIMITIVE_TYPE: return "PrimitiveType";
case C_OPERATOR: return "Operator";
case C_PREPROCESSOR: return "Preprocessor";
case C_LABEL: return "Label";
diff --git a/src/plugins/texteditor/texteditorconstants.h b/src/plugins/texteditor/texteditorconstants.h
index a5ddce327c2..b908d7d408e 100644
--- a/src/plugins/texteditor/texteditorconstants.h
+++ b/src/plugins/texteditor/texteditorconstants.h
@@ -59,6 +59,7 @@ enum TextStyle {
C_VIRTUAL_METHOD,
C_FUNCTION,
C_KEYWORD,
+ C_PRIMITIVE_TYPE,
C_OPERATOR,
C_PREPROCESSOR,
C_LABEL,
diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp
index b96f75d2082..b499ff242e9 100644
--- a/src/plugins/texteditor/texteditorsettings.cpp
+++ b/src/plugins/texteditor/texteditorsettings.cpp
@@ -139,6 +139,8 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
Qt::darkBlue));
formatDescr.append(FormatDescription(C_STRING, tr("String"),
tr("Character and string literals."), Qt::darkGreen));
+ formatDescr.append(FormatDescription(C_PRIMITIVE_TYPE, tr("Primitive Type"),
+ tr("Primitive data types"), Qt::darkYellow));
formatDescr.append(FormatDescription(C_TYPE, tr("Type"), tr("Name of a type."),
Qt::darkMagenta));
formatDescr.append(FormatDescription(C_LOCAL, tr("Local"), tr("Local variables.")));
@@ -204,8 +206,8 @@ TextEditorSettings::TextEditorSettings(QObject *parent)
jsGlobalFormat));
formatDescr.append(FormatDescription(C_KEYWORD, tr("Keyword"),
- tr("Reserved keywords of the programming language."),
- Qt::darkYellow));
+ tr("Reserved keywords of the programming language except "
+ "keywords denoting primitive types."), Qt::darkYellow));
formatDescr.append(FormatDescription(C_OPERATOR, tr("Operator"),
tr("Operators (for example operator++ or operator-=).")));
formatDescr.append(FormatDescription(C_PREPROCESSOR, tr("Preprocessor"),