forked from qt-creator/qt-creator
TextEditor: Add highlighting category for namespaces
... and make use of it in the built-in code model and with clangd. Task-number: QTCREATORBUG-16580 Change-Id: I8c331f56aa1bbf91c9f768be82a779a72f40c4c7 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -62,6 +62,7 @@ static QString useKindToString(UseKind useKind)
|
||||
switch (useKind) {
|
||||
CASE_STR(Unknown);
|
||||
CASE_STR(TypeUse);
|
||||
CASE_STR(NamespaceUse);
|
||||
CASE_STR(LocalUse);
|
||||
CASE_STR(FieldUse);
|
||||
CASE_STR(EnumerationUse);
|
||||
@@ -249,8 +250,8 @@ void tst_CheckSymbols::test_checksymbols_data()
|
||||
<< _("namespace N {}\n"
|
||||
"using namespace N;\n")
|
||||
<< (UseList()
|
||||
<< Use(1, 11, 1, Highlighting::TypeUse)
|
||||
<< Use(2, 17, 1, Highlighting::TypeUse));
|
||||
<< Use(1, 11, 1, Highlighting::NamespaceUse)
|
||||
<< Use(2, 17, 1, Highlighting::NamespaceUse));
|
||||
|
||||
QTest::newRow("LocalUse")
|
||||
<< _("int f()\n"
|
||||
@@ -713,11 +714,11 @@ void tst_CheckSymbols::test_checksymbols_data()
|
||||
<< Use(1, 14, 4, Highlighting::FieldUse)
|
||||
<< Use(2, 6, 4, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(4, 8, 4, Highlighting::FieldUse)
|
||||
<< Use(6, 11, 3, Highlighting::TypeUse)
|
||||
<< Use(6, 11, 3, Highlighting::NamespaceUse)
|
||||
<< Use(7, 16, 4, Highlighting::FieldUse)
|
||||
<< Use(8, 8, 4, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(10, 10, 4, Highlighting::FieldUse)
|
||||
<< Use(13, 11, 3, Highlighting::TypeUse)
|
||||
<< Use(13, 11, 3, Highlighting::NamespaceUse)
|
||||
<< Use(15, 27, 4, Highlighting::FieldUse)
|
||||
<< Use(16, 10, 4, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(16, 19, 4, Highlighting::FieldUse)
|
||||
@@ -795,9 +796,9 @@ void tst_CheckSymbols::test_checksymbols_data()
|
||||
" Foo foo;\n"
|
||||
"}\n")
|
||||
<< (UseList()
|
||||
<< Use(1, 11, 2, Highlighting::TypeUse)
|
||||
<< Use(1, 11, 2, Highlighting::NamespaceUse)
|
||||
<< Use(2, 7, 3, Highlighting::TypeUse)
|
||||
<< Use(4, 7, 2, Highlighting::TypeUse)
|
||||
<< Use(4, 7, 2, Highlighting::NamespaceUse)
|
||||
<< Use(4, 11, 3, Highlighting::TypeUse)
|
||||
<< Use(5, 6, 3, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(7, 5, 3, Highlighting::TypeUse)
|
||||
@@ -815,10 +816,10 @@ void tst_CheckSymbols::test_checksymbols_data()
|
||||
"}\n"
|
||||
"}\n")
|
||||
<< (UseList()
|
||||
<< Use(1, 11, 2, Highlighting::TypeUse)
|
||||
<< Use(1, 11, 2, Highlighting::NamespaceUse)
|
||||
<< Use(2, 7, 3, Highlighting::TypeUse)
|
||||
<< Use(4, 11, 3, Highlighting::TypeUse)
|
||||
<< Use(5, 7, 2, Highlighting::TypeUse)
|
||||
<< Use(4, 11, 3, Highlighting::NamespaceUse)
|
||||
<< Use(5, 7, 2, Highlighting::NamespaceUse)
|
||||
<< Use(5, 11, 3, Highlighting::TypeUse)
|
||||
<< Use(6, 6, 3, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(8, 5, 3, Highlighting::TypeUse)
|
||||
@@ -834,10 +835,10 @@ void tst_CheckSymbols::test_checksymbols_data()
|
||||
" Foo foo;\n"
|
||||
"}\n")
|
||||
<< (UseList()
|
||||
<< Use(1, 11, 2, Highlighting::TypeUse)
|
||||
<< Use(1, 11, 2, Highlighting::NamespaceUse)
|
||||
<< Use(2, 7, 3, Highlighting::TypeUse)
|
||||
<< Use(4, 6, 3, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(6, 11, 2, Highlighting::TypeUse)
|
||||
<< Use(6, 11, 2, Highlighting::NamespaceUse)
|
||||
<< Use(6, 15, 3, Highlighting::TypeUse)
|
||||
<< Use(7, 5, 3, Highlighting::TypeUse)
|
||||
<< Use(7, 9, 3, Highlighting::LocalUse));
|
||||
@@ -852,7 +853,7 @@ void tst_CheckSymbols::test_checksymbols_data()
|
||||
" Foo foo;\n"
|
||||
"}\n")
|
||||
<< (UseList()
|
||||
<< Use(1, 11, 2, Highlighting::TypeUse)
|
||||
<< Use(1, 11, 2, Highlighting::NamespaceUse)
|
||||
<< Use(2, 7, 3, Highlighting::TypeUse)
|
||||
<< Use(5, 6, 3, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(7, 9, 3, Highlighting::LocalUse));
|
||||
@@ -869,9 +870,9 @@ void tst_CheckSymbols::test_checksymbols_data()
|
||||
"}\n"
|
||||
"}\n")
|
||||
<< (UseList()
|
||||
<< Use(1, 11, 2, Highlighting::TypeUse)
|
||||
<< Use(1, 11, 2, Highlighting::NamespaceUse)
|
||||
<< Use(2, 7, 3, Highlighting::TypeUse)
|
||||
<< Use(4, 11, 3, Highlighting::TypeUse)
|
||||
<< Use(4, 11, 3, Highlighting::NamespaceUse)
|
||||
<< Use(6, 6, 3, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(8, 9, 3, Highlighting::LocalUse));
|
||||
|
||||
@@ -885,7 +886,7 @@ void tst_CheckSymbols::test_checksymbols_data()
|
||||
" Foo foo;\n"
|
||||
"}\n")
|
||||
<< (UseList()
|
||||
<< Use(1, 11, 2, Highlighting::TypeUse)
|
||||
<< Use(1, 11, 2, Highlighting::NamespaceUse)
|
||||
<< Use(2, 7, 3, Highlighting::TypeUse)
|
||||
<< Use(4, 6, 3, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(7, 9, 3, Highlighting::LocalUse));
|
||||
@@ -947,14 +948,14 @@ void tst_CheckSymbols::test_checksymbols_data()
|
||||
"}\n")
|
||||
<< (UseList()
|
||||
<< Use(1, 8, 1, Highlighting::TypeUse)
|
||||
<< Use(2, 11, 3, Highlighting::TypeUse)
|
||||
<< Use(2, 11, 3, Highlighting::NamespaceUse)
|
||||
<< Use(4, 24, 1, Highlighting::TypeUse)
|
||||
<< Use(4, 34, 10, Highlighting::TypeUse)
|
||||
<< Use(6, 11, 2, Highlighting::TypeUse)
|
||||
<< Use(8, 11, 3, Highlighting::TypeUse)
|
||||
<< Use(6, 11, 2, Highlighting::NamespaceUse)
|
||||
<< Use(8, 11, 3, Highlighting::NamespaceUse)
|
||||
<< Use(8, 16, 10, Highlighting::TypeUse)
|
||||
<< Use(10, 6, 3, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(12, 5, 2, Highlighting::TypeUse)
|
||||
<< Use(12, 5, 2, Highlighting::NamespaceUse)
|
||||
<< Use(12, 9, 10, Highlighting::TypeUse)
|
||||
<< Use(12, 20, 1, Highlighting::TypeUse)
|
||||
<< Use(12, 23, 1, Highlighting::LocalUse));
|
||||
@@ -970,9 +971,9 @@ void tst_CheckSymbols::test_checksymbols_data()
|
||||
" Foo foo;\n"
|
||||
"}\n")
|
||||
<< (QList<Use>()
|
||||
<< Use(3, 15, 2, Highlighting::TypeUse)
|
||||
<< Use(3, 15, 2, Highlighting::NamespaceUse)
|
||||
<< Use(3, 27, 3, Highlighting::TypeUse)
|
||||
<< Use(4, 11, 2, Highlighting::TypeUse)
|
||||
<< Use(4, 11, 2, Highlighting::NamespaceUse)
|
||||
<< Use(4, 15, 3, Highlighting::TypeUse)
|
||||
<< Use(6, 6, 3, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(8, 5, 3, Highlighting::TypeUse)
|
||||
@@ -994,12 +995,12 @@ void tst_CheckSymbols::test_checksymbols_data()
|
||||
"}\n"
|
||||
)
|
||||
<< (QList<Use>()
|
||||
<< Use(1, 11, 3, Highlighting::TypeUse)
|
||||
<< Use(3, 15, 2, Highlighting::TypeUse)
|
||||
<< Use(1, 11, 3, Highlighting::NamespaceUse)
|
||||
<< Use(3, 15, 2, Highlighting::NamespaceUse)
|
||||
<< Use(3, 27, 3, Highlighting::TypeUse)
|
||||
<< Use(4, 11, 2, Highlighting::TypeUse)
|
||||
<< Use(4, 11, 2, Highlighting::NamespaceUse)
|
||||
<< Use(4, 15, 3, Highlighting::TypeUse)
|
||||
<< Use(6, 11, 3, Highlighting::TypeUse)
|
||||
<< Use(6, 11, 3, Highlighting::NamespaceUse)
|
||||
<< Use(8, 10, 3, Highlighting::FunctionDeclarationUse)
|
||||
<< Use(10, 13, 3, Highlighting::LocalUse)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user