aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-22 15:06:32 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-22 15:06:32 +0000
commit595a2f9900d052d0c5cc3529602aec0cbcd52614 (patch)
tree7af6dd503e1247952e3689b562c5470f4ae28613 /crates/ra_lsp_server
parent9e0abfc0c9b9d36c45c9d8567c632c0167b31084 (diff)
parent7c27e6d2b3133e4c37b176f0e13c15994eb16dfa (diff)
Merge #593
593: Docs for completion r=matklad a=kjeremy The first commit adds documentation support to CompletionItems. The second one I am unsure about. Is that the right way to add docs for functions? If so should I do something similar for other `hir` types and CompletionItems? Co-authored-by: Jeremy Kolb <[email protected]> Co-authored-by: Jeremy A. Kolb <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r--crates/ra_lsp_server/src/conv.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs
index 23b226fac..6818acaf6 100644
--- a/crates/ra_lsp_server/src/conv.rs
+++ b/crates/ra_lsp_server/src/conv.rs
@@ -1,6 +1,6 @@
1use lsp_types::{ 1use lsp_types::{
2 self, CreateFile, DocumentChangeOperation, DocumentChanges, Location, LocationLink, 2 self, CreateFile, Documentation, DocumentChangeOperation, DocumentChanges, Location, LocationLink,
3 Position, Range, RenameFile, ResourceOp, SymbolKind, TextDocumentEdit, TextDocumentIdentifier, 3 MarkupContent, MarkupKind, Position, Range, RenameFile, ResourceOp, SymbolKind, TextDocumentEdit, TextDocumentIdentifier,
4 TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier, 4 TextDocumentItem, TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier,
5 WorkspaceEdit, 5 WorkspaceEdit,
6}; 6};
@@ -87,6 +87,13 @@ impl ConvWith for CompletionItem {
87 None 87 None
88 }; 88 };
89 89
90 let documentation = self.documentation().map(|value| {
91 Documentation::MarkupContent(MarkupContent {
92 kind: MarkupKind::Markdown,
93 value: value.to_string(),
94 })
95 });
96
90 let mut res = lsp_types::CompletionItem { 97 let mut res = lsp_types::CompletionItem {
91 label: self.label().to_string(), 98 label: self.label().to_string(),
92 detail: self.detail().map(|it| it.to_string()), 99 detail: self.detail().map(|it| it.to_string()),
@@ -94,6 +101,7 @@ impl ConvWith for CompletionItem {
94 kind: self.kind().map(|it| it.conv()), 101 kind: self.kind().map(|it| it.conv()),
95 text_edit: Some(text_edit), 102 text_edit: Some(text_edit),
96 additional_text_edits, 103 additional_text_edits,
104 documentation: documentation,
97 ..Default::default() 105 ..Default::default()
98 }; 106 };
99 res.insert_text_format = Some(match self.insert_text_format() { 107 res.insert_text_format = Some(match self.insert_text_format() {