JS: Promise.catch incorrectly highlighted as keyword

Issue #1305 new
Former user created an issue

Catch is a keyword in JavaScript. However, it is also a legal function name and is used by the Promise standard to register a catch handler. Pygments incorrectly highlights the catch method as keyword even if it is none.


function fib(num) {
    if (num <= 2) {
        return 1;

    return fib(num - 1) + fib(num - 2);

parallel.run(fib, 100) |$\label{code:parallel-run}$|
    .catch(error => console.error(error))
    .then(result => console.log(result));

Expected Behavior: Catch is not highlighted as keyword Actual Behavior: Catch is highlighted as keyword

Comments (0)

  1. Log in to comment