4#ifndef DOCUMENT_SYMBOL_UTILS_P_H
5#define DOCUMENT_SYMBOL_UTILS_P_H
18#include <QtQmlDom/private/qqmldom_fwd_p.h>
19#include <qxpfunctional.h>
49 const AssemblingFunction af = buildSymbolOrReturnChildren);
DocumentSymbolVisitor(const DomItem &item, const AssemblingFunction af)
static const FieldFilter & fieldsFilter()
SymbolsList assembleSymbols()
friend bool operator<(const Location &a, const Location &b)
static std::optional< Location > tryFrom(const QString &fileName, const QQmlJS::SourceLocation &sourceLocation, const QQmlJS::Dom::DomItem &someItem)
static Location from(const QString &fileName, const QQmlJS::SourceLocation &sourceLocation, const QString &code)
QQmlJS::SourceLocation sourceLocation() const
friend bool operator==(const Location &a, const Location &b)
Location(const QString &filename, const QQmlJS::SourceLocation &sourceLocation, const TextPosition &end)
static Location from(const QString &fileName, const QString &code, qsizetype startLine, qsizetype startCharacter, qsizetype length)
Represents the locations where a renaming should take place.
friend bool comparesEqual(const RenameUsages &a, const RenameUsages &b) noexcept
void appendRename(const Edit &edit)
RenameUsages(const QList< Edit > &renamesInFile, const QList< FileRename > &renamesInFilename)
QList< Edit > renameInFile() const
void appendRename(const FileRename &edit)
QList< FileRename > renameInFilename() const
Represents the locations where some highlighting should take place, like in the "find allreferences" ...
void appendFilenameUsage(const QString &edit)
QList< Location > usagesInFile() const
QList< QString > usagesInFilename() const
friend bool comparesEqual(const Usages &a, const Usages &b) noexcept
void appendUsage(const Location &edit)
Usages(const QList< Location > &usageInFile, const QList< QString > &usageInFilename)
static constexpr std::array< TypeSymbolRelation, 9 > s_TypeSymbolRelations
std::pair< QLspSpecification::Range, QLspSpecification::Range > symbolRangesOf(const DomItem &item)
static bool shouldFilterOut(const DomItem &item)
QLspSpecification::DocumentSymbol & MutableRefToDocumentSymbol
SymbolsList assembleSymbolsForQmlFile(const DomItem &item, const AssemblingFunction af)
static void adopt(QLspSpecification::DocumentSymbol &&child, MutableRefToDocumentSymbol parent)
static std::optional< QByteArray > tryGetQmlObjectDetail(const DomItem &qmlObj)
static void readoptChildrenIf(const DocumentSymbolPredicate unaryPred, MutableRefToDocumentSymbol currentParent)
std::optional< QByteArray > tryGetDetailOf(const DomItem &item)
static SymbolsList extractChildrenIf(const DocumentSymbolPredicate shouldBeReadopted, MutableRefToDocumentSymbol currentParent)
static bool propertyBoundAtDefinitionLine(const DomItem &propertyDefinition)
static constexpr bool documentSymbolNotSupportedFor(const DomType &type)
static QByteArray getMethodDetail(const DomItem &mItem)
static MutableRefToDocumentSymbol findDirectParentFor(const QLspSpecification::DocumentSymbol &child, MutableRefToDocumentSymbol currentParent)
void reorganizeForOutlineView(SymbolsList &qmlFileSymbols)
SymbolsList buildSymbolOrReturnChildren(const DomItem &item, SymbolsList &&children)
static constexpr SymbolKind symbolKindFor(const DomType &type)
static bool isSubRange(const QLspSpecification::Range &potentialSubRange, const QLspSpecification::Range &range)
static std::optional< QByteArray > tryGetBindingDetail(const DomItem &bItem)
static void reorganizeQmlComponentSymbol(MutableRefToDocumentSymbol qmlCompSymbol)
qxp::function_ref< bool(const QLspSpecification::DocumentSymbol &) const > DocumentSymbolPredicate
QLspSpecification::SymbolKind symbolKindOf(const DomItem &item)
QByteArray symbolNameOf(const DomItem &item)
RenameUsages renameUsagesOf(const DomItem &item, const QString &newName, const std::optional< ExpressionType > &targetType=std::nullopt)
Rename the appearance of item to newName.
QQmlJSScope::ConstPtr findDefiningScopeForProperty(const QQmlJSScope::ConstPtr &referrerScope, const QString &nameToCheck)
Finds the scope where a property is first defined.
bool isFieldMemberBase(const DomItem &item)
QStringList findFilePathsFromFileNames(const QString &rootDir, const QStringList &fileNamesToSearch, const QSet< QString > &ignoredPaths)
@ EnumeratorValueIdentifier
@ GroupedPropertyIdentifier
@ AttachedTypeIdentifierInBindingTarget
@ QualifiedModuleIdentifier
@ PropertyChangedHandlerIdentifier
@ PropertyChangedSignalIdentifier
@ SignalHandlerIdentifier
bool isValidEcmaScriptIdentifier(QStringView view)
QLspSpecification::Range qmlLocationToLspLocation(Location qmlLocation)
Converts a QQmlJS::SourceLocation to a LSP Range.
QQmlJSScope::ConstPtr findDefiningScopeForMethod(const QQmlJSScope::ConstPtr &referrerScope, const QString &nameToCheck)
QQmlJSScope::ConstPtr findDefiningScopeForBinding(const QQmlJSScope::ConstPtr &referrerScope, const QString &nameToCheck)
qsizetype textOffsetFrom(const QString &code, int row, int character)
Convert a text position from (line, column) into an offset.
std::optional< Location > findDefinitionOf(const DomItem &item, const QStringList &headerDirectories)
DomItem baseObject(const DomItem &qmlObject)
QByteArray lspUriToQmlUrl(const QByteArray &uri)
DomItem sourceLocationToDomItem(const DomItem &file, const QQmlJS::SourceLocation &location)
QStringList fieldMemberExpressionBits(const DomItem &item, const DomItem &stopAtChild={})
QByteArray qmlUrlToLspUri(const QByteArray &url)
@ ResolveActualTypeForFieldMemberExpression
TextPosition textRowAndColumnFrom(const QString &code, qsizetype offset)
Convert a text position from an offset into (line, column).
std::optional< ExpressionType > resolveExpressionType(const DomItem &item, ResolveOptions)
Resolves the type of the given DomItem, when possible (e.g., when there are enough type annotations).
bool isFieldMemberExpression(const DomItem &item)
bool isFieldMemberAccess(const DomItem &item)
QQmlJSScope::ConstPtr findDefiningScopeForEnumeration(const QQmlJSScope::ConstPtr &referrerScope, const QString &nameToCheck)
QList< ItemLocation > itemsFromTextLocation(const DomItem &file, int line, int character)
Find the DomItem representing the object situated in file at given line and character/column.
QString qualifiersFrom(const DomItem &el)
QQmlJSScope::ConstPtr findDefiningScopeForEnumerationKey(const QQmlJSScope::ConstPtr &referrerScope, const QString &nameToCheck)
Usages findUsagesOf(const DomItem &item)
std::optional< Location > findTypeDefinitionOf(const DomItem &item)
Returns the location of the type definition pointed by object.
QString findFilePathFromFileName(const QStringList &rootDirs, const QString &fileNameToSearch, const QSet< QString > &ignoredPaths)
std::pair< QString, QStringList > cmakeBuildCommand(const QString &path)
std::optional< ErrorMessage > checkNameForRename(const DomItem &item, const QString &newName, const std::optional< ExpressionType > &targetType=std::nullopt)
QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcEventDispatcher)
static Edit from(const QString &fileName, const QString &code, qsizetype startLine, qsizetype startCharacter, qsizetype length, const QString &newName)
friend bool operator<(const Edit &a, const Edit &b)
friend bool operator==(const Edit &a, const Edit &b)
QQmlJSScope::ConstPtr semanticScope
std::optional< QString > name
Represents a rename operation where the file itself needs to be renamed.
friend bool comparesEqual(const FileRename &a, const FileRename &b) noexcept
friend Qt::strong_ordering compareThreeWay(const FileRename &a, const FileRename &b) noexcept
QQmlJS::Dom::DomItem domItem
QQmlJS::Dom::FileLocations::Tree fileLocation