microsoft / TypeScript-TmLanguage

TextMate grammar files for TypeScript for VS Code, Sublime Text, and Atom.
MIT License
412 stars 126 forks source link

TypeScript - incorrect highlighting when a new line is added #896

Open ChrisRaven opened 2 years ago

ChrisRaven commented 2 years ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Paste the code below to the VS Code

type testType = { on (eventName: ${Key}Changed): void; }

let a = 1;



The result is, that the "let" keyword is highlighted incorrectly. Same happens with any other keyword (const, function, etc.):

![incorrect](https://user-images.githubusercontent.com/421359/147419210-5cea8053-c1a4-4f14-a5c0-343217b5d4b5.png)

After removing the new line between the second and the third line, everything works correctly. The content of the third line doesn't matter; there could be only parentheses as well.

![correct](https://user-images.githubusercontent.com/421359/147419213-b6754118-d110-4680-a83a-8ec8ce10a46f.png)
wlinna commented 2 years ago

For me it looks more like the latter one regardless of the newline.

I have an opposite problem though – the is colored incorrectly without the newline, but looks correct when I add the newline. These pictures were taken when semantic highlighting was turned off. If I turn semantic highlighting on, it looks much better, but the if still gets that incorrect yellowish color.

Screenshot from 2022-07-08 11-20-32

Screenshot from 2022-07-08 11-21-38

I use vscode 1.68.1 with the default dark+ theme.