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 optional chaining operator to TypeScript lexer #1475

Merged

Conversation

pyrmont
Copy link
Contributor

@pyrmont pyrmont commented Apr 3, 2020

As discussed in #1420, TypeScript had added support for the optional chaining operator ?.. This PR adds support by prepending a rule to the :root state. Eventually, when JavaScript adopts the operator, the rule should be moved into the :root state there and removed from this lexer.

This closes #1420.

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

pyrmont commented Apr 3, 2020

@codebutler Does this look all right to you? Looking good for me.

typescript

@codebutler
Copy link

Looks great!!

Webstorm for comparison:

image

@pyrmont pyrmont merged commit b942deb into rouge-ruby:master Apr 3, 2020
@pyrmont pyrmont removed the needs-review The PR needs to be reviewed label Apr 3, 2020
@pyrmont pyrmont deleted the typescript.optional-chaining-in-strings branch April 3, 2020 20:29
@pyrmont
Copy link
Contributor Author

pyrmont commented Apr 3, 2020

@codebutler Neat! Sorry it took a while for what is, in the end, quite a simple fix. This will be part of the next release of Rouge—that's scheduled for release on Tuesday 14 April :)

mattt pushed a commit to NSHipster/rouge that referenced this pull request May 21, 2020
…-ruby#1475)

TypeScript has added support for the optional chaining operator `?.` as
of version 3.7. This commit adds support by prepending a rule to the
`:root` state of the TypeScript lexer. Eventually, when JavaScript
adopts the operator, the rule should be moved into the `:root` state
there and removed from this lexer.
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.

TypeScript: Issue with optional chaining inside templated string
2 participants