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

fix(javascript) correctly highlight 'for await' again #4240

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wolfgang42
Copy link

Fixes highlighting for for await (foo) {}, which had regressed.

Closes #4235.

Changes

The FUNCTION_CALL highlighting function has a list of excluded keywords; adding await there fixed the highlighting.

However, I’m not sure this is the correct fix. I notice there is another special case as well:

{
// prevent this from getting swallowed up by function
// since they appear "function like"
beginKeywords: "while if switch catch for"
},

This implies to me that perhaps something in this grammar is in the wrong order, or needs its relevance adjusted, but that seems like a much bigger change and I’m having a hard time figuring out what it would need to look like.

Also, it is technically possible (if very confusing) to have a function called await, and this would be highlighted incorrectly:

async function await() {}
await await()

Checklist

  • Added markup tests, or they don't apply here because...
  • Updated the changelog at CHANGES.md

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

Successfully merging this pull request may close these issues.

(javascript) regression: “for await“ highlighted as function instead of keyword
1 participant