microsoft / microsoft/TypeScript-TmLanguage

VSCode Syntax highlighting broken when using nullish coalescing operator in jsx

Open
#908 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
471
Forks
149
PR merge metrics
No merged PRs in 30d

Description

TS and JS Grammar Extension version: 0.0.55 / latest

Not a big deal, but in vscode, syntax highlighting breaks when using nullish coalescing operator in jsx. See how the closing tags after the null coalescing operators /> change of color (white, then reddish) :

image

When the correct highlighting should be :

image

Code example:

<InfoTooltip title={tooltip ?? ''}>
  <MenuItem>
    <ListItemIcon>
      <Icon fontSize="small" />
    </ListItemIcon>
    <ListItemText primary={label ?? <Component ref={clickRef} />} />
  </MenuItem>
</InfoTooltip>

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the JSX example in VS Code with the TypeScript and JavaScript Grammar Extension, then inspect the TypeScript-TmLanguage grammar files that classify nullish coalescing expressions. Done means closing JSX tags after nullish coalescing operators retain the same correct highlighting shown in the expected example.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.