microsoft / microsoft/TypeScript-TmLanguage
Broken syntax highlighting for generic function with optional type in Typescript JSX
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 471
- Forks
- 149
- PR merge metrics
- No merged PRs in 30d
Description
Type: Bug
Inside of a new .tsx file, create the following code:
type GenericType<T> = boolean;
const testGeneric = <T = void,>(): GenericType<T> => {
return true;
};
const testGeneric2 = <T,>(): GenericType<T> => {
return true;
};
Every => after the <T = void,> will be incorrectly highlighted.

VS Code version: Code 1.75.1 (Universal) (441438abd1ac652551dbe4d408dfcec8a499b8bf, 2023-02-08T21:34:59.000Z)
OS version: Darwin arm64 22.2.0
Modes:
Sandboxed: No
System Info
| Item | Value |
|---|---|
| CPUs | Apple M1 Pro (8 x 24) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled metal: disabled_off multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
| Load (avg) | 2, 2, 2 |
| Memory (System) | 16.00GB (0.09GB free) |
| Process Argv | --crash-reporter-id b866acdc-8967-448e-b6c1-00876386ce17 |
| Screen Reader | no |
| VM | 0% |
Extensions (20)
| Extension | Author (truncated) | Version |
|---|---|---|
| vscode-tailwindcss | bra | 0.9.7 |
| vscode-eslint | dba | 2.4.0 |
| vsc-material-theme-icons | equ | 2.5.0 |
| prettier-vscode | esb | 9.10.4 |
| git-graph | mhu | 1.30.0 |
| theme-monokai-pro-vscode | mon | 1.2.0 |
| vscode-docker | ms- | 1.24.0 |
| isort | ms- | 2022.8.0 |
| python | ms- | 2023.2.0 |
| vscode-pylance | ms- | 2023.2.40 |
| jupyter | ms- | 2023.1.2010391206 |
| jupyter-keymap | ms- | 1.0.0 |
| jupyter-renderers | ms- | 1.0.14 |
| vscode-jupyter-cell-tags | ms- | 0.1.6 |
| vscode-jupyter-slideshow | ms- | 0.1.5 |
| code-spell-checker | str | 2.17.1 |
| vscode-stylelint | sty | 1.2.4 |
| vscode-icons | vsc | 12.2.0 |
| gitblame | wad | 10.1.0 |
| vscode-todo-highlight | way | 1.0.5 |
(6 theme extensions excluded)
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
vscccc:30610679
pyindex848:30662994
nodejswelcome1:30587005
3biah626:30602489
pyind779:30671433
89544117:30613380
pythonsymbol12:30671437
2i9eh265:30646982
funwalk2cf:30671525
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the supplied TypeScript JSX snippet in a new .tsx file to reproduce the highlighting problem. Then inspect the TypeScript-TmLanguage grammar files and trace how the generic function syntax is classified. Done means the shown examples render with correct highlighting in VS Code without mis-highlighting later => tokens.
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