diff options
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 252d1ba3e..8e859e8d4 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -8,7 +8,7 @@ use languageserver_types::{ | |||
8 | PrepareRenameResponse, RenameParams, SymbolInformation, TextDocumentIdentifier, TextEdit, | 8 | PrepareRenameResponse, RenameParams, SymbolInformation, TextDocumentIdentifier, TextEdit, |
9 | WorkspaceEdit, ParameterInformation, ParameterLabel, SignatureInformation, Hover, HoverContents, | 9 | WorkspaceEdit, ParameterInformation, ParameterLabel, SignatureInformation, Hover, HoverContents, |
10 | }; | 10 | }; |
11 | use ra_analysis::{FileId, FoldKind, Query, RunnableKind, FilePosition}; | 11 | use ra_analysis::{FileId, FoldKind, Query, RunnableKind, FilePosition, Severity}; |
12 | use ra_syntax::{TextUnit, text_utils::intersect}; | 12 | use ra_syntax::{TextUnit, text_utils::intersect}; |
13 | use ra_text_edit::text_utils::contains_offset_nonstrict; | 13 | use ra_text_edit::text_utils::contains_offset_nonstrict; |
14 | use rustc_hash::FxHashMap; | 14 | use rustc_hash::FxHashMap; |
@@ -650,7 +650,7 @@ pub fn publish_diagnostics( | |||
650 | .into_iter() | 650 | .into_iter() |
651 | .map(|d| Diagnostic { | 651 | .map(|d| Diagnostic { |
652 | range: d.range.conv_with(&line_index), | 652 | range: d.range.conv_with(&line_index), |
653 | severity: Some(DiagnosticSeverity::Error), | 653 | severity: d.severity.map(to_diagnostic_severity), |
654 | code: None, | 654 | code: None, |
655 | source: Some("rust-analyzer".to_string()), | 655 | source: Some("rust-analyzer".to_string()), |
656 | message: d.message, | 656 | message: d.message, |
@@ -684,3 +684,14 @@ fn highlight(world: &ServerWorld, file_id: FileId) -> Result<Vec<Decoration>> { | |||
684 | .collect(); | 684 | .collect(); |
685 | Ok(res) | 685 | Ok(res) |
686 | } | 686 | } |
687 | |||
688 | fn to_diagnostic_severity(severity: Severity) -> DiagnosticSeverity { | ||
689 | use ra_analysis::Severity::*; | ||
690 | |||
691 | match severity { | ||
692 | Error => DiagnosticSeverity::Error, | ||
693 | Warning => DiagnosticSeverity::Warning, | ||
694 | Information => DiagnosticSeverity::Information, | ||
695 | Hint => DiagnosticSeverity::Hint, | ||
696 | } | ||
697 | } | ||