-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Comments
i meet with same problems |
+1 |
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. |
+1 |
3 similar comments
+1 |
+1 |
+1 |
Is there any scope to sponsor features such as this? |
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. |
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!). |
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.
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.
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.
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.
FYI, ES2017 support for espree landed in v3.2.0 |
+1 As async/await is now fully supported in node.js as of 7.6 |
any news on this? |
+1 |
2 similar comments
+1 |
+1 |
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. |
+1 |
use jsdoc plugin - jsdoc-babel |
@jvanveen 's repo worked for me. +1 to a jsdoc version with those changes |
@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;
} |
I'll look into it. Got the same issue. |
Any news on this? Or do we still have to depend on plugins? |
thanks for the reminder, will work on this after lunch 😀 |
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 |
@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. |
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 Also, the default template identifies async functions in its output. Third-party templates may not yet support this feature. |
Unfortunately it still doesn't seem to work (3.5.5.): #1442 |
Trying to document async functions is still not working for me; v4.0.1. |
@hegemonic (ping) Does this need to be reopened? |
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!
The text was updated successfully, but these errors were encountered: