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

JS: Private fields #1950

Merged
merged 6 commits into from
Jul 13, 2019
Merged

Conversation

RunDevelopment
Copy link
Member

This PR adds support for JS's new private field by highlighting the # as an operator.

Example

image

Copy link
Member

@mAAdhaTTah mAAdhaTTah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure the private field symbol is an operator, but I'm not really sure what it is, so this works for me.

@RunDevelopment
Copy link
Member Author

RunDevelopment commented Jun 29, 2019

I made it an operator because I wanted some highlighting but looking at this it might have been the wrong choice.

# is part of the name

The spec.

Maybe a new token (e.g. sigil) is the best solution?

Anyhow, I have to update this PR because I didn't consider private async function. Edit: Private functions aren't a thing yet.

@mAAdhaTTah
Copy link
Member

If it's part of the name, then maybe it shouldn't be highlighted separately? Especially if it's supposed to be part of the name as the "mental model", we'd be do a disservice to that way of thinking by highlighting it separately.

Not in love with a new token, unless you're suggesting aliasing it to operator?

@RunDevelopment
Copy link
Member Author

we'd be doing a disservice to that way of thinking by highlighting it separately.

That's true.

Since it's not clear yet as to whether and how we should highlight the #, I'll remove the highlighting for now. We can always add it in the future may the need arise.

The PR is not closed because the function and function variables tokens have to be adjusted (see new test).

@RunDevelopment
Copy link
Member Author

Re-reviewed and adjusted JS Extras. I think it's ready.

@RunDevelopment RunDevelopment merged commit 7bd0832 into PrismJS:master Jul 13, 2019
@RunDevelopment RunDevelopment deleted the js-private-fields branch July 13, 2019 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants