aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model_api.rs5
-rw-r--r--crates/ra_hir/src/code_model_impl/function.rs6
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
302impl FnSignature { 303impl 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
322impl Function { 327impl 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
3use std::sync::Arc; 3use std::sync::Arc;
4 4
5use ra_syntax::{TreeArc, ast::{self, NameOwner}}; 5use ra_syntax::{TreeArc, ast::{self, NameOwner, DocCommentsOwner}};
6 6
7use crate::{ 7use 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 }