Documentation

Lean.Elab.DocString

The internal state used by docstring elaboration

Instances For
    structure Lean.Doc.State :

    The state used by DocM.

    • The command elaboration scope stack.

      These scopes are used when running commands inside of documentation. To keep examples self-contained, these scopes are initialized for each doc comment as if it were the beginning of a Lean file.

    • openDecls : List OpenDecl

      The set of open declarations presently in force.

      The MonadLift TermElabM DocM instance runs the lifted action in a context where these open declarations are used, so elaboration commands that mutate this state cause it to take effect in subsequent commands.

    • The local context.

      The MonadLift TermElabM DocM instance runs the lifted action in this context, so elaboration commands that mutate this state cause it to take effect in subsequent commands.

    • options : Options

      The options.

      The MonadLift TermElabM DocM instance runs the lifted action with these options, so elaboration commands that mutate this state cause it to take effect in subsequent commands.

    Instances For
      @[reducible, inline]
      abbrev Lean.Doc.DocM (α : Type) :

      The monad in which documentation is elaborated.

      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.
        def Lean.Doc.DocM.exec {α : Type} (declName : Name) (binders : Syntax) (act : DocM α) :

        Runs a documentation elaborator, discarding changes made to the environment.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[reducible, inline]
          abbrev Lean.Doc.flag (default : Bool) :

          Gadget that indicates that a function's parameter should be treated as a Boolean flag when used in a docstring extension.

          Equations
          Instances For
            @[reducible, inline]
            abbrev Lean.Doc.many (α : Type u) :

            Gadget that indicates that a function's parameter should be treated as a repeated (and thus optional) named argument when used in a docstring extension.

            Equations
            Instances For

              An argument provided to a docstring extension

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

                Returns the syntax from which a documentation argument was drawn, typically used to report errors.

                Equations
                Instances For

                  Converts the syntax of a documentation argument into a suitable value.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    structure Lean.Doc.WithSyntax (α : Type u) :

                    A value paired with the syntax it is derived from.

                    This can be used to provide hints and code actions.

                    • val : α

                      The parsed value.

                    • stx : Syntax

                      The syntax that the value was derived from.

                    Instances For

                      A canonical way to convert a documentation extension's argument into a Lean value of type α.

                      • fromDocArg : DocArgElab.TermElabM α

                        Converts a documentation extension's argument into a Lean value.

                      Instances
                        def Lean.Doc.getPositional {α : Type} [FromDocArg α] (name : Name) :
                        StateT (Array (TSyntax `doc_arg)) DocM α

                        Retrieves the next positional argument from the arguments to a documentation extension. Throws an error if no positional arguments remain.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def Lean.Doc.getNamed {α : Type} [FromDocArg α] (name : Name) (default : α) :
                          StateT (Array (TSyntax `doc_arg)) DocM α

                          Retrieves a named argument from the arguments to a documentation extension. Returns default if no such named argument was provided.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            def Lean.Doc.getMany {α : Type} [FromDocArg α] (name : Name) :
                            StateT (Array (TSyntax `doc_arg)) DocM (Array α)

                            Retrieves a repeated named argument from the arguments to a documentation extension.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              def Lean.Doc.getFlag (name : Name) (default : Bool) :

                              Retrieves a flag from the arguments to a documentation extension. Returns default if the flag is not explicit set.

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

                                Asserts that there are no further arguments to a documentation language extension.

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

                                  A suggestion about an applicable role

                                  • role : Name

                                    The name of the role to suggest.

                                  • args : Option String

                                    The arguments it should receive, as a string.

                                  • moreInfo : Option String

                                    More information to show users

                                  Instances For

                                    Adds a builtin documentation code suggestion provider.

                                    Should be run during initialization.

                                    Equations
                                    Instances For
                                      def Lean.Doc.addBuiltinDocRole (roleName wrapper : Name) :

                                      Adds a builtin documentation role.

                                      Should be run during initialization.

                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        def Lean.Doc.addBuiltinDocCodeBlock (blockName wrapper : Name) :

                                        Adds a builtin documentation code block.

                                        Should be run during initialization.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          def Lean.Doc.addBuiltinDocDirective (directiveName wrapper : Name) :

                                          Adds a builtin documentation directive.

                                          Should be run during initialization.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            def Lean.Doc.addBuiltinDocCommand (commandName wrapper : Name) :

                                            Adds a builtin documentation command.

                                            Should be run during initialization.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              partial def Lean.Doc.elabInline (stx : TSyntax `inline) :

                                              Elaborates the syntax of an inline document element to an actual inline document element.

                                              Elaborates the syntax of an block-level document element to an actual block-level document element.

                                              Elaborates a sequence of blocks into a document

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