Skip to content

Copy doc comments from Rust to JS #57

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

Closed
fitzgen opened this issue Mar 6, 2018 · 3 comments · Fixed by #430
Closed

Copy doc comments from Rust to JS #57

fitzgen opened this issue Mar 6, 2018 · 3 comments · Fixed by #430

Comments

@fitzgen
Copy link
Member

fitzgen commented Mar 6, 2018

Would be good for JS programmers reading the generated JS to have documentation on

  • Classes
  • Methods
  • Functions
  • Anything else that gets emitted and has a doc comment in the Rust version
@FreeMasen
Copy link
Contributor

Would that require a modification to #23 to include the doc comment strings?

@alexcrichton
Copy link
Contributor

Indeed! That's fine though, the format isn't specified yet :)

@FreeMasen
Copy link
Contributor

After #265 we are now copying doc comments from Rust to JS for the following using the JSDoc format.

  • Classes
  • Methods
  • Public Attributes
  • Functions

The only other doc comments that I can think of would be module level comments.

One of the nice things about the JSDoc comments is that they define the tooltip content when working in VSCode. I would ideally like to see the following annotated lines added to our current translation.

  • @constructor: When using no-modules this would be added to the prototype function
  • @param {type} name: This would be added for each parameter in a function signature
  • @returns {type}: This would be added to functions and methods that return non-unit types
    • We could also have unit returns annotated with void

Both @param and @returns optionally can have a description added to them, I do not believe that Rust Doc comments have this feature?

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

Successfully merging a pull request may close this issue.

3 participants