syside.ide.build_delta_semantic_tokens
- build_delta_semantic_tokens(document: syside.Document, id: int | str, encoding: syside.ide.lsp.PositionEncodingKind = lsp.PositionEncodingKind.Utf8, multiline_tokens: bool = True, builder: syside.ide.SemanticTokensBuilder | None = None) syside.ide.SemanticTokensBuilder | None
Build full document semantic tokens for edits. Returns
builder
if successful, andNone
otherwise. Generally,None
is returned if thedocument
has nothing to highlight.Internally calls
SemanticTokensBuilder.previous_result
before building tokens.- Parameters:
document – The document to build full semantic tokens for.
id – Previous result id.
previous_result
is called first, and if theid
matchesbuilder
id the returnedbuilder
can be used to build edits.encoding – The position encoding to use for semantic tokens. Use Utf32 if interacting with Python strings.
multiline_tokens – Whether to keep multiline tokens as is and not split them. Generally used for language clients that do not support multiline tokens.
builder – The builder to collect semantic tokens into. Note that if provided, its internal state will be reset.
- Returns:
Provided
builder
, or new one otherwise, if there was anything to highlight.- Raises:
ValueError – If
encoding != Utf8 or not multiline_tokens
anddocument.text_document is None
. Utf8 encoding andmultiline_tokens
does not require a text source as all the required information is already contained in the CST.