Documentation

Lean.Server.FileWorker.SemanticHighlighting

SyntaxNodeKinds for which the syntax node and its children receive no semantic highlighting.

Equations
    Instances For

      Keywords for which a specific semantic token is provided.

      Equations
        Instances For

          Semantic token information for a given Syntax.

          • stx : Syntax

            Syntax of the semantic token.

          • Type of the semantic token.

          • priority : Nat

            In case of overlap, higher-priority tokens will take precendence

          Instances For

            Semantic token information with absolute LSP positions.

            • Start position of the semantic token.

            • tailPos : Lsp.Position

              End position of the semantic token.

            • Start position of the semantic token.

            • priority : Nat

              In case of overlap, higher-priority tokens will take precendence

            Instances For

              Given a set of LeanSemanticToken, computes the AbsoluteLspSemanticToken with absolute LSP position information for each token.

              Equations
                Instances For

                  Eliminates overlapping tokens by selecting a single “best” token for each interval between token boundaries.

                  While LSP allows clients to state they they can handle overlapping tokens, widely used clients such as VS Code cannot handle them. Thus, we need to make them non-overlapping (this strictly generalizes removal of duplicates).

                  Given tokens A, B, C, D as in:

                  |-----A------|  |----D----|
                      |------B----------|
                          |----C----|
                  

                  with priorities C > B, B > A, B > D, we want to emit the tokens:

                  |-A-|-B-|----C----|-B-|-D--|
                  

                  In other words, B is split into two regions: before and after C.

                  If two overlapping tokens have the same priority, then ties are broken as follows:

                  • If the tokens start at the same position, then the shorter one is used.
                  • If they have the same start position and are the same length, then the one that occurs later in the original input array is used.
                  • If a new token starts in the middle of an existing one, and they have the same priority, then the new token is used.

                  Callers should ensure that all tokens in tokens designate non-empty regions of the file. In other words, it should be true that ∀ t ∈ tokens, t.pos < t.tailPos.

                  Equations
                    Instances For

                      Collects all semantic tokens that can be deduced purely from Syntax without elaboration information.

                      Collects all semantic tokens from the given Elab.InfoTree.

                      Equations
                        Instances For

                          A debugging utility for inspecting sets of collected tokens, classified by line and sorted by column.

                          Equations
                            Instances For

                              Computes the semantic tokens in the range provided by p.

                              Equations
                                Instances For