diff options
author | Jeremy Kolb <[email protected]> | 2019-01-22 02:42:37 +0000 |
---|---|---|
committer | Jeremy Kolb <[email protected]> | 2019-01-22 02:42:37 +0000 |
commit | b77d780f0e9e7902695b949a25588fcb66bb5982 (patch) | |
tree | 3f2cde5aafd881efaf2c6da1b2811cbb173b8ed9 /crates/ra_hir | |
parent | 5d110c0ee2ec50009eb7c552888a73ce8380d34a (diff) |
Thread documentation through FnSignature and CompletionItem
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/code_model_api.rs | 5 | ||||
-rw-r--r-- | crates/ra_hir/src/code_model_impl/function.rs | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index 88eda5ed0..57f405f4f 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs | |||
@@ -297,6 +297,7 @@ pub struct FnSignature { | |||
297 | /// True if the first param is `self`. This is relevant to decide whether this | 297 | /// True if the first param is `self`. This is relevant to decide whether this |
298 | /// can be called as a method. | 298 | /// can be called as a method. |
299 | pub(crate) has_self_param: bool, | 299 | pub(crate) has_self_param: bool, |
300 | pub(crate) documentation: String, | ||
300 | } | 301 | } |
301 | 302 | ||
302 | impl FnSignature { | 303 | impl FnSignature { |
@@ -317,6 +318,10 @@ impl FnSignature { | |||
317 | pub fn has_self_param(&self) -> bool { | 318 | pub fn has_self_param(&self) -> bool { |
318 | self.has_self_param | 319 | self.has_self_param |
319 | } | 320 | } |
321 | |||
322 | pub fn documentation(&self) -> &String { | ||
323 | &self.documentation | ||
324 | } | ||
320 | } | 325 | } |
321 | 326 | ||
322 | impl Function { | 327 | impl Function { |
diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs index 66d7e1713..c848f7a82 100644 --- a/crates/ra_hir/src/code_model_impl/function.rs +++ b/crates/ra_hir/src/code_model_impl/function.rs | |||
@@ -2,7 +2,7 @@ mod scope; | |||
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use ra_syntax::{TreeArc, ast::{self, NameOwner}}; | 5 | use ra_syntax::{TreeArc, ast::{self, NameOwner, DocCommentsOwner}}; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
8 | DefId, HirDatabase, Name, AsName, Function, FnSignature, Module, | 8 | DefId, HirDatabase, Name, AsName, Function, FnSignature, Module, |
@@ -72,11 +72,15 @@ impl FnSignature { | |||
72 | } else { | 72 | } else { |
73 | TypeRef::unit() | 73 | TypeRef::unit() |
74 | }; | 74 | }; |
75 | |||
76 | let comments = node.doc_comment_text(); | ||
77 | |||
75 | let sig = FnSignature { | 78 | let sig = FnSignature { |
76 | name, | 79 | name, |
77 | params, | 80 | params, |
78 | ret_type, | 81 | ret_type, |
79 | has_self_param, | 82 | has_self_param, |
83 | documentation: comments, | ||
80 | }; | 84 | }; |
81 | Arc::new(sig) | 85 | Arc::new(sig) |
82 | } | 86 | } |