Token Types and Modifiers #
Standard semantic token types as defined by LSP 3.17
Equations
- One or more equations did not get rendered due to their size.
Instances For
Standard semantic token modifiers as defined by LSP 3.17
Equations
Instances For
Get the index of a token type in the standard list
Equations
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.namespace = 0
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.type = 1
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.class = 2
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.enum = 3
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.interface = 4
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.struct = 5
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.typeParameter = 6
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.parameter = 7
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.variable = 8
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.property = 9
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.enumMember = 10
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.event = 11
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.function = 12
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.method = 13
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.macro = 14
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.keyword = 15
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.modifier = 16
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.comment = 17
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.string = 18
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.number = 19
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.regexp = 20
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.operator = 21
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.decorator = 22
- Lapis.Server.SemanticTokens.tokenTypeIndex Lapis.Protocol.Generated.SemanticTokenTypes.label = 23
Instances For
Get the bit position of a token modifier in the standard list
Equations
- Lapis.Server.SemanticTokens.tokenModifierBit Lapis.Protocol.Generated.SemanticTokenModifiers.declaration = 0
- Lapis.Server.SemanticTokens.tokenModifierBit Lapis.Protocol.Generated.SemanticTokenModifiers.definition = 1
- Lapis.Server.SemanticTokens.tokenModifierBit Lapis.Protocol.Generated.SemanticTokenModifiers.readonly = 2
- Lapis.Server.SemanticTokens.tokenModifierBit Lapis.Protocol.Generated.SemanticTokenModifiers.static = 3
- Lapis.Server.SemanticTokens.tokenModifierBit Lapis.Protocol.Generated.SemanticTokenModifiers.deprecated = 4
- Lapis.Server.SemanticTokens.tokenModifierBit Lapis.Protocol.Generated.SemanticTokenModifiers.abstract = 5
- Lapis.Server.SemanticTokens.tokenModifierBit Lapis.Protocol.Generated.SemanticTokenModifiers.async = 6
- Lapis.Server.SemanticTokens.tokenModifierBit Lapis.Protocol.Generated.SemanticTokenModifiers.modification = 7
- Lapis.Server.SemanticTokens.tokenModifierBit Lapis.Protocol.Generated.SemanticTokenModifiers.documentation = 8
- Lapis.Server.SemanticTokens.tokenModifierBit Lapis.Protocol.Generated.SemanticTokenModifiers.defaultLibrary = 9
Instances For
Encode multiple modifiers as a bitmask
Equations
- One or more equations did not get rendered due to their size.
Instances For
Token Representation #
A semantic token before encoding. Tokens are represented with absolute positions and will be converted to relative (delta) encoding when building the response.
- line : Nat
Line number (0-indexed)
- character : Nat
Character offset within the line (0-indexed, UTF-16 code units)
- length : Nat
Length of the token in UTF-16 code units
- tokenType : Nat
Index into the token types legend
- tokenModifiers : Nat
Bitmask of token modifiers
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
- Lapis.Server.SemanticTokens.instBEqToken.beq x✝¹ x✝ = false
Instances For
Create a token from a SemanticTokenTypes enum
Equations
- One or more equations did not get rendered due to their size.
Instances For
Create a token with a custom type index
Equations
- One or more equations did not get rendered due to their size.
Instances For
Token Builder #
Create a new token builder with standard legends
Equations
- One or more equations did not get rendered due to their size.
Instances For
Create a token builder with custom legends
Equations
Instances For
Add a token using the SemanticTokenTypes enum
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a token using a custom type index
Equations
- One or more equations did not get rendered due to their size.
Instances For
Add a pre-constructed token
Equations
- b.pushToken token = { tokens := b.tokens.push token, tokenTypes := b.tokenTypes, tokenModifiers := b.tokenModifiers }
Instances For
Add multiple tokens
Equations
- b.pushTokens tokens = { tokens := b.tokens ++ tokens, tokenTypes := b.tokenTypes, tokenModifiers := b.tokenModifiers }
Instances For
Get the legend for capability registration
Equations
- b.getLegend = { tokenTypes := b.tokenTypes, tokenModifiers := b.tokenModifiers }
Instances For
Encode tokens to the LSP delta format. The LSP semantic tokens format uses relative encoding:
- Each token is represented as 5 integers
- [deltaLine, deltaStartChar, length, tokenType, tokenModifiers]
- deltaLine: line offset from previous token (or from line 0 for first token)
- deltaStartChar: character offset from previous token's start on same line, or from character 0 if on a different line
Equations
- One or more equations did not get rendered due to their size.
Instances For
Build the SemanticTokens response
Instances For
Check if the builder has any tokens
Instances For
Get the number of tokens
Instances For
Semantic Tokens Options Builder #
Create a new options builder with standard legends
Equations
- One or more equations did not get rendered due to their size.
Instances For
Use custom token types
Equations
- b.withTokenTypes types = { tokenTypes := types, tokenModifiers := b.tokenModifiers, full := b.full, fullDelta := b.fullDelta, range := b.range }
Instances For
Use custom token modifiers
Equations
- b.withTokenModifiers modifiers = { tokenTypes := b.tokenTypes, tokenModifiers := modifiers, full := b.full, fullDelta := b.fullDelta, range := b.range }
Instances For
Add custom token types to the standard list
Equations
- b.addTokenTypes types = { tokenTypes := b.tokenTypes ++ types, tokenModifiers := b.tokenModifiers, full := b.full, fullDelta := b.fullDelta, range := b.range }
Instances For
Add custom token modifiers to the standard list
Equations
- b.addTokenModifiers modifiers = { tokenTypes := b.tokenTypes, tokenModifiers := b.tokenModifiers ++ modifiers, full := b.full, fullDelta := b.fullDelta, range := b.range }
Instances For
Enable full document semantic tokens
Equations
- b.enableFull delta = { tokenTypes := b.tokenTypes, tokenModifiers := b.tokenModifiers, full := true, fullDelta := delta, range := b.range }
Instances For
Disable full document semantic tokens
Equations
- b.disableFull = { tokenTypes := b.tokenTypes, tokenModifiers := b.tokenModifiers, full := false, fullDelta := false, range := b.range }
Instances For
Enable range-based semantic tokens
Equations
- b.enableRange = { tokenTypes := b.tokenTypes, tokenModifiers := b.tokenModifiers, full := b.full, fullDelta := b.fullDelta, range := true }
Instances For
Disable range-based semantic tokens
Equations
- b.disableRange = { tokenTypes := b.tokenTypes, tokenModifiers := b.tokenModifiers, full := b.full, fullDelta := b.fullDelta, range := false }
Instances For
Build the SemanticTokensOptions
Equations
- One or more equations did not get rendered due to their size.
Instances For
Convenience Functions #
Create default SemanticTokensOptions with full document support
Equations
Instances For
Create SemanticTokensOptions with full and range support
Equations
Instances For
Create SemanticTokensOptions with delta support
Equations
Instances For
Create an empty SemanticTokens response
Instances For
Method name for full semantic tokens request
Equations
Instances For
Method name for delta semantic tokens request
Equations
Instances For
Method name for range semantic tokens request
Equations
Instances For
Method name for semantic tokens refresh request