diagnostics: Use Vec<Tag> instead of Option<Vec<Tag>>
This commit is contained in:
parent
64b0745413
commit
1df32c917c
3 changed files with 14 additions and 15 deletions
|
@ -43,6 +43,6 @@ pub struct Diagnostic {
|
|||
pub message: String,
|
||||
pub severity: Option<Severity>,
|
||||
pub code: Option<NumberOrString>,
|
||||
pub tags: Option<Vec<DiagnosticTag>>,
|
||||
pub tags: Vec<DiagnosticTag>,
|
||||
pub source: Option<String>,
|
||||
}
|
||||
|
|
|
@ -84,19 +84,18 @@ pub mod util {
|
|||
None => None,
|
||||
};
|
||||
|
||||
let tags = if let Some(ref tags) = diag.tags {
|
||||
let new_tags = tags
|
||||
.iter()
|
||||
.map(|tag| match tag {
|
||||
helix_core::diagnostic::DiagnosticTag::Unnecessary => {
|
||||
lsp::DiagnosticTag::UNNECESSARY
|
||||
}
|
||||
helix_core::diagnostic::DiagnosticTag::Deprecated => {
|
||||
lsp::DiagnosticTag::DEPRECATED
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
let new_tags: Vec<_> = diag
|
||||
.tags
|
||||
.iter()
|
||||
.map(|tag| match tag {
|
||||
helix_core::diagnostic::DiagnosticTag::Unnecessary => {
|
||||
lsp::DiagnosticTag::UNNECESSARY
|
||||
}
|
||||
helix_core::diagnostic::DiagnosticTag::Deprecated => lsp::DiagnosticTag::DEPRECATED,
|
||||
})
|
||||
.collect();
|
||||
|
||||
let tags = if !new_tags.is_empty() {
|
||||
Some(new_tags)
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -614,9 +614,9 @@ impl Application {
|
|||
}
|
||||
}).collect();
|
||||
|
||||
Some(new_tags)
|
||||
new_tags
|
||||
} else {
|
||||
None
|
||||
Vec::new()
|
||||
};
|
||||
|
||||
Some(Diagnostic {
|
||||
|
|
Loading…
Add table
Reference in a new issue