From 346638c8098fefd0b6fa3cf81fbdf22ebfaab9be Mon Sep 17 00:00:00 2001 From: gfreezy Date: Mon, 24 Dec 2018 00:39:33 +0800 Subject: add serverity to vscode diagnostics --- crates/ra_analysis/src/imp.rs | 5 ++++- crates/ra_analysis/src/lib.rs | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index b01382808..e054227a9 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -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::>(); @@ -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), } } diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 85df9c089..8ab6334a7 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -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, + pub severity: Option, } #[derive(Debug)] -- cgit v1.2.3 From 17b35a7f7dc5054f8d632cd4d3fc2fcb26879819 Mon Sep 17 00:00:00 2001 From: gfreezy Date: Mon, 24 Dec 2018 00:40:36 +0800 Subject: remove unnecessary braces in use statments --- crates/ra_analysis/src/lib.rs | 4 +--- crates/ra_analysis/src/mock_analysis.rs | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index 8ab6334a7..a213fd60f 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -29,9 +29,7 @@ use crate::{ symbol_index::SymbolIndex, }; -pub use crate::{ - completion::{CompletionItem, CompletionItemKind, InsertText}, -}; +pub use crate::completion::{CompletionItem, CompletionItemKind, InsertText}; pub use ra_editor::{ FileSymbol, Fold, FoldKind, HighlightedRange, LineIndex, Runnable, RunnableKind, StructureNode, Severity diff --git a/crates/ra_analysis/src/mock_analysis.rs b/crates/ra_analysis/src/mock_analysis.rs index 7cbdfb953..5ce2aa2b4 100644 --- a/crates/ra_analysis/src/mock_analysis.rs +++ b/crates/ra_analysis/src/mock_analysis.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use relative_path::{RelativePathBuf}; +use relative_path::RelativePathBuf; use test_utils::{extract_offset, parse_fixture, CURSOR_MARKER}; use ra_db::mock::FileMap; -- cgit v1.2.3 From 70df097c89ee45e4e0709c21b8aeee2e84e09fc4 Mon Sep 17 00:00:00 2001 From: gfreezy Date: Mon, 24 Dec 2018 22:48:46 +0800 Subject: keep severity to Error & WeakWarning --- crates/ra_analysis/src/imp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index e054227a9..e8d6acc17 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -364,7 +364,7 @@ impl AnalysisImpl { .map(|d| Diagnostic { range: d.range, message: d.msg, - severity: d.severity, + severity: Some(d.severity), fix: None, }) .collect::>(); -- cgit v1.2.3 From 29798c763cc121f7d610544deb940d70e4e33649 Mon Sep 17 00:00:00 2001 From: gfreezy Date: Mon, 24 Dec 2018 23:00:18 +0800 Subject: remove option from Diagnostic --- crates/ra_analysis/src/imp.rs | 6 +++--- crates/ra_analysis/src/lib.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_analysis/src') diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index e8d6acc17..00cdf7eff 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs @@ -364,7 +364,7 @@ impl AnalysisImpl { .map(|d| Diagnostic { range: d.range, message: d.msg, - severity: Some(d.severity), + severity: d.severity, fix: None, }) .collect::>(); @@ -386,7 +386,7 @@ impl AnalysisImpl { Diagnostic { range: name_node.range(), message: "unresolved module".to_string(), - severity: Some(Severity::Error), + severity: Severity::Error, fix: Some(fix), } } @@ -409,7 +409,7 @@ impl AnalysisImpl { Diagnostic { range: name_node.range(), message: "can't declare module at this location".to_string(), - severity: Some(Severity::Error), + severity: Severity::Error, fix: Some(fix), } } diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index a213fd60f..fbb19ed6b 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs @@ -197,7 +197,7 @@ pub struct Diagnostic { pub message: String, pub range: TextRange, pub fix: Option, - pub severity: Option, + pub severity: Severity, } #[derive(Debug)] -- cgit v1.2.3