GNU bug report logs -
#26750
25.2; js-mode missing keywords
Previous Next
Full log
Message #16 received at 26750 <at> debbugs.gnu.org (full text, mbox):
Technically, "async", "await" and "yield" can also be identifiers.
"async" should only be highlighted if it's followed by a function, arrow
function or a method. "await" should only be highlighted if it's inside
an async function, async arrow function or an async method. "yield"
should only be highlighted inside a generator function/arrow function
and method. But for all intends and purposes, you can put "await" and
"yield" into the list of keywords or you'll have to write a full blown
parser and AST in order to traverse back and forth. That's how Chrome
devtools does it anyway. Only "async", "as", "of" and "from" need
special handling.
On 28/04/2018 22:08, Noam Postavsky wrote:
> forcemerge 26750 31306
> quit
>
> Ruslan Bekenev <furyinbox <at> gmail.com> writes:
>
>> Hi. It is my first contribution.
>> I hope everything is correct with this PATCH and submission itself.
>> In this patch added two missed keywords to `js--keyword-re` which are `as` and `of`.
>> `async` and `await` are already there.
> Hi, sorry your patch was overlooked for so long. Unfortunately, I think
> just adding keywords to js--keyword-re will not quite do the right
> thing, based on https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31306#5:
>
> Specially, "as" and "from" should only be highlighted in an import
> statement. "of" should only be highlighted in a for statement. Any other
> occurrances of "as", "from" and "of" should not be highlighted as they
> are legal identifiers outside of import and for statements respectively.
>
>
This bug report was last modified 6 years and 11 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.