microsoft / microsoft/TypeScript-TmLanguage

Syntax highlighting broken in lambda after type statement without semicolon

Open
#889 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

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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.