Documentation

Lean.Data.Lsp.Diagnostics

Definitions and functionality for emitting diagnostic information such as errors, warnings and #command outputs from the LSP server.

LSP: Diagnostic; LSP: textDocument/publishDiagnostics

Some languages have specific codes for each error type.

Instances For

    Tags representing additional metadata about the diagnostic.

    • unnecessary : DiagnosticTag

      Unused or unnecessary code. Rendered as faded out eg for unused variables.

    • deprecated : DiagnosticTag

      Deprecated or obsolete code. Rendered with a strike-through.

    Instances For
      @[implicit_reducible]
      @[implicit_reducible]

      Custom diagnostic tags provided by the language server. We use a separate diagnostic field for this to avoid confusing LSP clients with our custom tags.

      • unsolvedGoals : LeanDiagnosticTag

        Diagnostics representing an "unsolved goals" error. Corresponds to MessageData.tagged Tactic.unsolvedGoals ..`.

      • goalsAccomplished : LeanDiagnosticTag

        Diagnostics representing a "goals accomplished" silent message. Corresponds to MessageData.tagged goalsAccomplished ..`.

      Instances For

        Represents a related message and source code location for a diagnostic. This should be used to point to code locations that cause or are related to a diagnostics, e.g when duplicating a symbol in a scope.

        Instances For

          Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only valid in the scope of a resource.

          LSP accepts a Diagnostic := DiagnosticWith String. The infoview also accepts InteractiveDiagnostic := DiagnosticWith InteractiveMessage.

          reference

          • range : Range

            The range at which the message applies.

          • fullRange? : Option Range

            Extension: preserve semantic range of errors when truncating them for display purposes.

          • isSilent? : Option Bool

            Extension: whether this diagnostic should not be displayed as a regular diagnostic in the editor. In VS Code, this means that the diagnostic does not have a squiggly and is not displayed in the InfoView under 'All Messages', but it is still displayed under 'Messages'. Defaults to false.

          • The diagnostic's code, which might appear in the user interface.

          • source? : Option String

            A human-readable string describing the source of this diagnostic, e.g. 'typescript' or 'super lint'.

          • message : α

            Parametrised by the type of message data. LSP diagnostics use String, whereas in Lean's interactive diagnostics we use the type of widget-enriched text. See Lean.Widget.InteractiveDiagnostic.

          • Additional metadata about the diagnostic.

          • Additional Lean-specific metadata about the diagnostic.

          • relatedInformation? : Option (Array DiagnosticRelatedInformation)

            An array of related diagnostic information, e.g. when symbol-names within a scope collide all definitions can be marked via this property.

          • data? : Option Json

            A data entry field that is preserved between a textDocument/publishDiagnostics notification and textDocument/codeAction request.

          Instances For
            @[implicit_reducible]
            Instances For
              @[implicit_reducible]
              instance Lean.Lsp.instBEqDiagnosticWith {α✝ : Type} [BEq α✝] :
              Instances For
                @[implicit_reducible]
                @[implicit_reducible]
                @[reducible, inline]
                Instances For

                  Parameters for the textDocument/publishDiagnostics notification.

                  • version? : Option Int
                  • isIncremental? : Option Bool

                    Whether the client should append this set of diagnostics to the previous set rather than replacing the previous set by this one (the default LSP behavior). false means the client should replace. none is equivalent to false. This is a Lean-specific extension (see LeanClientCapabilities).

                  • diagnostics : Array Diagnostic
                  Instances For