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

Add support for nullish coalescing operator to TypeScript lexer #1529

Merged

Conversation

pyrmont
Copy link
Contributor

@pyrmont pyrmont commented May 30, 2020

An upcoming ECMAScript feature is the nullish coalescing operator, ??. While it is not part of ECMAScript yet, it is supported in TypeScript. However, the current TypeScript lexer breaks when lexing it in template strings. This PR fixes this by adding a rule to match against this operator.

This fixes #1516.

@pyrmont pyrmont added the needs-review The PR needs to be reviewed label May 30, 2020
@pyrmont pyrmont self-assigned this May 30, 2020
@pyrmont
Copy link
Contributor Author

pyrmont commented Jun 1, 2020

This is dependent on #1530 and will need to be rebased once that is merged.

@pyrmont pyrmont added dependent-pr The PR is dependent on other changes being merged and will be reviewed later. and removed needs-review The PR needs to be reviewed labels Jun 1, 2020
@pyrmont pyrmont force-pushed the bugfix.typescript-nullish-coalescing branch from 15fab46 to 437bcb7 Compare June 2, 2020 20:10
@pyrmont pyrmont added needs-review The PR needs to be reviewed and removed dependent-pr The PR is dependent on other changes being merged and will be reviewed later. labels Jun 2, 2020
@pyrmont pyrmont merged commit ce26fd9 into rouge-ruby:master Jun 2, 2020
@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Jun 2, 2020
mattt pushed a commit to NSHipster/rouge that referenced this pull request May 19, 2021
)

TypeScript has added support for the nullish coalescing operator `??` as
of version 3.7. This commit adds support by prepending a rule to the
`:root` state of lexers that extend the TypeScript common module.
When JavaScript adopts the operator, the rule should be moved into the
`:root` state of the JavaScript lexer and removed from the TypeScript
common module.
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.

Null coalesce breaks highlighting in template string (Javascript/Typescript)
1 participant