Class CodeDiagnostic

java.lang.Object
com.codename1.ui.CodeDiagnostic

public class CodeDiagnostic extends Object

A diagnostic (error / warning / information) shown in a CodeEditor as a squiggly underline over a source range, a marker in the line-number gutter and a tooltip carrying the message.

Positions are 1-based: line 1 is the first line and column 1 is the first character of a line, matching the convention used by most compilers and language servers.

  • Field Details

  • Constructor Details

    • CodeDiagnostic

      public CodeDiagnostic(int line, int column, String message)

      Creates a single-position diagnostic that underlines from the given column to the end of the token / line.

      Parameters
      • line: the 1-based line

      • column: the 1-based start column

      • message: the human readable message

    • CodeDiagnostic

      public CodeDiagnostic(int line, int column, int endLine, int endColumn, String message)

      Creates a diagnostic spanning an explicit range.

      Parameters
      • line: the 1-based start line

      • column: the 1-based start column

      • endLine: the 1-based end line

      • endColumn: the 1-based end column (exclusive)

      • message: the human readable message

  • Method Details

    • getLine

      public int getLine()
      The 1-based start line.
    • getColumn

      public int getColumn()
      The 1-based start column.
    • getEndLine

      public int getEndLine()
      The 1-based end line.
    • getEndColumn

      public int getEndColumn()
      The 1-based end column (exclusive).
    • getSeverity

      public String getSeverity()
      The severity, one of #ERROR, #WARNING or #INFO.
    • setSeverity

      public CodeDiagnostic setSeverity(String severity)

      Sets the severity. Returns this for chaining.

      Parameters
      • severity: one of #ERROR, #WARNING, #INFO
    • getMessage

      public String getMessage()
      The message shown in the tooltip.