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

Comment moves inside of object #5417

Open
STRd6 opened this issue Apr 28, 2022 · 1 comment
Open

Comment moves inside of object #5417

STRd6 opened this issue Apr 28, 2022 · 1 comment

Comments

@STRd6
Copy link
Contributor

STRd6 commented Apr 28, 2022

When trying to add a JSDoc comment to an object that is an argument to a function the comment gets moved to the first key of the object. I would expect the comment to be on the first key if there is no explicit { but it seems to attach to the first key even when the explicit { is present after the comment.

f a, ###* @type {Something} ### {
  key: {}
}

Actual:

// Generated by CoffeeScript 2.6.1
f(a, {
  /** @type {Something} */key: {}
});

Expected:

// Generated by CoffeeScript 2.6.1
f(a, /** @type {Something} */ {
  key: {}
});
@GeoffreyBooth
Copy link
Collaborator

Same note as #5415 (comment). Comments are stowaways on the nearest “real” token, and because of the rewriter { tokens are sometimes not part of the normal stream (since they’re often inserted later, because of implicit objects). I’d love to support JSDoc comments as much as possible.

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

No branches or pull requests

2 participants