public class CodeDiagnostic
- Object
- CodeDiagnostic
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.
Fields
public static final String ERROR = "error" | Severity for a problem that should block / is an error. |
public static final String WARNING = "warning" | Severity for a non-blocking warning. |
public static final String INFO = "info" | Severity for purely informational hints. |
Constructors
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. |
public CodeDiagnostic(int line, int column, int endLine, int endColumn, String message) | Creates a diagnostic spanning an explicit range. |
Methods
public int getLine() | The 1-based start line. |
public int getColumn() | The 1-based start column. |
public int getEndLine() | The 1-based end line. |
public int getEndColumn() | The 1-based end column (exclusive). |
public String getSeverity() | The severity, one of #ERROR, #WARNING or #INFO. |
public CodeDiagnostic setSeverity(String severity) | Sets the severity. |
public String getMessage() | The message shown in the tooltip. |
Inherited methods
Field details
ERROR
public static final String ERROR = "error"Severity for a problem that should block / is an error.
WARNING
public static final String WARNING = "warning"Severity for a non-blocking warning.
INFO
public static final String INFO = "info"Severity for purely informational hints.
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
lineint- the 1-based line
columnint- the 1-based start column
messageString- 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
lineint- the 1-based start line
columnint- the 1-based start column
endLineint- the 1-based end line
endColumnint- the 1-based end column (exclusive)
messageString- 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
severityString- one of
#ERROR,#WARNING,#INFO
getMessage
public String getMessage()The message shown in the tooltip.