QmlJS: Improve handling of user defined enums

Improves handling of Qml based enums inside qml documents.

 * completion of enums
 * follow the enum
 * highlighting values inside the declaration
 * displaying the enum declaration inside the outline
 * minor static checks

Task-number: QTCREATORBUG-19226
Change-Id: Ia07fd9a8b7fa3106f2ea53198bfdcc50eecb7307
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Christian Stenger
2024-04-08 15:30:05 +02:00
parent ee8245d8aa
commit e1d90a7965
13 changed files with 184 additions and 4 deletions

View File

@@ -599,6 +599,17 @@ protected:
return true;
}
bool visit(UiEnumDeclaration *node) override
{
if (containsOffset(node->identifierToken)) {
_name = node->name.toString();
_scope = _doc->bind()->findQmlObject(_objectNode);
_targetValue = _scopeChain->context()->lookupType(_doc.data(), QStringList(_name));
return false;
}
return true;
}
bool visit(FunctionDeclaration *node) override
{
return visit(static_cast<FunctionExpression *>(node));