From dcc0a9cd7ed5521aa521920c4b67e149523beb7f Mon Sep 17 00:00:00 2001 From: kjeremy Date: Thu, 31 Oct 2019 16:21:46 -0400 Subject: Attach docs to statics --- crates/ra_syntax/src/ast.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'crates/ra_syntax/src/ast.rs') diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index a12da5be2..1ec9881b9 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs @@ -112,6 +112,20 @@ fn test_doc_comment_of_items() { assert_eq!("doc", module.doc_comment_text().unwrap()); } +#[test] +fn test_doc_comment_of_statics() { + let file = SourceFile::parse( + r#" + /// Number of levels + static LEVELS: i32 = 0; + "#, + ) + .ok() + .unwrap(); + let st = file.syntax().descendants().find_map(StaticDef::cast).unwrap(); + assert_eq!("Number of levels", st.doc_comment_text().unwrap()); +} + #[test] fn test_doc_comment_preserves_indents() { let file = SourceFile::parse( -- cgit v1.2.3