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

后端 未结 2 1059
傲寒
傲寒 2021-02-04 05:32

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 se

相关标签:
2条回答
  • 2021-02-04 06:18

    Can you confirm that other TSLS features are working correctly on your installation? (formatting, completions, 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
    0 讨论(0)
  • 2021-02-04 06:23

    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:

    0 讨论(0)
提交回复
热议问题