microsoft / microsoft/TypeScript-TmLanguage

Incorrect Token Scoping for ⁠defer Keyword in TypeScript 5.9 in VSCode

Open
#1,058 1 comment 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

Type: Bug

With the release of TypeScript 5.9, a new feature supporting the ⁠import defer functionality has been introduced. However, when using VSCode's "Developer: Inspect Editor Tokens and Scopes" to inspect the ⁠defer keyword, it is currently scoped as ⁠variable.other.readwrite.alias.ts instead of the expected ⁠import.control.defer.ts. This issue prevents the proper application of style changes using TextMate.
It seems that the ⁠defer keyword should be correctly scoped under the ⁠import.control.defer.ts range as mentioned above.
Thank you.

VS Code version: Code 1.103.0 (e3550cfac4b63ca4eafca7b601f0d2885817fd1f, 2025-08-06T21:40:10.271Z)
OS version: Darwin arm64 24.6.0
Modes:

System Info
Item Value
CPUs Apple M2 Pro (10 x 2400)
GPU Status 2d_canvas: enabled
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 2, 2, 2
Memory (System) 16.00GB (1.27GB free)
Process Argv --crash-reporter-id 02ee976f-ec4c-41ed-91a6-793656140857
Screen Reader no
VM 0%
Extensions disabled
A/B Experiments
vsliv368:30146709
vswsl492:30256859
pythonvspyt551:31249599
binariesv615:30325510
vscrp:30673768
nativeloc1:31344060
dwcopilot:31170013
6074i472:31201624
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
c7cif404:31314491
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
0aa6g176:31307128
747dc170:31275177
aj953862:31281341
pylancequickfixf:31358881
9d2cg352:31346308
convertlamdaf:31358879
usemarketplace:31343026
nesew2to5:31336538
1292j425:31332164
agentclaude:31350858
replacestringexc:31350595
nes-set-on:31351930
testaa123cf:31335227
6abeh943:31336334
yijiwantestdri0626-c:31336931
0927b901:31350571
4gdec884:31348710
45650338:31358607
0cj2b977:31352657
gaj49834:31362110
asdad-cf:31365767
showgoogle:31363597

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 at the TypeScript TextMate grammar entry that matches the import defer syntax and inspect how the defer token is currently scoped. Reproduce the result in VS Code 1.103.0 with Developer: Inspect Editor Tokens and Scopes, then verify that defer reports import.control.defer.ts rather than variable.other.readwrite.alias.ts.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.