microsoft / TypeScript-TmLanguage

TextMate grammar files for TypeScript for VS Code, Sublime Text, and Atom.
MIT License
398 stars 125 forks source link

Syntax highlighting broken in lambda after type statement without semicolon #889

Open grant-dennison opened 2 years ago

grant-dennison commented 2 years ago

Bug Report

🔎 Search Terms

syntax highlight semicolon lambda

🕗 Version & Regression Information

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

grant-dennison commented 2 years ago

Ah, didn't know about this repository. Thanks for the switch! Looks like this might be a duplicate of #873. Should I copy info over from this issue to that one before closing?