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

RegExp literal not highlighted after logical compound assignment #564

Closed
MageJohn opened this issue Dec 7, 2020 · 3 comments
Closed

RegExp literal not highlighted after logical compound assignment #564

MageJohn opened this issue Dec 7, 2020 · 3 comments

Comments

@MageJohn
Copy link

MageJohn commented Dec 7, 2020

I've found that a regexp literal is not highlighted as a string if it's on the right of one of the logical compound assignment operators, (logical AND, OR, and nullish assignment).

To reproduce

Paste this code into a js2-mode buffer:

foo &&= /bar/;
foo ||= /bar/;
foo ??= /bar/;

Expected behaviour

The /bar/ should be highlighted as a string on each line.

Actual behaviour

The slashes don't delimitate a string, and so the contents are highlighted by other rules.

Thanks for the great mode!

@dgutov
Copy link
Collaborator

dgutov commented Dec 9, 2020

Thanks for the report.

These are relatively new additions to the language, actually. So the main problem here is to start parsing those operators correctly. Then the regexps should right themselves automatically.

@dgutov
Copy link
Collaborator

dgutov commented Dec 9, 2020

This should do it.

@dgutov dgutov closed this as completed in f7816bd Dec 9, 2020
@MageJohn
Copy link
Author

MageJohn commented Dec 9, 2020

Amazing, thanks for the quick fix!

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

2 participants