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

Feature Request - Support/Plugin for ES7 Async/Await syntax #1188

Closed
ghost opened this issue Apr 2, 2016 · 31 comments
Closed

Feature Request - Support/Plugin for ES7 Async/Await syntax #1188

ghost opened this issue Apr 2, 2016 · 31 comments
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Apr 2, 2016

I'm using Babel like many others, and AFAIK there's no way to parse async functions with jsdoc - correct?

Is this something I should perhaps write a plugin for, and if so, how would I go about doing that? Or does this perhaps already exist somewhere I haven't already looked?

great project btw!

@ghost ghost changed the title Feature Request - Support ES7 Async/Await syntax Feature Request - Support/Plugin for ES7 Async/Await syntax Apr 2, 2016
@catalsdevelop
Copy link

i meet with same problems

@sabrinaluo
Copy link

+1

@jcowgar
Copy link

jcowgar commented May 3, 2016

I just wrote a very generic/dumb jsdoc plugin that allows us to use jsdoc on code that includes async/await. It does so by stripping the async/await words from the source file.

I just published it to npm, you can grab it https://www.npmjs.com/package/jsdoc-strip-async-await ... this is just a tide-me-over async/await is officially supported.

@Icemic
Copy link

Icemic commented May 9, 2016

+1

3 similar comments
@vasyas
Copy link

vasyas commented Jul 22, 2016

+1

@285858315
Copy link

+1

@ejfrancis
Copy link

+1

@DataTables
Copy link

Is there any scope to sponsor features such as this?

@hegemonic
Copy link
Contributor

JSDoc will support this feature sometime soonish after Espree, our JavaScript parser, supports it. The Espree work is being tracked in eslint/espree#287; looks like it's getting close.

@DataTables
Copy link

Awesome - thanks. I suppose more generally is there a way to donate or otherwise sponsor development on JSDoc? I get a lot of use from it (as I'm sure others do) is its only fair to contribute back. Unfortunately I don't have time to add code at the moment, but I'd like to help somehow and this is perhaps one way. I didn't find anything on the site or in this repo, so perhaps its not something that you or the other developers are interested in (absolutely understand!).

Hexcles added a commit to taskcluster/taskcluster-pulse that referenced this issue Oct 18, 2016
For now, only use JSDoc on `rabbitmanager.js`.  Generated website goes
to `docs/jsdoc`, which is ignored in git.

Note: jsdoc currently (as of 3.4) does not support async/await keywords
(jsdoc/jsdoc#1188), so we have to use a jsdoc plugin to strip out these
two keywords.  Otherwise, jsdoc would complain about parsing errors.
Hexcles added a commit to taskcluster/taskcluster-pulse that referenced this issue Oct 27, 2016
For now, only use JSDoc on `rabbitmanager.js`.  Generated website goes
to `docs/jsdoc`, which is ignored in git.

Note: jsdoc currently (as of 3.4) does not support async/await keywords
(jsdoc/jsdoc#1188), so we have to use a jsdoc plugin to strip out these
two keywords.  Otherwise, jsdoc would complain about parsing errors.
Hexcles added a commit to taskcluster/taskcluster-pulse that referenced this issue Oct 27, 2016
For now, only use JSDoc on `rabbitmanager.js`.  Generated website goes
to `docs/jsdoc`, which is ignored in git.

Note: jsdoc currently (as of 3.4) does not support async/await keywords
(jsdoc/jsdoc#1188), so we have to use a jsdoc plugin to strip out these
two keywords.  Otherwise, jsdoc would complain about parsing errors.
itsbriany pushed a commit to itsbriany/taskcluster-pulse that referenced this issue Nov 10, 2016
For now, only use JSDoc on `rabbitmanager.js`.  Generated website goes
to `docs/jsdoc`, which is ignored in git.

Note: jsdoc currently (as of 3.4) does not support async/await keywords
(jsdoc/jsdoc#1188), so we have to use a jsdoc plugin to strip out these
two keywords.  Otherwise, jsdoc would complain about parsing errors.
@leeyeh
Copy link

leeyeh commented Dec 14, 2016

FYI, ES2017 support for espree landed in v3.2.0

@macdja38
Copy link

+1 As async/await is now fully supported in node.js as of 7.6

@hegemonic hegemonic added this to the 3.4.x milestone Mar 29, 2017
@damianobarbati
Copy link

any news on this?

@cula
Copy link

cula commented Apr 18, 2017

+1

2 similar comments
@area73
Copy link

area73 commented May 3, 2017

+1

@jerroydmoore
Copy link

+1

@ghost
Copy link

ghost commented May 10, 2017

Does this make sense?

https://github.com/jvanveen/jsdoc/commit/a789c902c56e7852ecff1825dc4f5d8fcd36a5ed

I fiddled a bit with the walker and updated espree to a version that supports async.

@larsgw
Copy link

larsgw commented May 15, 2017

+1

@LeeJim
Copy link

LeeJim commented May 16, 2017

use jsdoc plugin - jsdoc-babel

@keithrz
Copy link

keithrz commented May 19, 2017

@jvanveen 's repo worked for me. +1 to a jsdoc version with those changes

@zbraniecki
Copy link

zbraniecki commented Jun 6, 2017

@jvanveen - we use your branch in FluentDOM and encountered an error with the following code:

async function x() {
  let ctx = new Promise(function(){});
  ctx = await ctx;
}

@ghost
Copy link

ghost commented Jun 15, 2017

I'll look into it. Got the same issue.

@Fl4m3Ph03n1x
Copy link

Any news on this? Or do we still have to depend on plugins?

  1. https://www.npmjs.com/package/jsdoc-strip-async-await
  2. https://github.com/ctumolosus/jsdoc-babel

@ghost
Copy link

ghost commented Jun 20, 2017

thanks for the reminder, will work on this after lunch 😀

@ghost
Copy link

ghost commented Jun 20, 2017

This may be a better approach: https://github.com/jvanveen/jsdoc/commit/3e913813c382b9da7a1ce81946f49cdcb6992544

A jsdoc template can check for a node's async property to indicate that it's an async function. Something like https://github.com/wearespindle/jsdoc-rtd/commit/c4a1265a8c37bfe23ffdb2a4cf6c9f1f8e22248c

@ghost
Copy link

ghost commented Jun 20, 2017

screenshot_20170620_170130

@jeroenvollenbrock
Copy link

@jvanveen I ran into a lot of problems while trying to use your fork on es2015 classes with async method definitions. Method definitions have a subnode called value, on which the async property is added. This made the jsdoc-rtd template crash. I've added a finisher to the function and method visitor that adds the async property to the doclet instead, and updated the templateHelper to add async as method attribute. I've also made the code run on node4 again, as your commits broke this too. This avoids having to change your template and resolves the crashes.
jvanveen/jsdoc#1

hegemonic added a commit that referenced this issue Jul 2, 2017
@hegemonic hegemonic modified the milestones: 3.5.0, 3.4.x Jul 2, 2017
@hegemonic
Copy link
Contributor

Fixed on master. The fix will be included in JSDoc 3.5.0.

JSDoc now autodetects async functions. In addition, you can use the new @async tag in a virtual comment to indicate that a function is async.

Also, the default template identifies async functions in its output. Third-party templates may not yet support this feature.

@lll000111
Copy link

Unfortunately it still doesn't seem to work (3.5.5.): #1442

@l3laze
Copy link

l3laze commented Feb 5, 2018

Trying to document async functions is still not working for me; v4.0.1.

@lll000111
Copy link

@hegemonic (ping) Does this need to be reopened?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests