Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix jsdoc #5891

Merged
merged 2 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/doc/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ impl DocParser {

pub fn js_doc_for_span(&self, span: Span) -> Option<String> {
let comments = self.ast_parser.get_span_comments(span);
let js_doc_comment = comments.iter().find(|comment| {
let js_doc_comment = comments.iter().rev().find(|comment| {
comment.kind == CommentKind::Block && comment.text.starts_with('*')
})?;

Expand Down
9 changes: 8 additions & 1 deletion cli/doc/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,20 @@ impl DocFileLoader for TestLoader {
#[tokio::test]
async fn export_fn() {
let source_code = r#"/**
* @module foo
*/

/**
* Hello there, this is a multiline JSdoc.
*
* It has many lines
*
* Or not that many?
*/
export function foo(a: string, b?: number, cb: (...cbArgs: unknown[]) => void, ...args: unknown[]): void {
/**
* @todo document all the things.
*/
console.log("Hello world");
}
"#;
Expand Down Expand Up @@ -143,7 +150,7 @@ export function foo(a: string, b?: number, cb: (...cbArgs: unknown[]) => void, .
"location": {
"col": 0,
"filename": "test.ts",
"line": 8,
"line": 12,
},
"name": "foo",
});
Expand Down