microsoft / microsoft/TypeScript-TmLanguage
Syntax highlighting broken in lambda after type statement without semicolon
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 471
- Forks
- 149
- PR merge metrics
- No merged PRs in 30d
Description
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.

Notice that the colors are different in and out of the lambda.
Scope/token debugging:

🙂 Expected behavior
The syntax highlighting should look like this:

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:

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
Open the linked TypeScript Playground and reproduce the highlighting difference in VS Code 1.61.2 using the provided lambda and type declarations. Inspect the TextMate grammar behavior and scope/token output around the type statement without a semicolon. Done means type and const receive the same highlighting inside and outside the lambda without requiring a semicolon.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100