问题
I've recently started coding TypeScript in VS Code, but I did thought that the syntax highlighting is really bad. So I started to Google around and found out that at its best it could look like this:
Mine looks like this:
I am using TypeScript 2.0.3 and working on a mac 10.11.6.
回答1:
What helped me was what @Reg1nleifr mentioned in their comment: Switching the color scheme.
Go to Preferences -> Color Theme and change it to Dark+ (default dark).
回答2:
The syntax highlighting in VSCode is driven by textmate files. This is the repository : https://github.com/Microsoft/TypeScript-TmLanguage/
It recently (16 days ago) went through a massive refactor : https://github.com/Microsoft/TypeScript-TmLanguage/pull/257 so hopefully it should get better if you update to vscode latest.
More
The best highlighting would come if it was done using the same code the compiler uses to parse the code. That isn't how vscode is architectured at the moment, so I do have my own code that does it : https://basarat.gitbooks.io/alm/content/features/typescript.html#syntax-highlighting
来源:https://stackoverflow.com/questions/39822230/vs-code-syntax-typescript-syntax-highlighting