microsoft / microsoft/TypeScript-TmLanguage
Syntax highlighting: generic type arguments are highly affected by whitespace and other irrelevant context
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 471
- Forks
- 149
- PR merge metrics
- No merged PRs in 30d
Description
🔎 Search Terms
syntax highlighting generics
🕗 Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ for entries about syntax highlighting and generics.
⏯ Playground Link
💻 Code
declare function abc<A, B, C>(): unknown
const abc2 = abc<1, 2, 3>
const abc3 = abc<X, Y, Z>
const abc4 = abc<
1,
2,
3
>
const abc5 = abc<
X,
Y,
Z
>
const result1 = abc<1, 2, 3>()
const result2 = abc<
1,
2,
3
>()
const result3 = abc<X, Y, Z>()
const result4 = abc<
X,
Y,
Z
>()
const arr = [
abc<1, 2, 3>(),
abc<
1,
2,
3
>(),
abc<X, Y, Z>(),
abc<
X,
Y,
Z
>(),
]
const obj = {
result1: abc<1, 2, 3> (),
result2: abc<
1,
2,
3
>(),
result3: abc<X, Y, Z>(),
result4: abc<
X,
Y,
Z
>(),
}
🙁 Actual behavior
Declaring a function signature with generics seems to be pretty robust to changes in whitespace and surrounding context, but passing type arguments is extremely brittle.
This is the preceding code sample in VS Code with the Monokai Pro color scheme:
🙂 Expected behavior
Consistent syntax highlighting:
abcto be consistently green (3/16)<>to be consistently gray (3/16)()to be consistently gray (8/12)X,Y,Zto be consistently blue (3/8)1,2,3to be consistently purple (6/8)
Additional information about the issue
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
Start with the TypeScript TextMate grammar files in this repository and reproduce the Playground example in VS Code using the Monokai Pro color scheme. Compare generic type arguments across the whitespace and surrounding-context variations shown in the issue. Done means the listed identifiers, angle brackets, parentheses, type arguments, and numeric arguments receive consistent highlighting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100