Documentation

Lean.Server.Requests

Finds the first (in pre-order) snapshot task in tree whose range? contains pos and which contains an info tree, and then returns that info tree, waiting for any snapshot tasks on the way. Subtrees that do not contain the position are skipped without forcing their tasks.

Instances For
    Equations
    Instances For
      Equations
      Instances For
        Equations
        Instances For
          def Lean.Server.parseRequestParams (paramType : Type) [FromJson paramType] (params : Json) :
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            @[reducible, inline]
            abbrev Lean.Server.RequestTask (α : Type u_1) :
            Type u_1
            Equations
            Instances For
              @[reducible, inline]
              abbrev Lean.Server.RequestT (m : TypeType u_1) (α : Type) :
              Type u_1
              Equations
              Instances For
                @[reducible, inline]

                Workers execute request handlers in this monad.

                Equations
                Instances For
                  @[reducible, inline]
                  abbrev Lean.Server.RequestTask.pure {α : Type u_1} (a : α) :
                  Equations
                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Equations
                    Instances For
                      def Lean.Server.RequestM.mapTask {α : Type u_1} {β : Type} (t : Task α) (f : αRequestM β) :
                      Equations
                      Instances For
                        def Lean.Server.RequestM.bindTask {α : Type u_1} {β : Type} (t : Task α) (f : αRequestM (RequestTask β)) :
                        Equations
                        Instances For
                          Equations
                          Instances For

                            Create a task which waits for the first snapshot matching p, handles various errors, and if a matching snapshot was found executes x with it. If not found, the task executes notFoundX.

                            Equations
                            Instances For

                              Create a task which waits for the snapshot containing lspPos and executes f with it. If no such snapshot exists, the request fails with an error.

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

                                Finds the first CommandParsedSnapshot fulfilling p, asynchronously.

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

                                  Finds the info tree of the first snapshot task matching isMatchingSnapshot and containing pos, asynchronously. The info tree may be from a nested snapshot, such as a single tactic.

                                  See SnapshotTree.findInfoTreeAtPos for details on how the search is done.

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

                                    Finds the command syntax and info tree of the first snapshot task matching isMatchingSnapshot and containing pos, asynchronously. The info tree may be from a nested snapshot, such as a single tactic.

                                    See SnapshotTree.findInfoTreeAtPos for details on how the search is done.

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

                                      Finds the info tree of the first snapshot task containing pos (including trailing whitespace), asynchronously. The info tree may be from a nested snapshot, such as a single tactic.

                                      See SnapshotTree.findInfoTreeAtPos for details on how the search is done.

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

                                              The global request handlers table #

                                              We maintain a global map of LSP request handlers. This allows user code such as plugins to register its own handlers, for example to support ITP functionality such as goal state visualization.

                                              For details of how to register one, see registerLspRequestHandler.

                                              def Lean.Server.registerLspRequestHandler (method : String) (paramType : Type) [FromJson paramType] [Lsp.FileSource paramType] (respType : Type) [ToJson respType] (handler : paramTypeRequestM (RequestTask respType)) :

                                              NB: This method may only be called in initialize blocks (user or builtin).

                                              A registration consists of:

                                              • a type of JSON-parsable request data paramType
                                              • a FileSource instance for it so the system knows where to route requests
                                              • a type of JSON-serializable response data respType
                                              • an actual handler which runs in the RequestM monad and is expected to produce an asynchronous RequestTask which does any waiting/computation

                                              A handler task may be cancelled at any time, so it should check the cancellation token when possible to handle this cooperatively. Any exceptions thrown in a request handler will be reported to the client as LSP error responses.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                Equations
                                                Instances For
                                                  def Lean.Server.chainLspRequestHandler (method : String) (paramType : Type) [FromJson paramType] (respType : Type) [FromJson respType] [ToJson respType] (handler : paramTypeRequestTask respTypeRequestM (RequestTask respType)) :

                                                  NB: This method may only be called in initialize blocks (user or builtin).

                                                  Register another handler to invoke after the last one registered for a method. At least one handler for the method must have already been registered to perform chaining.

                                                  For more details on the registration of a handler, see registerLspRequestHandler.

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