Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
HighlightingUtils Struct Reference

#include <qqmlsemantictokens_p.h>

+ Collaboration diagram for HighlightingUtils:

Static Public Member Functions

static QList< int > encodeSemanticTokens (Highlights &highlights)
 
static QList< QQmlJS::SourceLocationsourceLocationsFromMultiLineToken (QStringView code, const QQmlJS::SourceLocation &tokenLocation)
 Returns multiple source locations for a given raw comment.
 
static void addModifier (QLspSpecification::SemanticTokenModifiers modifier, int *baseModifier)
 
static bool rangeOverlapsWithSourceLocation (const QQmlJS::SourceLocation &loc, const HighlightsRange &r)
 
static QList< QLspSpecification::SemanticTokensEdit > computeDiff (const QList< int > &, const QList< int > &)
 
static void updateResultID (QByteArray &resultID)
 

Detailed Description

Definition at line 90 of file qqmlsemantictokens_p.h.

Member Function Documentation

◆ addModifier()

void HighlightingUtils::addModifier ( QLspSpecification::SemanticTokenModifiers modifier,
int * baseModifier )
static

Computes the modifier value. Modifier is read as binary value in the protocol. The location of the bits set are interpreted as the indices of the tokenModifiers list registered by the server. Then, the client modifies the highlighting of the token.

tokenModifiersList: ["declaration", definition, readonly, static ,,,]

To set "definition" and "readonly", we need to send 0b00000110

Definition at line 664 of file qqmlsemantictokens.cpp.

◆ computeDiff()

QList< SemanticTokensEdit > HighlightingUtils::computeDiff ( const QList< int > & oldData,
const QList< int > & newData )
static

Definition at line 707 of file qqmlsemantictokens.cpp.

References edit, r1, and r2.

Referenced by SemanticTokenDeltaHandler::process().

+ Here is the caller graph for this function:

◆ encodeSemanticTokens()

QList< int > HighlightingUtils::encodeSemanticTokens ( Highlights & highlights)
static

Definition at line 628 of file qqmlsemantictokens.cpp.

References Highlights::highlights(), and token.

Referenced by Highlights::collectTokens().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rangeOverlapsWithSourceLocation()

bool HighlightingUtils::rangeOverlapsWithSourceLocation ( const QQmlJS::SourceLocation & loc,
const HighlightsRange & r )
static

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

Definition at line 675 of file qqmlsemantictokens.cpp.

References QQmlJS::SourceLocation::length, and QQmlJS::SourceLocation::offset.

Referenced by HighlightingVisitor::operator()().

+ Here is the caller graph for this function:

◆ sourceLocationsFromMultiLineToken()

QList< QQmlJS::SourceLocation > HighlightingUtils::sourceLocationsFromMultiLineToken ( QStringView stringLiteral,
const QQmlJS::SourceLocation & locationInDocument )
static

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 580 of file qqmlsemantictokens.cpp.

References QQmlJS::SourceLocation::length, and pos.

◆ updateResultID()

void HighlightingUtils::updateResultID ( QByteArray & resultID)
static

Definition at line 687 of file qqmlsemantictokens.cpp.

References i.

Referenced by SemanticTokenDeltaHandler::process(), SemanticTokenRangeHandler::process(), and SemanticTokenFullHandler::process().

+ Here is the caller graph for this function:

The documentation for this struct was generated from the following files: