Bad syntax Highlighting in TS when using multiline union types
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- tooling
Research direction
Reproduce the TypeScript snippet in VS Code and inspect the repository's TextMate grammar files to locate handling for multiline union types. Done means the following function is highlighted correctly without requiring a semicolon or an extra blank line.
Written by the indexing model from the issue text.
Description
Does this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: 1.95.3
- OS Version: MacOS 15.0.1
Steps to Reproduce:
Write the following in VSCode
let myObj:
| {
prop1: string
}
| {
prop2: string
}
function myFunc() {}
The syntax of function myFunc() {} and everything after it is broken.
I found that it happens only in this rare edge case. Some things that actually fix it:
- Adding a semicolon
let myObj:
| {
prop1: string
}
| {
prop2: string
};
function myFunc() {}
- Writing the union type on a single line
let myObj: { prop1: string } | { prop2: string }
function myFunc() {}
- Adding a line break before the next line of code
let myObj:
| {
prop1: string
}
| {
prop2: string
}
function myFunc() {}
Bad highlighting:
Wanted highlighting:
- Dominant language
- TypeScript
- Stars
- 471
- Forks
- 149
- PR merge metrics
- No merged PRs in 30d
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.
More from microsoft/TypeScript-TmLanguage
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
microsoft/TypeScript-TmLanguage#1071 ·
-
triste Open
Difficulty 5/5 Over a week Newbie friendliness 5/100
microsoft/TypeScript-TmLanguage#1078 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
microsoft/TypeScript-TmLanguage#1076 · 6 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
microsoft/TypeScript-TmLanguage#1074 · 2 comments ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 58/100
microsoft/TypeScript-TmLanguage#1066 · 1 comment ·
All issues in microsoft/TypeScript-TmLanguage
Similar issues
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
supermomonga/zcode-acp#24 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
growthbook/growthbook#7100 ·
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100