syside.ide.SemanticTokensBuilder
- class SemanticTokensBuilder
Helper for building LSP compatible semantic tokens.
Initialization
- append(arg: syside.ide.AbsoluteSemanticToken, /) None
Append a new semantic token.
- property absolute_tokens: syside.ContainerView[syside.ide.AbsoluteSemanticToken]
Get all collected absolute semantic tokens. Note that this may require decoding delta tokens first.
- property delta_tokens: syside.ContainerView[syside.ide.DeltaSemanticToken]
Get all collected delta semantic tokens. Note that in case tokens were appended out of order, an encoding may take place.
- property previous_tokens: syside.ContainerView[syside.ide.DeltaSemanticToken]
Get previously built tokens as delta tokens. Must call
previous_result
to make this available.
- previous_result(arg: int, /) None
Move the contents of this builder to previous result and reset the state. If id does not match
id
, current tokens are discarded instead. This must be called before building edits.
- previous_result(arg: str, /) None
Overload of
previous_result
that will parse the provided id to int.
- build() syside.ide.lsp.SemanticTokens
Build currently collected semantic tokens into LSP compatible format.
- build_edits() syside.ide.lsp.SemanticTokens | syside.ide.lsp.SemanticTokensDelta
Build currently collected semantic tokens into LSP compatible format. If
can_build_edits
, a delta to theprevious_tokens
will be returned which will usually be smaller than the full tokens.