Struct rslint_core::Diagnostic[][src]

pub struct Diagnostic {
    pub file_id: usize,
    pub severity: Severity,
    pub code: Option<String>,
    pub title: String,
    pub tag: Option<DiagnosticTag>,
    pub primary: Option<SubDiagnostic>,
    pub children: Vec<SubDiagnostic, Global>,
    pub suggestions: Vec<CodeSuggestion, Global>,
    pub footers: Vec<Footer, Global>,
}
Expand description

A diagnostic message that can give information like errors or warnings.

Fields

file_id: usizeseverity: Severitycode: Option<String>title: Stringtag: Option<DiagnosticTag>primary: Option<SubDiagnostic>children: Vec<SubDiagnostic, Global>suggestions: Vec<CodeSuggestion, Global>footers: Vec<Footer, Global>

Implementations

Creates a new Diagnostic with the Error severity.

Creates a new Diagnostic with the Warning severity.

Creates a new Diagnostic with the Help severity.

Creates a new Diagnostic with the Note severity.

Creates a new Diagnostic that will be used in a builder-like way to modify labels, and suggestions.

Creates a new Diagnostic with an error code that will be used in a builder-like way to modify labels, and suggestions.

Overwrites the severity of this diagnostic.

Marks this diagnostic as deprecated code, which will be displayed in the language server.

This does not have any influence on the diagnostic rendering.

Marks this diagnostic as unnecessary code, which will be displayed in the language server.

This does not have any influence on the diagnostic rendering.

Attaches a label to this Diagnostic, that will point to another file that is provided.

Attaches a label to this Diagnostic.

The given span has to be in the file that was provided while creating this Diagnostic.

Attaches a primary label to this Diagnostic.

Attaches a secondary label to this Diagnostic.

Prints out a message that suggests a possible solution, that is in another file as this Diagnostic, to the error.

If the message plus the suggestion is longer than 25 chars, the suggestion is displayed as a new children of this Diagnostic, otherwise it will be inlined with the other labels.

A suggestion is displayed like:

try adding a `;`: console.log();

or in a separate multiline suggestion

The message should not contain the : because it’s added automatically. The suggestion will automatically be wrapped inside two backticks.

Prints out a message that suggests a possible solution to the error.

If the message plus the suggestion is longer than 25 chars, the suggestion is displayed as a new children of this Diagnostic, otherwise it will be inlined with the other labels.

A suggestion is displayed like:

try adding a `;`: console.log();

or in a separate multiline suggestion

The message should not contain the : because it’s added automatically. The suggestion will automatically be wrapped inside two backticks.

Add a suggestion which is always shown in the Full style.

Add a suggestion which is always shown in the Inline style.

Add a suggestion which does not have a suggestion code.

Add a suggestion with info labels which point to places in the suggestion.

The label ranges are relative to the start of the span, not relative to the original code

Add a suggestion with info labels which point to places in the suggestion.

The label ranges are relative to the source code, not relative to the original code

Adds a footer to this Diagnostic, which will be displayed under the actual error.

Adds a footer to this Diagnostic, with the Help severity.

Adds a footer to this Diagnostic, with the Note severity.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Unerase this erased pointer. Read more

Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more

Turn this erasable pointer into an erased pointer. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.