Visual Studio Code color theme in Visual Studio 2017 for JavaScript and TypeScript files

Viewed 4265

As the topic suggests I would like to import/set Visual Studio Code color theme in Visual Studio 2017 for JavaScript and TypeScript files. The files I therefore would like to set color theme for are: .js, .jsx, .ts and .tsx. If it is not possible to edit per file or language then I would like to know if it is possible to import a whole theme that looks like Visual Studio Code.

In short I would like this:

enter image description here

To look like this: enter image description here

2 Answers

I did end up finding a way!

TL:DR:

Download JavaScript.tmLanguage and JavaScript.tmTheme.

  • Go to %USERPROFILE%\.vs\Extensions\javascript\Syntaxes (%USERPROFILE% usually is C:\Users\{username})
  • Create the folders if they are not present.
  • Paste the two files
  • Restart the VS, should have the vscode highlighting for js, jsx etc files!

If you want to port any vscode theme to Visual Studio,

  • In vscode generate color theme from current setting.(Ref.) This will be the tmTheme file
  • Get tmLanguage of the language from vscode's repo
  • Convert both json to plist. (I used plist)
  • Add filetypes to tmLanguage file if its not there.
  • Add both to %USERPROFILE%\.vs\Extensions\language\Syntaxes folder.
  • Done!

I have tested for VS2019, and as I followed VS docs, it seems like it should work till VS2015.

Screenshot: Sample react syntax highlighting in VS

Related