Improve Jai and Odin syntax highlighting.

Reduce memory usage of SyntaxTokens. Fix token signature calculation.
This commit is contained in:
Martín Lucas Golini
2023-09-30 17:07:18 -03:00
parent be76ea1b2c
commit a29f0bcfa0
12 changed files with 94 additions and 75 deletions

View File

@@ -148,10 +148,10 @@ void LSPDocumentClient::requestSemanticHighlighting( bool reqFull ) {
Uint64 docModId = mDoc->getModificationId();
mServer->documentSemanticTokensFull(
mDoc->getURI(), delta, reqId, range,
[docClient, uri, server, docModId]( const auto&, const LSPSemanticTokensDelta& deltas ) {
[docClient, uri, server, docModId]( const auto&, LSPSemanticTokensDelta&& deltas ) {
if ( server->hasDocument( uri ) ) {
docClient->mWaitingSemanticTokensResponse = false;
docClient->processTokens( deltas, docModId );
docClient->processTokens( std::move( deltas ), docModId );
}
} );
}
@@ -251,7 +251,7 @@ static SyntaxStyleType semanticTokenTypeToSyntaxType( const std::string& type,
return SyntaxStyleTypes::Normal;
}
void LSPDocumentClient::processTokens( const LSPSemanticTokensDelta& tokens,
void LSPDocumentClient::processTokens( LSPSemanticTokensDelta&& tokens,
const Uint64& docModificationId ) {
if ( mDoc == nullptr || mServer == nullptr )
return;
@@ -276,7 +276,7 @@ void LSPDocumentClient::processTokens( const LSPSemanticTokensDelta& tokens,
}
if ( !tokens.data.empty() ) {
mSemanticTokens = tokens;
mSemanticTokens = std::move( tokens );
}
highlight();