SemanticTokensBuilder

class SemanticTokensBuilder

Helper for building LSP compatible semantic tokens.

Members defined in SemanticTokensBuilder (10 members)

absolute_tokens

R

Get all collected absolute semantic tokens. Note that this may require decoding delta tokens first.

can_build_edits

R

Returns true if build_edits would return delta to the previous result.

delta_tokens

R

Get all collected delta semantic tokens. Note that in case tokens were appended out of order, an encoding may take place.

id

R

Randomly generated ID of this builder.

previous_tokens

R

Get previously built tokens as delta tokens. Must call previous_result to make this available.

__init__

append

Append a new semantic token.

build

Build currently collected semantic tokens into LSP compatible format.

build_edits

Build currently collected semantic tokens into LSP compatible format. If can_build_edits, a delta to the previous_tokens will be returned which will usually be smaller than the full tokens.

previous_result

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.

Attributes

property absolute_tokens: syside.ContainerView[syside.ide.AbsoluteSemanticToken]

Get all collected absolute semantic tokens. Note that this may require decoding delta tokens first.

property can_build_edits: bool

Returns true if build_edits would return delta to the previous result.

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 id: int

Randomly generated ID of this builder.

property previous_tokens: syside.ContainerView[syside.ide.DeltaSemanticToken]

Get previously built tokens as delta tokens. Must call previous_result to make this available.

Methods

__init__() None
append(arg: syside.ide.AbsoluteSemanticToken, /) None

Append a new semantic token.

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 the previous_tokens will be returned which will usually be smaller than the full tokens.

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.

Used in