[−][src]Struct rslint_core::Diagnostic
A diagnostic message that can give information like errors or warnings.
Fields
file_id: usize
severity: Severity
code: Option<String>
title: String
tag: Option<DiagnosticTag>
primary: Option<SubDiagnostic>
children: Vec<SubDiagnostic>
suggestions: Vec<CodeSuggestion>
Implementations
impl Diagnostic
[src]
pub fn error(
file_id: usize,
code: impl Into<String>,
title: impl Into<String>
) -> Diagnostic
[src]
file_id: usize,
code: impl Into<String>,
title: impl Into<String>
) -> Diagnostic
Creates a new Diagnostic
with the Error
severity.
pub fn warning(
file_id: usize,
code: impl Into<String>,
title: impl Into<String>
) -> Diagnostic
[src]
file_id: usize,
code: impl Into<String>,
title: impl Into<String>
) -> Diagnostic
Creates a new Diagnostic
with the Warning
severity.
pub fn help(
file_id: usize,
code: impl Into<String>,
title: impl Into<String>
) -> Diagnostic
[src]
file_id: usize,
code: impl Into<String>,
title: impl Into<String>
) -> Diagnostic
Creates a new Diagnostic
with the Help
severity.
pub fn note(
file_id: usize,
code: impl Into<String>,
title: impl Into<String>
) -> Diagnostic
[src]
file_id: usize,
code: impl Into<String>,
title: impl Into<String>
) -> Diagnostic
Creates a new Diagnostic
with the Note
severity.
pub fn new(
file_id: usize,
severity: Severity,
title: impl Into<String>
) -> Diagnostic
[src]
file_id: usize,
severity: Severity,
title: impl Into<String>
) -> Diagnostic
Creates a new Diagnostic
that will be used in a builder-like way
to modify labels, and suggestions.
pub fn new_with_code(
file_id: usize,
severity: Severity,
title: impl Into<String>,
code: Option<String>
) -> Diagnostic
[src]
file_id: usize,
severity: Severity,
title: impl Into<String>,
code: Option<String>
) -> Diagnostic
Creates a new Diagnostic
with an error code that will be used in a builder-like way
to modify labels, and suggestions.
pub fn severity(self, severity: Severity) -> Diagnostic
[src]
Overwrites the severity of this diagnostic.
pub fn deprecated(self) -> Diagnostic
[src]
Marks this diagnostic as deprecated code, which will be displayed in the language server.
This does not have any influence on the diagnostic rendering.
pub fn unnecessary(self) -> Diagnostic
[src]
Marks this diagnostic as unnecessary code, which will be displayed in the language server.
This does not have any influence on the diagnostic rendering.
pub fn label_in_file(
self,
severity: Severity,
span: FileSpan,
msg: String
) -> Diagnostic
[src]
self,
severity: Severity,
span: FileSpan,
msg: String
) -> Diagnostic
Attaches a label to this Diagnostic
, that will point to another file
that is provided.
pub fn label(
self,
severity: Severity,
span: impl Span,
msg: impl Into<String>
) -> Diagnostic
[src]
self,
severity: Severity,
span: impl Span,
msg: impl Into<String>
) -> Diagnostic
Attaches a label to this Diagnostic
.
The given span has to be in the file that was provided while creating this Diagnostic
.
pub fn primary(self, span: impl Span, msg: impl Into<String>) -> Diagnostic
[src]
Attaches a primary label to this Diagnostic
.
pub fn secondary(self, span: impl Span, msg: impl Into<String>) -> Diagnostic
[src]
Attaches a secondary label to this Diagnostic
.
pub fn suggestion_in_file(
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability,
file: usize
) -> Diagnostic
[src]
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability,
file: usize
) -> 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.
pub fn suggestion(
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability
) -> Diagnostic
[src]
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability
) -> Diagnostic
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.
pub fn suggestion_full(
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability
) -> Diagnostic
[src]
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability
) -> Diagnostic
Add a suggestion which is always shown in the Full style.
pub fn suggestion_inline(
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability
) -> Diagnostic
[src]
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability
) -> Diagnostic
Add a suggestion which is always shown in the Inline style.
pub fn suggestion_no_code(
self,
span: impl Span,
msg: &str,
applicability: Applicability
) -> Diagnostic
[src]
self,
span: impl Span,
msg: &str,
applicability: Applicability
) -> Diagnostic
Add a suggestion which does not have a suggestion code.
pub fn indel_suggestion(
self,
indels: impl IntoIterator<Item = Indel>,
span: impl Span,
msg: &str,
applicability: Applicability
) -> Diagnostic
[src]
self,
indels: impl IntoIterator<Item = Indel>,
span: impl Span,
msg: &str,
applicability: Applicability
) -> Diagnostic
pub fn suggestion_with_labels(
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability,
labels: impl IntoIterator<Item = impl Span>
) -> Diagnostic
[src]
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability,
labels: impl IntoIterator<Item = impl Span>
) -> Diagnostic
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
pub fn suggestion_with_src_labels(
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability,
labels: impl IntoIterator<Item = impl Span>
) -> Diagnostic
[src]
self,
span: impl Span,
msg: &str,
suggestion: impl Into<String>,
applicability: Applicability,
labels: impl IntoIterator<Item = impl Span>
) -> Diagnostic
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
pub fn footer(self, severity: Severity, msg: impl Into<String>) -> Diagnostic
[src]
Adds a footer to this Diagnostic
, which will be displayed under the actual error.
pub fn footer_help(self, msg: impl Into<String>) -> Diagnostic
[src]
Adds a footer to this Diagnostic
, with the Help
severity.
pub fn footer_note(self, msg: impl Into<String>) -> Diagnostic
[src]
Adds a footer to this Diagnostic
, with the Note
severity.
Trait Implementations
impl Clone for Diagnostic
[src]
fn clone(&self) -> Diagnostic
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Diagnostic
[src]
impl From<ErrorBuilder> for Diagnostic
[src]
fn from(builder: ErrorBuilder) -> Diagnostic
[src]
impl Hash for Diagnostic
[src]
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Diagnostic> for Diagnostic
[src]
fn eq(&self, other: &Diagnostic) -> bool
[src]
fn ne(&self, other: &Diagnostic) -> bool
[src]
impl StructuralPartialEq for Diagnostic
[src]
Auto Trait Implementations
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin for Diagnostic
impl UnwindSafe for Diagnostic
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
fn __clone_box(&self, Private) -> *mut ()
[src]
impl<T> Erasable for T
unsafe fn unerase(this: NonNull<Erased>) -> NonNull<T>
const ACK_1_1_0: bool
fn erase(this: NonNull<Self>) -> NonNull<Erased>
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,