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

interface Diagnostic {
    code?: string | number;
    codeDescription?: CodeDescription;
    data?: any;
    message: string;
    range: Range;
    relatedInformation?: DiagnosticRelatedInformation[];
    severity?: DiagnosticSeverity;
    source?: string;
    tags?: DiagnosticTag[];
}

Properties

code?: string | number

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

codeDescription?: CodeDescription

An optional property to describe the error code. Requires the code field (above) to be present/not null.

3.16.0

data?: any

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

3.16.0

message: string

The diagnostic's message. It usually appears in the user interface

range: Range

The range at which the message applies

relatedInformation?: DiagnosticRelatedInformation[]

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

The diagnostic's severity. To avoid interpretation mismatches when a server is used with different clients it is highly recommended that servers always provide a severity value.

source?: string

A human-readable string describing the source of this diagnostic, e.g. 'typescript' or 'super lint'. It usually appears in the user interface.

tags?: DiagnosticTag[]

Additional metadata about the diagnostic.

3.15.0