Class SemanticTokensProvider

Responsible for dealing with semantic highlighting operations

Hierarchy

  • SemanticTokensProvider

Constructors

  • Sets the map from EO token to VSCode token types and initializes the semantic legend of Semantic Highlighter

    Parameters

    • capability: SemanticTokensClientCapabilities

      Capabilities of the semantic tokens client

    Returns SemanticTokensProvider

Properties

legend: SemanticTokensLegend

The VSCode tokens types used in the EO semantic highlighting

tokenBuilders: Map<string, SemanticTokensBuilder> = ...

Keep a separate semantic token builder per file Each builder keeps track of the semantic tokens in a file

tokenTypeMap: Map<string, string> = ...

A map from EO's g4 grammar token types into token types supported by VS Code

Methods

  • For every token in EO's grammar, checks if it is mapped to VSCode token types and, if so, add that token type to the Semantic Tokens Legend of the grammar.

    Returns

    • Semantic Tokens Legend for the grammar

    Parameters

    • capability: SemanticTokensClientCapabilities

      Capabilities of the semantic highlighting feature

    Returns SemanticTokensLegend

  • Creates a new Semantic Tokens Builder for the given document if it does not already have one, and caches it.

    Returns

    • The Semantic Tokens Builder for the given document

    Parameters

    • document: TextDocument

      Text document for which to create the new Semantic Tokens Builder

    Returns SemanticTokensBuilder

  • Pushes into a SemanticTokensBuilder the semantic tokens obtained from a text document

    Returns

    Parameters

    • builder: SemanticTokensBuilder

      SemanticTokensBuilder to be populated with the semantic tokens of the given document

    • document: TextDocument

      TextDocument to be semanticaly highlighted

    Returns void

  • Returns a SemanticTokensBuilder for a modified text document

    Returns

    • SemanticTokensBuilder containing the semantic token of the given document

    Parameters

    • document: TextDocument

      TextDocument to be semanticaly highlighted

    • resultsId: string

      The ID of the previous semantic analysis performed on the document

    Returns SemanticTokens | SemanticTokensDelta

  • Returns a SemanticTokensBuilder for a new text document

    Returns

    • SemanticTokensBuilder containing the semantic token of the given document

    Parameters

    • document: TextDocument

      TextDocument to be semanticaly highlighted

    Returns SemanticTokens

  • Initializes the map from EO's g4 grammar token types into token types supported by VS Code. This operation defines how each token will look like in the highlighted document

    Returns

    Returns void

  • Obtains the semantic tokens for a given text document.

    Firstly, the document is tokenized through the EO's parser. Secondly, each token receives a VSCode token type depending on which grammar token it is. If no VSCode token is a match, then its token code is set to -1.

    Returns

    • Array of VSCode tokens present in the document

    Parameters

    • document: TextDocument

      Text Document to be semanticaly tokenized

    Returns VSCodeToken[]

Generated using TypeDoc