diff options
author | Matt Dumler <mattd3v@pm.me> | 2020-06-01 17:40:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 18:40:51 -0400 |
commit | a4567e0e0162349f141ce2795ce793cfccfa1f9b (patch) | |
tree | 7357d316e5c4dd988ba442e3e6176324d28231a2 /cli/doc/printer.rs | |
parent | d8c681d37a8958bee83eedcb5dd196fa6d77654e (diff) |
fix(doc): remove JSDoc comment truncation (#6031)
Diffstat (limited to 'cli/doc/printer.rs')
-rw-r--r-- | cli/doc/printer.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/cli/doc/printer.rs b/cli/doc/printer.rs index f7f41079d..d7a754933 100644 --- a/cli/doc/printer.rs +++ b/cli/doc/printer.rs @@ -35,7 +35,7 @@ pub fn format_details(node: doc::DocNode) -> String { let js_doc = node.js_doc.clone(); if let Some(js_doc) = js_doc { - details.push_str(&format_jsdoc(js_doc, false, 1)); + details.push_str(&format_jsdoc(js_doc, 1)); } details.push_str("\n"); @@ -92,7 +92,7 @@ fn format_(doc_nodes: Vec<doc::DocNode>, indent: i64) -> String { for node in sorted { output.push_str(&format_signature(&node, indent)); if let Some(js_doc) = node.js_doc { - output.push_str(&format_jsdoc(js_doc, true, indent)); + output.push_str(&format_jsdoc(js_doc, indent)); } output.push_str("\n"); if DocNodeKind::Namespace == node.kind { @@ -308,19 +308,15 @@ fn add_indent(string: String, indent: i64) -> String { } // TODO: this should use some sort of markdown to console parser. -fn format_jsdoc(jsdoc: String, truncated: bool, indent: i64) -> String { - let mut lines = jsdoc.split("\n\n").map(|line| line.replace("\n", " ")); +fn format_jsdoc(jsdoc: String, indent: i64) -> String { + let lines = jsdoc.split("\n\n").map(|line| line.replace("\n", " ")); let mut js_doc = String::new(); - if truncated { - let first_line = lines.next().unwrap_or_else(|| "".to_string()); - js_doc.push_str(&add_indent(format!("{}\n", first_line), indent + 1)); - } else { - for line in lines { - js_doc.push_str(&add_indent(format!("{}\n", line), indent + 1)); - } + for line in lines { + js_doc.push_str(&add_indent(format!("{}\n", line), indent + 1)); } + format!("{}", colors::gray(js_doc)) } |