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

Support ES6 syntax #111

Closed
DavidBruant opened this issue Jun 1, 2013 · 7 comments
Closed

Support ES6 syntax #111

DavidBruant opened this issue Jun 1, 2013 · 7 comments

Comments

@DavidBruant
Copy link

Among other things, ES6 added arrow function syntax.

setTimeout(() => {console.lol()}, 200)

Currently, Prism highlights the arrow as if it was the inequality operator.

@loganfranken
Copy link
Contributor

I put together a CodePen that shows the current level of support for ES6 features in Prism:
http://codepen.io/loganfranken/pen/aOwMXw

It actually looks like the arrow function syntax is now supported (wahoo!), but there are just a few missing pieces:

  • Octal Literals (0o543)
  • Binary Literals (0b101011)
  • Template Strings
  • Regex y Flag
  • Regex u Flag
  • of Keyword (used in for..of loops)
  • as Keyword (used w/ import statement)
  • from Keyword (used w/ import statement)

@apfelbox
Copy link
Contributor

For point 1 & 2 see #597.

@Golmote
Copy link
Contributor

Golmote commented Jun 14, 2015

Fat arrow and spread operators are highlighted, indeed, but not as whole tokens. => gets highlighted because of = and > being operators, and ... because of . being punctuation.
I wonder if we should add them on their own.

@Golmote
Copy link
Contributor

Golmote commented Jun 14, 2015

Just added support for template strings (04f72b1). I updated the examples with a section illustrating those ES6 features:

http://puu.sh/ioDbf/1642341e7c.png

I also updated the known failures:

http://puu.sh/ioDdB/191d618d6c.png

@loganfranken
Copy link
Contributor

You're all so awesome!

I think we're done here, right? We can close this issue?

(Unless you wanted to keep it open to address the edge cases you described, @Golmote?)

@Golmote
Copy link
Contributor

Golmote commented Jun 14, 2015

No, I think we can close it for now. We'll think about those spread and fat arrow operators later, since they are currently highlighted, though not as semantically as expected.

@Golmote Golmote closed this as completed Jun 14, 2015
@darenju
Copy link

darenju commented Aug 28, 2017

Any work on that? I understand these operators are already highlighted, but a drawback is for people who use fonts with ligatures.

Since Prism renders those operators in two separate spans, the ligature can't be processed.

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

5 participants