Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code Syntax TypeScript Syntax Highlighting

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:

enter image description here

Mine looks like this:

enter image description here

I am using TypeScript 2.0.3 and working on a mac 10.11.6.

like image 886
Reg1nleifr Avatar asked Oct 02 '16 22:10

Reg1nleifr


People also ask

Does VS Code have syntax highlighting?

Syntax highlighting determines the color and style of source code displayed in the Visual Studio Code editor. It is responsible for colorizing keywords like if or for in JavaScript differently than strings and comments and variable names.

How do you add syntax highlights?

To add a syntax highlighting language, simply check its checkbox in the main list of languages. It will appear with a checkmark in bold font to show that it has been selected but not yet installed.


2 Answers

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).

like image 68
Terry Avatar answered Sep 28 '22 12:09

Terry


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

like image 39
basarat Avatar answered Sep 28 '22 13:09

basarat