microsoft / microsoft/TypeScript-TmLanguage
TextMate tokenizer enters incorrect scope after typeof a < "u" in JavaScript, affecting subsequent function declarations
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 471
- Fork
- 149
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
VS Code Version
Version: 1.124.2 (user setup)
Commit: 6928394f91b684055b873eecb8bc281365131f1c
Date: 2026-06-12T00:12:36Z
Electron: 42.2.0
ElectronBuildId: 14159160
Chromium: 148.0.7778.97
Node.js: 24.15.0
V8: 14.8.178.14-electron.0
OS: Windows_NT x64 10.0.26200
Fresh install of VS Code with all default settings. No extensions installed, no custom configuration applied.
Also reproduced on VS Code for the Web (vscode.dev) with no extensions or custom configuration.
Reproducible Example
function bar() {
return "bar";
}
var a = typeof a < "u";
function foo() {
return "foo";
}
Steps to Reproduce
- Install VS Code with all default settings (no extensions, no custom configuration).
- Create a new
.jsfile. - Paste the code above.
- Run:
Developer: Inspect Editor Tokens and Scopes
- Inspect the first
functionkeyword (bardeclaration). - Inspect the second
functionkeyword (foodeclaration).
Actual Result
The first function declaration is tokenized correctly:
storage.type.function.js
meta.function.js
source.js
The second function declaration is tokenized incorrectly:
entity.name.type.js
meta.type.parameters.js
meta.var.expr.js
source.js
Syntax highlighting becomes incorrect for all code following:
var a = typeof a < "u";
Expected Result
The second function declaration should receive the same scopes as the first:
storage.type.function.js
meta.function.js
source.js
No tokenizer state should leak past the end of the variable declaration.
Additional Investigation
Replacing:
var a = typeof a < "u";
with:
var a = typeof a > "u";
Notes
- Reproduced on a fresh VS Code install with all default settings and no extensions.
- Reproduced across all built-in themes; the issue is not theme-specific.
- The JavaScript is syntactically valid.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo l’esempio in un file JavaScript e usa “Developer: Inspect Editor Tokens and Scopes” per confrontare le due dichiarazioni di funzione. Segui le regole della grammatica TextMate che gestiscono typeof a < "u" e la dichiarazione seguente; il lavoro è completato quando la seconda funzione riceve gli stessi scopes della prima e lo stato del tokenizer non si propaga più nel codice successivo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 68/100