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.

    • localInstances : LocalInstances
    • 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

      Determines whether docstring suggestions are to be provided as part of editing the string or in a later report.

      • interactive : SuggestionMode

        The user is currently editing the doc comment and can react to suggestions as code actions.

      • batch : SuggestionMode

        The user is not editing the doc comment, and should receive suggestions as summaries.

      Instances For

        Context used as a reader in DocM.

        • suggestionMode : SuggestionMode

          Whether suggestions should be provided interactively.

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

          The monad in which documentation is elaborated.

          Instances For

            Runs a documentation elaborator in the module docstring context.

            Instances For
              def Lean.Doc.DocM.exec {α : Type} (declName : Name) (binders : Syntax) (act : DocM α) (suggestionMode : SuggestionMode := SuggestionMode.interactive) :

              Runs a documentation elaborator in a declaration's context, discarding changes made to the environment.

              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.

                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.

                  Instances For

                    An argument provided to a docstring extension

                    Instances For

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

                      Instances For

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

                        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
                              @[implicit_reducible]
                              @[implicit_reducible]
                              @[implicit_reducible]
                              @[implicit_reducible]
                              @[implicit_reducible]
                              @[implicit_reducible]
                              @[implicit_reducible]
                              @[implicit_reducible]
                              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.

                              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.

                                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.

                                  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.

                                    Instances For

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

                                      Instances For

                                        Environment extension for code suggestions

                                        Environment extension for code block suggestions

                                        Environment extension for docstring roles

                                        @[reducible, inline]

                                        An expander for roles in docstrings.

                                        Instances For
                                          @[reducible, inline]

                                          An expander for commands in docstrings.

                                          Instances For
                                            @[reducible, inline]

                                            An expander for directives in docstrings.

                                            Instances For
                                              @[reducible, inline]

                                              An expander for code blocks in docstrings.

                                              Instances For

                                                Built-in docstring roles, for bootstrapping.

                                                Environment extension for docstring roles

                                                Built-in docstring code blocks, for bootstrapping.

                                                Environment extension for docstring directives

                                                Built-in docstring directives, for bootstrapping.

                                                Environment extension for docstring commands

                                                Built-in docstring commands, for bootstrapping.

                                                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
                                                  @[reducible, inline]

                                                  A provider of suggestions for code elements.

                                                  Instances For

                                                    Built-in code suggestions, for bootstrapping

                                                    Adds a builtin documentation code suggestion provider.

                                                    Should be run during initialization.

                                                    Instances For
                                                      def Lean.Doc.addBuiltinDocRole (roleName wrapperName : Name) (impl : DocRoleExpander) :

                                                      Adds a builtin documentation role.

                                                      Should be run during initialization.

                                                      Instances For

                                                        Adds a builtin documentation code block.

                                                        Should be run during initialization.

                                                        Instances For

                                                          A suggestion about an applicable code block

                                                          • name : Name

                                                            The name of the code block to suggest.

                                                          • args : Option String

                                                            The arguments it should receive, as a string.

                                                          • moreInfo : Option String

                                                            More information to show users

                                                          Instances For
                                                            @[reducible, inline]

                                                            A provider of suggestions for code elements.

                                                            Instances For

                                                              Built-in code block suggestions, for bootstrapping

                                                              Adds a builtin documentation code suggestion provider.

                                                              Should be run during initialization.

                                                              Instances For
                                                                def Lean.Doc.addBuiltinDocDirective (directiveName wrapper : Name) (impl : DocDirectiveExpander) :

                                                                Adds a builtin documentation directive.

                                                                Should be run during initialization.

                                                                Instances For
                                                                  def Lean.Doc.addBuiltinDocCommand (commandName wrapper : Name) (impl : DocCommandExpander) :

                                                                  Adds a builtin documentation command.

                                                                  Should be run during initialization.

                                                                  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.

                                                                    Instances For
                                                                      def Lean.Doc.elabModSnippet (range : DeclarationRange) (blocks : TSyntaxArray `block) (nestingLevel : Nat) :

                                                                      Elaborates a sequence of blocks into a module doc snippet.

                                                                      Instances For