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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .raw or .extra.raw to Identifier #15117

Open
1 task
fisker opened this issue Nov 2, 2022 · 2 comments
Open
1 task

Add .raw or .extra.raw to Identifier #15117

fisker opened this issue Nov 2, 2022 · 2 comments

Comments

@fisker
Copy link
Contributor

fisker commented Nov 2, 2022

馃捇

  • Would you like to work on this feature?

What problem are you trying to solve?

I'm adding support for "Explicit Resource Management" in Prettier.

There is a test added in #14968

for (using o\u0066 of of);

Since

for (using of of of);

is invalid, so we can't print o\u006 as of, and there seems no easy way to fix this.

I've try to convince ESTree to add .raw, but most likely that's not going to happen. link

I'm not sure what's the best to do. Let me know what you think.

Describe the solution you'd like

Change Identifer to

{
	"type": "Identifer",
	"value": "of",
	"raw": "o\u0066"
}

Describe alternatives you've considered

We can slice from the original input, but it's difficult because of .typeAnnotation exists.

Documentation, Adoption, Migration Strategy

No response

@babel-bot
Copy link
Collaborator

Hey @fisker! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@liuxingbaoyu
Copy link
Member

liuxingbaoyu commented Nov 2, 2022

Can prettier not support this? I really can't imagine anyone doing this in real code. 馃槀

I personally have no problem with adopting the option to enable appending raw to extra.
But I'm concerned that this will have a performance impact, even for the prettier.

By the way, prettier/prettier#8917 Although it was reopened, it was not unlocked.

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

No branches or pull requests

3 participants