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

It would be helpful if custom formatters could handle a returned Promise #244

Closed
mshick opened this issue Nov 1, 2024 · 5 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@mshick
Copy link

mshick commented Nov 1, 2024

It would be quite helpful if custom formatters registered with registerCustomFormat could handle a returned Promise, in particular for the toFile method.

The practical use-case here is running prettier.format (async-only) on contents being written to ensure they conform to a project's code style.

I realize Decap does not support async toFile methods.

The footprint of this change appears to be quite small though, since there are only two calls to formatEntryFile and both are in the context of async functions.

@kyoshino kyoshino added the enhancement New feature or request label Nov 1, 2024
@kyoshino
Copy link
Member

kyoshino commented Nov 1, 2024

Sure, it’s probably not a big deal.

@kyoshino kyoshino self-assigned this Nov 2, 2024
@mshick
Copy link
Author

mshick commented Nov 3, 2024

That's awesome, thanks!

@kyoshino
Copy link
Member

kyoshino commented Nov 4, 2024

Shipped v0.46.0 with the async support.

@kyoshino
Copy link
Member

kyoshino commented Nov 4, 2024

I’ve just found this Decap issue. It’s closed but Decap doesn’t support async methods as you said. It’s perhaps closed by accident or as wontfix (because ES6 promise support is relatively new), and I’ve “effectively solved” the very old issue. 🙃

@mshick
Copy link
Author

mshick commented Nov 4, 2024

Haha, nice! 9 years old!

Impressive that you're able to knock these out so quickly — a real testament to how much the frontend frameworks have evolved, and your solid code of course.

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

No branches or pull requests

2 participants