aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_analysis/src/lib.rs2
-rw-r--r--crates/ra_editor/src/symbols.rs12
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs4
3 files changed, 12 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs
index db4e1ba86..9475c938d 100644
--- a/crates/ra_analysis/src/lib.rs
+++ b/crates/ra_analysis/src/lib.rs
@@ -261,7 +261,7 @@ impl Analysis {
261 pub fn doc_comment_for( 261 pub fn doc_comment_for(
262 &self, 262 &self,
263 file_id: FileId, 263 file_id: FileId,
264 symbol: FileSymbol 264 symbol: FileSymbol,
265 ) -> Cancelable<Option<String>> { 265 ) -> Cancelable<Option<String>> {
266 self.imp.doc_comment_for(file_id, symbol) 266 self.imp.doc_comment_for(file_id, symbol)
267 } 267 }
diff --git a/crates/ra_editor/src/symbols.rs b/crates/ra_editor/src/symbols.rs
index bf3ac6ff2..f7681c76f 100644
--- a/crates/ra_editor/src/symbols.rs
+++ b/crates/ra_editor/src/symbols.rs
@@ -24,12 +24,17 @@ pub struct FileSymbol {
24 24
25impl FileSymbol { 25impl FileSymbol {
26 pub fn docs(&self, file: &File) -> Option<String> { 26 pub fn docs(&self, file: &File) -> Option<String> {
27 file.syntax().descendants() 27 file.syntax()
28 .descendants()
28 .filter(|node| node.kind() == self.kind && node.range() == self.node_range) 29 .filter(|node| node.kind() == self.kind && node.range() == self.node_range)
29 .filter_map(|node: SyntaxNodeRef| { 30 .filter_map(|node: SyntaxNodeRef| {
30 fn doc_comments<'a, N: DocCommentsOwner<'a>>(node: N) -> Option<String> { 31 fn doc_comments<'a, N: DocCommentsOwner<'a>>(node: N) -> Option<String> {
31 let comments = node.doc_comment_text(); 32 let comments = node.doc_comment_text();
32 if comments.is_empty() { None } else { Some(comments) } 33 if comments.is_empty() {
34 None
35 } else {
36 Some(comments)
37 }
33 } 38 }
34 39
35 visitor() 40 visitor()
@@ -42,7 +47,8 @@ impl FileSymbol {
42 .visit(doc_comments::<ast::ConstDef>) 47 .visit(doc_comments::<ast::ConstDef>)
43 .visit(doc_comments::<ast::StaticDef>) 48 .visit(doc_comments::<ast::StaticDef>)
44 .accept(node)? 49 .accept(node)?
45 }).nth(0) 50 })
51 .nth(0)
46 } 52 }
47} 53}
48 54
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 3e9da8470..c872b0dc4 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -494,8 +494,8 @@ pub fn handle_hover(
494 494
495 return Ok(Some(Hover { 495 return Ok(Some(Hover {
496 contents, 496 contents,
497 range: Some(range) 497 range: Some(range),
498 })) 498 }));
499 } 499 }
500 } 500 }
501 501