diff options
Diffstat (limited to 'crates/ra_lsp_server/src/conv.rs')
-rw-r--r-- | crates/ra_lsp_server/src/conv.rs | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs index 59c5e1582..df8ea6e0d 100644 --- a/crates/ra_lsp_server/src/conv.rs +++ b/crates/ra_lsp_server/src/conv.rs | |||
@@ -1,13 +1,13 @@ | |||
1 | use lsp_types::{ | 1 | use lsp_types::{ |
2 | self, CreateFile, DocumentChangeOperation, DocumentChanges, Documentation, Location, | 2 | self, CreateFile, DiagnosticSeverity, DocumentChangeOperation, DocumentChanges, Documentation, |
3 | LocationLink, MarkupContent, MarkupKind, Position, Range, RenameFile, ResourceOp, SymbolKind, | 3 | Location, LocationLink, MarkupContent, MarkupKind, Position, Range, RenameFile, ResourceOp, |
4 | TextDocumentEdit, TextDocumentIdentifier, TextDocumentItem, TextDocumentPositionParams, Url, | 4 | SymbolKind, TextDocumentEdit, TextDocumentIdentifier, TextDocumentItem, |
5 | VersionedTextDocumentIdentifier, WorkspaceEdit, | 5 | TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier, WorkspaceEdit, |
6 | }; | 6 | }; |
7 | use ra_ide_api::{ | 7 | use ra_ide_api::{ |
8 | translate_offset_with_edit, CompletionItem, CompletionItemKind, FileId, FilePosition, | 8 | translate_offset_with_edit, CompletionItem, CompletionItemKind, FileId, FilePosition, |
9 | FileRange, FileSystemEdit, InsertTextFormat, LineCol, LineIndex, NavigationTarget, RangeInfo, | 9 | FileRange, FileSystemEdit, InsertTextFormat, LineCol, LineIndex, NavigationTarget, RangeInfo, |
10 | SourceChange, SourceFileEdit, | 10 | Severity, SourceChange, SourceFileEdit, |
11 | }; | 11 | }; |
12 | use ra_syntax::{SyntaxKind, TextRange, TextUnit}; | 12 | use ra_syntax::{SyntaxKind, TextRange, TextUnit}; |
13 | use ra_text_edit::{AtomTextEdit, TextEdit}; | 13 | use ra_text_edit::{AtomTextEdit, TextEdit}; |
@@ -79,6 +79,16 @@ impl Conv for CompletionItemKind { | |||
79 | } | 79 | } |
80 | } | 80 | } |
81 | 81 | ||
82 | impl Conv for Severity { | ||
83 | type Output = DiagnosticSeverity; | ||
84 | fn conv(self) -> DiagnosticSeverity { | ||
85 | match self { | ||
86 | Severity::Error => DiagnosticSeverity::Error, | ||
87 | Severity::WeakWarning => DiagnosticSeverity::Hint, | ||
88 | } | ||
89 | } | ||
90 | } | ||
91 | |||
82 | impl ConvWith for CompletionItem { | 92 | impl ConvWith for CompletionItem { |
83 | type Ctx = LineIndex; | 93 | type Ctx = LineIndex; |
84 | type Output = ::lsp_types::CompletionItem; | 94 | type Output = ::lsp_types::CompletionItem; |