microsoft / microsoft/TypeScript-TmLanguage

Syntax highlighting broken in lambda after type statement without semicolon

Offen
#889 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
TypeScript
Sterne
471
Forks
149
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Bug Report

🔎 Search Terms

syntax highlight semicolon lambda

🕗 Version & Regression Information
  • This is not a bug with the compiler
  • This is a VSCode syntax highlighting bug
  • VSCode Version 1.61.2
Version: 1.61.2 (user setup)
Commit: 6cba118ac49a1b88332f312a8f67186f7f3c1643
Date: 2021-10-19T14:57:20.575Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19043
⏯ Playground Link

Playground link with relevant code

💻 Code
declare function doFoo(arg: any): void

type A = number
doFoo(() => {
    type B = number
    const b = 5
})
const a = 1
🙁 Actual behavior

type and const get colored oddly inside the lambda.

image

Notice that the colors are different in and out of the lambda.

Scope/token debugging:

image

🙂 Expected behavior

The syntax highlighting should look like this:

image

Notice that colors are the same in and out of the lambda. I added a semicolon in this case to the type statement to workaround the issue.

Scope/token debugging:

image

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Öffne den verlinkten TypeScript Playground und reproduziere den Unterschied bei der Hervorhebung in VS Code 1.61.2 mit der bereitgestellten Lambda-Funktion und den Typdeklarationen. Untersuche das Verhalten der TextMate-Grammatik sowie die Scope-/Token-Ausgabe rund um die Typanweisung ohne Semikolon. Als erledigt gilt die Aufgabe, wenn type und const innerhalb und außerhalb der Lambda-Funktion dieselbe Hervorhebung erhalten, ohne dass ein Semikolon erforderlich ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
devtools, tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.