Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QmlHighlighting::Utils Namespace Reference

Functions

QList< unsigned > encodeSemanticTokens (const HighlightsContainer &highlights, HighlightingMode mode=HighlightingMode::Default)
QList< QQmlJS::SourceLocationsourceLocationsFromMultiLineToken (QStringView code, const QQmlJS::SourceLocation &tokenLocation)
 Returns multiple source locations for a given raw comment.
void addModifier (QLspSpecification::SemanticTokenModifiers modifier, int *baseModifier)
bool rangeOverlapsWithSourceLocation (const QQmlJS::SourceLocation &loc, const HighlightsRange &r)
QList< QLspSpecification::SemanticTokensEdit > computeDiff (const QList< unsigned > &, const QList< unsigned > &)
void updateResultID (QByteArray &resultID)
HighlightsContainer visitTokens (const QQmlJS::Dom::DomItem &item, const std::optional< HighlightsRange > &range)
void addHighlight (HighlightsContainer &out, const QQmlJS::SourceLocation &loc, QmlHighlightKind, QmlHighlightModifiers=QmlHighlightModifier::None)
void applyDiffs (HighlightsContainer &highlights, const QList< QQmlLSUtils::Diff > &diffs)
HighlightsContainer shiftHighlights (const HighlightsContainer &cachedHighlights, const QString &lastValidCode, const QString &currentCode)
HighlightsContainer regexFallbackHighlights (QStringView code, const std::optional< HighlightsRange > &range)

Function Documentation

◆ addHighlight()

void QmlHighlighting::Utils::addHighlight ( HighlightsContainer & out,
const QQmlJS::SourceLocation & loc,
QmlHighlightKind highlightKind,
QmlHighlightModifiers modifierKind = QmlHighlightModifier::None )

Definition at line 1065 of file qqmlsemantictokens.cpp.

◆ addModifier()

void QmlHighlighting::Utils::addModifier ( QLspSpecification::SemanticTokenModifiers modifier,
int * baseModifier )

◆ applyDiffs()

void QmlHighlighting::Utils::applyDiffs ( HighlightsContainer & highlights,
const QList< QQmlLSUtils::Diff > & diffs )

Definition at line 1787 of file qqmlsemantictokens.cpp.

◆ computeDiff()

QList< SemanticTokensEdit > QmlHighlighting::Utils::computeDiff ( const QList< unsigned > & oldData,
const QList< unsigned > & newData )

Definition at line 1037 of file qqmlsemantictokens.cpp.

◆ encodeSemanticTokens()

QList< unsigned > QmlHighlighting::Utils::encodeSemanticTokens ( const HighlightsContainer & highlights,
HighlightingMode mode = HighlightingMode::Default )

Definition at line 953 of file qqmlsemantictokens.cpp.

◆ rangeOverlapsWithSourceLocation()

bool QmlHighlighting::Utils::rangeOverlapsWithSourceLocation ( const QQmlJS::SourceLocation & loc,
const HighlightsRange & r )

Check if the ranges overlap by ensuring that one range starts before the other ends

Definition at line 1005 of file qqmlsemantictokens.cpp.

References QmlHighlighting::HighlightsRange::endOffset, and QmlHighlighting::HighlightsRange::startOffset.

◆ regexFallbackHighlights()

HighlightsContainer QmlHighlighting::Utils::regexFallbackHighlights ( QStringView code,
const std::optional< HighlightsRange > & range )

Definition at line 1478 of file qqmlsemantictokens.cpp.

◆ shiftHighlights()

HighlightsContainer QmlHighlighting::Utils::shiftHighlights ( const HighlightsContainer & cachedHighlights,
const QString & lastValidCode,
const QString & currentCode )

Definition at line 1087 of file qqmlsemantictokens.cpp.

◆ sourceLocationsFromMultiLineToken()

QList< QQmlJS::SourceLocation > QmlHighlighting::Utils::sourceLocationsFromMultiLineToken ( QStringView stringLiteral,
const QQmlJS::SourceLocation & locationInDocument )

Returns multiple source locations for a given raw comment.

Needed by semantic highlighting of comments. LSP clients usually don't support multiline tokens. In QML, we can have multiline tokens like string literals and comments. This method generates multiple source locations of sub-elements of token split by a newline delimiter.

Definition at line 935 of file qqmlsemantictokens.cpp.

◆ updateResultID()

void QmlHighlighting::Utils::updateResultID ( QByteArray & resultID)

Definition at line 1017 of file qqmlsemantictokens.cpp.

◆ visitTokens()

HighlightsContainer QmlHighlighting::Utils::visitTokens ( const QQmlJS::Dom::DomItem & item,
const std::optional< HighlightsRange > & range )

Definition at line 1079 of file qqmlsemantictokens.cpp.