microsoft / microsoft/TypeScript-TmLanguage
Generic constructor with more than one generic type can break syntax highlighting.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 471
- Forks
- 149
- PR merge metrics
- No merged PRs in 30d
Description
JavaScript and TypeScript Nightly version:
Last released - 4/4/2023, 02:09:37
Last updated - 4/4/2023, 18:09:42
Code
export class Foo {
readonly bar = {
map: new Map<
Type1, Type2>([])
};
private function() {
return 1;
}
}
The code above breaks syntax highlighting, I have also tested in insiders vscode with nightly typescript.

It is fine, if both generics are on the same line as the main type:

If there is only 1 generic, it does slightly better, the highlighting of the generic is wrong, but the rest of the file is ok.

Or if the argument to the constructor is not a list, this it is also recoverable, although both the highlighting of the generic, and the closing angle bracket are wrong.

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
No source file or test is named. Start by reproducing the multiline TypeScript generic-constructor example in the issue, compare it with the working variants, and trace the TypeScript TextMate grammar responsible for syntax highlighting. Done means the shown code and its surrounding file retain correct highlighting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100