microsoft / theme-converter-for-vs

CLI tool that allows you to convert your VS Code color theme to a VS 2022 color theme.
MIT License
501 stars 53 forks source link

Fails to parse working vscode theme #161

Open josefgraus opened 1 year ago

josefgraus commented 1 year ago

I attempted to convert Black Ocean theme from vscode following the instructions in the repo. I used "Administrator: Developer Command Prompt for VS 2022" in order to build ThemeConverter. I ran into the following error attempting to use it to convert the theme I'd like to port over to Visual Studio:

ThemeConverter.exe -i "D:\Coding\black-ocean-color-theme.json" -t "C:\Program Files\Microsoft Visual Studio\2022\Community"
Converting D:\Coding\black-ocean-color-theme.json

Newtonsoft.Json.JsonReaderException: Invalid character after parsing property name. Expected ':' but got: ". Path 'colors.foreground', line 1, position 11071.
   at Newtonsoft.Json.JsonTextReader.ParseProperty()
   at Newtonsoft.Json.JsonTextReader.ParseObject()
   at Newtonsoft.Json.Linq.JContainer.ReadContentFrom(JsonReader r, JsonLoadSettings settings)
   at Newtonsoft.Json.Linq.JContainer.ReadTokenFrom(JsonReader reader, JsonLoadSettings options)
   at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
   at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
   at Newtonsoft.Json.Linq.JObject.Parse(String json)
   at ThemeConverter.Converter.ConvertFile(String themeJsonFilePath, String pkgdefOutputPath) in D:\Coding\theme-converter-for-vs\ThemeConverter\ThemeConverter\Converter.cs:line 61
   at ThemeConverter.Program.Convert(String sourcePath, String pkgdefOutputPath, String deployInstall) in D:\Coding\theme-converter-for-vs\ThemeConverter\ThemeConverter\Program.cs:line 100
   at ThemeConverter.Program.Main(String[] args) in D:\Coding\theme-converter-for-vs\ThemeConverter\ThemeConverter\Program.cs:line 62

Seems to get caught up attempting to parse the json for the theme.

This is definitely a blocker with no immediate workaround for me (I am not the theme writer).

nickp138 commented 9 months ago

It's due to the comments in the JSON file. If you remove all the comments that start below line #435 then it should work correctly.