aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-10-31 19:41:24 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-10-31 19:41:24 +0000
commit55ebe6380aef233fff86b7e6cead361787bf1f65 (patch)
tree9ed060e4738a0504ddfd146649b9cf8a2f2fac40 /crates/ra_lsp_server/src
parentdfba29e4fb66457d101db295e3c356a932ac005e (diff)
parent74320945b664916005d263552194201cbe9a52bc (diff)
Merge #167
167: Attempt to extract useful comments from function signatures r=matklad a=kjeremy I'm trying to extract useful function comments for signature info. This will also be useful for hover. This is a WIP (and actually works pretty well!) but I don't think it's the right approach long term so some guidance would be appreciated so that we could also get comments for say types and variable instances etc. Currently `test_fn_signature_with_simple_doc` fails due to a bug in `extend` but we probably shouldn't use this approach anyway. Maybe comments should be attached to nodes somehow? I'm also thinking that maybe the markdown bits should live in the language server. Thoughts? Co-authored-by: Jeremy A. Kolb <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs13
1 files changed, 11 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 4ac08e527..20cb5f772 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -5,7 +5,7 @@ use languageserver_types::{
5 CodeActionResponse, Command, CompletionItem, CompletionItemKind, Diagnostic, 5 CodeActionResponse, Command, CompletionItem, CompletionItemKind, Diagnostic,
6 DiagnosticSeverity, DocumentSymbol, FoldingRange, FoldingRangeKind, FoldingRangeParams, 6 DiagnosticSeverity, DocumentSymbol, FoldingRange, FoldingRangeKind, FoldingRangeParams,
7 InsertTextFormat, Location, Position, SymbolInformation, TextDocumentIdentifier, TextEdit, 7 InsertTextFormat, Location, Position, SymbolInformation, TextDocumentIdentifier, TextEdit,
8 RenameParams, WorkspaceEdit, PrepareRenameResponse 8 RenameParams, WorkspaceEdit, PrepareRenameResponse, Documentation, MarkupContent, MarkupKind
9}; 9};
10use gen_lsp_server::ErrorCode; 10use gen_lsp_server::ErrorCode;
11use ra_analysis::{FileId, FoldKind, Query, RunnableKind}; 11use ra_analysis::{FileId, FoldKind, Query, RunnableKind};
@@ -465,9 +465,18 @@ pub fn handle_signature_help(
465 }) 465 })
466 .collect(); 466 .collect();
467 467
468 let documentation = if let Some(doc) = descriptor.doc {
469 Some(Documentation::MarkupContent(MarkupContent {
470 kind: MarkupKind::Markdown,
471 value: doc
472 }))
473 } else {
474 None
475 };
476
468 let sig_info = SignatureInformation { 477 let sig_info = SignatureInformation {
469 label: descriptor.label, 478 label: descriptor.label,
470 documentation: None, 479 documentation,
471 parameters: Some(parameters), 480 parameters: Some(parameters),
472 }; 481 };
473 482