Documentation

Lapis.Server.SemanticTokens

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
      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
              Instances For

                Create a token from a SemanticTokenTypes enum

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  def Lapis.Server.SemanticTokens.Token.ofTypeIndex (line character length typeIndex : Nat) (modifierBits : Nat := 0) :

                  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 #

                    Builder for collecting tokens before encoding

                    Instances For

                      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
                            def Lapis.Server.SemanticTokens.TokenBuilder.pushRaw (b : TokenBuilder) (line character length typeIndex : Nat) (modifierBits : Nat := 0) :

                            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
                              Instances For

                                Add multiple tokens

                                Equations
                                Instances For

                                  Get the legend for capability registration

                                  Equations
                                  Instances For

                                    Sort tokens by position (required before encoding)

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    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

                                        Equations
                                        Instances For

                                          Check if the builder has any tokens

                                          Equations
                                          Instances For

                                            Get the number of tokens

                                            Equations
                                            Instances For

                                              Semantic Tokens Options Builder #

                                              Builder for creating SemanticTokensOptions

                                              Instances For

                                                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
                                                  Instances For

                                                    Use custom token modifiers

                                                    Equations
                                                    Instances For

                                                      Add custom token types to the standard list

                                                      Equations
                                                      Instances For

                                                        Add custom token modifiers to the standard list

                                                        Equations
                                                        Instances For

                                                          Enable full document semantic tokens

                                                          Equations
                                                          Instances For

                                                            Disable full document semantic tokens

                                                            Equations
                                                            Instances For

                                                              Enable range-based semantic tokens

                                                              Equations
                                                              Instances For

                                                                Disable range-based semantic tokens

                                                                Equations
                                                                Instances For

                                                                  Build the SemanticTokensOptions

                                                                  Equations
                                                                  • One or more equations did not get rendered due to their size.
                                                                  Instances For

                                                                    Convenience Functions #

                                                                    Create an empty SemanticTokens response

                                                                    Equations
                                                                    Instances For