admin管理员组

文章数量:1328037

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:

To look like this:

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:

To look like this:

Share Improve this question asked May 13, 2017 at 21:48 OgglasOgglas 70.3k42 gold badges377 silver badges473 bronze badges 1
  • 2 Did you have any success in the last 2 years? I need this so much – ditoslav Commented Oct 12, 2019 at 15:33
Add a ment  | 

2 Answers 2

Reset to default 2

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:

Can you confirm that other TSLS features are working correctly on your installation? (formatting, pletions, etc).

There is a known issue with TextMate support in VS where sometimes there are missing colors. To make sure this isn’t the case here can you try running the following from a VS Developer cmd prompt to see if it resolves the issue: • devenv.exe /updateconfiguration • devenv.exe /setup

What is your VS installation directory? Ex: C:\Program Files[ (x86)]\Microsoft Visual Studio 15.0\Common7\IDE

Does the tmLanguage folder exist under the TypeScript installation path? Ex: C:\Program Files\Microsoft Visual Studio 15.0\Common\IDE\CommonExtensions\Microsoft\TypeScript\tmLanguage

Do you have any custom grammar files (.tmLanguage, .tmTheme) located in your user profile? Ex: %userprofile%.vs\Extensions

Can you verify this isn’t a TM language caching issue:

  • Close VS
  • Go to the TexMateCache location: %localappdata%\Microsoft\VisualStudio[15.0XXXXX]\TextMateCache
  • Delete all the .cache files in this directory
  • Reopen VS and try to repro

Does this resolve the issue? Do you have the TypeScript TextMate registry key set correctly?

  • Close VS
  • Open regedit
  • Select HKLM
  • File > Load Hive …
  • Open %localappdata%\Microsoft\VisualStudio\15.0_xxx\privateregistry.bin (you can name the hive VS)
  • Now navigate to: Computer\HKEY_LOCAL_MACHINE\VS\Software\Microsoft\VisualStudio\15[XXXXX]_Config\TextMate\Repositories

本文标签: Visual Studio Code color theme in Visual Studio 2017 for JavaScript and TypeScript filesStack Overflow