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

Update JS/TS lexer #1781

Open
7 of 9 tasks
Mesteery opened this issue Apr 20, 2021 · 6 comments
Open
7 of 9 tasks

Update JS/TS lexer #1781

Mesteery opened this issue Apr 20, 2021 · 6 comments
Labels
A-lexing area: changes to individual lexers help wanted Community help appreciated!

Comments

@Mesteery
Copy link
Contributor

Mesteery commented Apr 20, 2021

The JavaScript (and TypeScript lexer) should be updated :

  • more errors (Error, EvalError, InternalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError) as Name.Exception ?
  • the global object (Name.Builtin, Node.js)
  • more Name.Builtin (such as typed arrays, Intl, DataView, Set, Map, WeakSet, WeakMap, Reflect, JSON, ArrayBuffer, Atomics) ?
  • highlight \\..., \n, \r, \v, \t, \b, \f, \uXXXX (U+0000 - U+FFFF), \xXX (0x00 - 0xFF) as String.Escape (same as Python lexer)
  • **, **=, ??, &&=, ||=, ??= as Operator
  • typeof, instanceof, in, void, delete, new as Operator.Word
  • missings keywords (function*, yield*), others ?
  • use the same base for JavaScript and TypeScript lexers (same operators, ...)
  • d regex's flag

Originally posted by @Mesteery in #1741 (comment)

@Anteru Anteru added help wanted Community help appreciated! A-lexing area: changes to individual lexers labels Apr 20, 2021
@Anteru
Copy link
Collaborator

Anteru commented Jun 20, 2021

What's the rationale for new being Operator.Word?

@Mesteery
Copy link
Contributor Author

Mesteery commented Jun 20, 2021

According to MDN and https://tc39.es/ecma262, new is an operator.

@Mesteery
Copy link
Contributor Author

I also have a question, should the Keyword.Reserved be the same as https://tc39.es/ecma262/#prod-ReservedWord?

@Anteru
Copy link
Collaborator

Anteru commented Jun 20, 2021

Thanks for the quick reply -- Operator it is. On the second question, yes, that sounds right.

@Mesteery
Copy link
Contributor Author

(#1814)

@Mesteery Mesteery changed the title JavaScript/TypeScript (big) update Update JS/TS lexer Oct 9, 2021
@HarelM
Copy link

HarelM commented Jun 24, 2023

I'm not sure this is the right place to bring it up, so sorry in advance...
I'm looking into replacing the documentation of my site to Mkdocs-material which uses pygments under the hood for syntax highlighting.
The following is how I see it in github, which highlight class names and method names for example:

// Adds a full screen control to the map
map.addControl(new maplibregl.FullscreenControl({container: document.querySelector('body')}));

screen shot in dark mode of github:
image

This is how it looks in mkdocs material(I hope they are using the latest version of pygment):
image

This is how it looks in vs code:
image

Let me know if there's something I can do to help put push this forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lexing area: changes to individual lexers help wanted Community help appreciated!
Projects
None yet
Development

No branches or pull requests

3 participants