diff options
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index a6dc1f964..686ee5d12 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -3,13 +3,13 @@ use std::{fmt::Write as _, io::Write as _}; | |||
3 | use gen_lsp_server::ErrorCode; | 3 | use gen_lsp_server::ErrorCode; |
4 | use lsp_types::{ | 4 | use lsp_types::{ |
5 | CodeAction, CodeActionResponse, CodeLens, Command, CompletionItem, Diagnostic, | 5 | CodeAction, CodeActionResponse, CodeLens, Command, CompletionItem, Diagnostic, |
6 | DiagnosticSeverity, DocumentFormattingParams, DocumentHighlight, DocumentSymbol, FoldingRange, | 6 | DocumentFormattingParams, DocumentHighlight, DocumentSymbol, FoldingRange, FoldingRangeKind, |
7 | FoldingRangeKind, FoldingRangeParams, Hover, HoverContents, Location, MarkupContent, | 7 | FoldingRangeParams, Hover, HoverContents, Location, MarkupContent, MarkupKind, Position, |
8 | MarkupKind, Position, PrepareRenameResponse, Range, RenameParams, SymbolInformation, | 8 | PrepareRenameResponse, Range, RenameParams, SymbolInformation, TextDocumentIdentifier, |
9 | TextDocumentIdentifier, TextEdit, WorkspaceEdit, | 9 | TextEdit, WorkspaceEdit, |
10 | }; | 10 | }; |
11 | use ra_ide_api::{ | 11 | use ra_ide_api::{ |
12 | AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity, | 12 | AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, |
13 | }; | 13 | }; |
14 | use ra_prof::profile; | 14 | use ra_prof::profile; |
15 | use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit}; | 15 | use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit}; |
@@ -838,7 +838,7 @@ pub fn publish_diagnostics( | |||
838 | .into_iter() | 838 | .into_iter() |
839 | .map(|d| Diagnostic { | 839 | .map(|d| Diagnostic { |
840 | range: d.range.conv_with(&line_index), | 840 | range: d.range.conv_with(&line_index), |
841 | severity: Some(to_diagnostic_severity(d.severity)), | 841 | severity: Some(d.severity.conv()), |
842 | code: None, | 842 | code: None, |
843 | source: Some("rust-analyzer".to_string()), | 843 | source: Some("rust-analyzer".to_string()), |
844 | message: d.message, | 844 | message: d.message, |
@@ -871,15 +871,6 @@ fn highlight(world: &WorldSnapshot, file_id: FileId) -> Result<Vec<Decoration>> | |||
871 | Ok(res) | 871 | Ok(res) |
872 | } | 872 | } |
873 | 873 | ||
874 | fn to_diagnostic_severity(severity: Severity) -> DiagnosticSeverity { | ||
875 | use ra_ide_api::Severity::*; | ||
876 | |||
877 | match severity { | ||
878 | Error => DiagnosticSeverity::Error, | ||
879 | WeakWarning => DiagnosticSeverity::Hint, | ||
880 | } | ||
881 | } | ||
882 | |||
883 | pub fn handle_inlay_hints( | 874 | pub fn handle_inlay_hints( |
884 | world: WorldSnapshot, | 875 | world: WorldSnapshot, |
885 | params: InlayHintsParams, | 876 | params: InlayHintsParams, |