![]() |
Qt 6.x
The Qt SDK
|
#include <qqmllsutils_p.h>
Definition at line 67 of file qqmllsutils_p.h.
|
static |
Definition at line 268 of file qqmllsutils.cpp.
References base, QQmlJS::Dom::DomItem::field(), and qDebug.
Referenced by findTypeDefinitionOf().
|
static |
Definition at line 789 of file qqmllsutils.cpp.
References canonicalPath(), file, findJSIdentifierDefinition(), findMethodDefinitionOf(), findMethodIn(), findPropertyDefinitionOf(), findPropertyIn(), isFieldMemberAccess(), item, JustOwner, Q_ASSERT_X, qDebug, resolveExpressionType(), QQmlJS::Dom::ScriptIdentifierExpression, and QQmlJSScope::sourceLocation().
Referenced by QmlGoToDefinitionSupport::process().
|
static |
Extracts the QML object type of an \l DomItem.
For a PropertyDefinition
, return the type of the property. For a Binding
, return the bound item's type if an QmlObject is bound, and otherwise the type of the property. For a QmlObject
, do nothing and return it. For an Id
, return the object to which the id resolves. For a Methodparameter
, return the type of the parameter. = Otherwise, return an empty item.
Definition at line 300 of file qqmllsutils.cpp.
References baseObject(), QQmlJS::Dom::Binding, QQmlJS::Dom::Empty, Everything, QQmlJS::Dom::DomItem::field(), QQmlJS::Dom::DomItem::filterUp(), QQmlJS::Dom::Id, item, QQmlJS::Dom::Paths::lookupTypePath(), QQmlJS::Dom::MethodInfo, QQmlJS::Dom::MethodParameter, QQmlJS::Dom::DomItem::proceedToScope(), QQmlJS::Dom::PropertyDefinition, Q_ASSERT, qDebug, QQmlJS::Dom::QmlComponent, QQmlJS::Dom::QmlObject, resolveExpressionType(), QQmlJS::Dom::ScriptIdentifierExpression, and sourceLocationToDomItem().
Referenced by QmlGoToTypeDefinitionSupport::process().
|
static |
Definition at line 514 of file qqmllsutils.cpp.
References findUsagesHelper(), item, and qCDebug.
Referenced by QQmlFindUsagesSupport::process().
|
static |
Find the DomItem representing the object situated in file at given line and character/column.
If line and character point between two objects, two objects might be returned. If line and character point to whitespace, it might return an inner node of the QmlDom-Tree.
Definition at line 176 of file qqmllsutils.cpp.
References QList< T >::append(), QList< T >::begin(), QSet< T >::begin(), QQmlJS::SourceLocation::begin(), QQmlLSUtilsItemLocation::domItem, QList< T >::end(), QSet< T >::end(), QQmlJS::SourceLocation::end(), file, QQmlLSUtilsItemLocation::fileLocation, QList< T >::isEmpty(), it, QList< T >::last(), line, QQmlJS::Dom::DomItem::path(), Q_ASSERT, qCDebug, QList< T >::removeLast(), QList< T >::size(), and textOffsetFrom().
Referenced by CompletionRequest::completions(), QQmlBaseModule< RequestType >::itemsForRequest(), and sourceLocationToDomItem().
|
static |
The language server protocol calls "URI" what QML calls "URL". According to RFC 3986, a URL is a special case of URI that not only identifies a resource but also shows how to access it. In QML, however, URIs are distinct from URLs. URIs are the identifiers of modules, for example "QtQuick.Controls". In order to not confuse the terms we interpret language server URIs as URLs in the QML code model. This method marks a point of translation between the terms, but does not have to change the actual URI/URL.
Definition at line 69 of file qqmllsutils.cpp.
Referenced by WorkspaceHandlers::clientInitialized(), TextSynchronization::didCloseTextDocument(), TextSynchronization::didDidChangeTextDocument(), TextSynchronization::didOpenTextDocument(), QQmlBaseModule< RequestType >::itemsForRequest(), QQmlDocumentFormatting::process(), WorkspaceHandlers::registerHandlers(), and QQmlBaseModule< RequestType >::requestHandler().
|
static |
Converts a QQmlJS::SourceLocation to a LSP Range.
QQmlJS::SourceLocation starts counting lines and rows at 1, but the LSP Range starts at 0. Also, the QQmlJS::SourceLocation contains startLine, startColumn and length while the LSP Range contains startLine, startColumn, endLine and endColumn, which must be computed from the actual qml code.
Definition at line 88 of file qqmllsutils.cpp.
References QQmlJS::SourceLocation::end(), QQmlJS::SourceLocation::startColumn, QQmlJS::SourceLocation::startLine, and textRowAndColumnFrom().
Referenced by QQmlFindUsagesSupport::process(), QmlGoToDefinitionSupport::process(), and QmlGoToTypeDefinitionSupport::process().
|
static |
Definition at line 74 of file qqmllsutils.cpp.
References url.
|
static |
Resolves the type of the given DomItem, when possible (e.g., when there are enough type annotations).
Definition at line 588 of file qqmllsutils.cpp.
References Everything, findJSIdentifierDefinition(), findMethodIn(), findPropertyIn(), isFieldMemberAccess(), isFieldMemberExpression(), item, JustOwner, parent, property, Q_ASSERT_X, qCDebug, resolveExpressionType(), QQmlJS::Dom::DomItem::semanticScope(), QQmlJS::Dom::MethodInfo::semanticScope(), and QQmlJS::Dom::QmlObject::semanticScope().
Referenced by findDefinitionOf(), findTypeDefinitionOf(), findUsagesOfNonJSIdentifiers(), and resolveExpressionType().
|
static |
Definition at line 718 of file qqmllsutils.cpp.
References QList< T >::back(), file, QList< T >::front(), items, itemsFromTextLocation(), Q_ASSERT_X, qDebug, and QList< T >::size().
Referenced by findMethodDefinitionOf(), findPropertyDefinitionOf(), and findTypeDefinitionOf().
Convert a text position from (line, column) into an offset.
Row, Column and the offset are all 0-based. For example, {s[textOffsetFrom(s, 5, 55)]} returns the character of s at line 5 and column 55.
Definition at line 111 of file qqmllsutils.cpp.
References QString::at(), i, QString::size(), and text.
Referenced by CompletionRequest::completions(), and itemsFromTextLocation().
|
static |
Convert a text position from an offset into (line, column).
Row, Column and the offset are all 0-based. For example, {textRowAndColumnFrom(s, 55)} returns the line and columns of the character at
{s
[55]}.
Definition at line 148 of file qqmllsutils.cpp.
Referenced by QQmlDocumentFormatting::process(), and qmlLocationToLspLocation().