add serverity to vscode diagnostics

This commit is contained in:
gfreezy 2018-12-24 00:39:33 +08:00
parent 000aacafda
commit 346638c809
5 changed files with 32 additions and 12 deletions

View file

@ -3,7 +3,7 @@ use std::{
sync::Arc,
};
use ra_editor::{self, find_node_at_offset, FileSymbol, LineIndex, LocalEdit};
use ra_editor::{self, find_node_at_offset, FileSymbol, LineIndex, LocalEdit, Severity};
use ra_syntax::{
ast::{self, ArgListOwner, Expr, NameOwner},
AstNode, SourceFileNode,
@ -364,6 +364,7 @@ impl AnalysisImpl {
.map(|d| Diagnostic {
range: d.range,
message: d.msg,
severity: d.severity,
fix: None,
})
.collect::<Vec<_>>();
@ -385,6 +386,7 @@ impl AnalysisImpl {
Diagnostic {
range: name_node.range(),
message: "unresolved module".to_string(),
severity: Some(Severity::Error),
fix: Some(fix),
}
}
@ -407,6 +409,7 @@ impl AnalysisImpl {
Diagnostic {
range: name_node.range(),
message: "can't declare module at this location".to_string(),
severity: Some(Severity::Error),
fix: Some(fix),
}
}

View file

@ -34,6 +34,7 @@ pub use crate::{
};
pub use ra_editor::{
FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, RunnableKind, StructureNode,
Severity
};
pub use hir::FnSignatureInfo;
@ -198,6 +199,7 @@ pub struct Diagnostic {
pub message: String,
pub range: TextRange,
pub fix: Option<SourceChange>,
pub severity: Option<Severity>,
}
#[derive(Debug)]